1/** 2 * @file 3 * Contains \Drupal\view_password\password.js. 4 */ 5 6(function($, Drupal, drupalSettings, once) { 7 'use strict'; 8 9 Drupal.behaviors.pwd = { 10 attach(context) { 11 var span_classes_custom = drupalSettings.view_password.span_classes || ''; 12 13 var icon_exposed_custom = drupalSettings.view_password.icon_exposed || ''; 14 var icon_hidden_custom = drupalSettings.view_password.icon_hidden || ''; 15 16 $(once('view_password_button', '.pwd-see [type=password]', context)) 17 .after( 18 `<button type="button" class="shwpd ${span_classes_custom} eye-close" 19 aria-label="${drupalSettings.view_password.showPasswordLabel}" 20 > 21 </button>` 22 ); 23 if (icon_hidden_custom !== '') { 24 $(once('view_password_icon_button', '.eye-close', context)) 25 .css({'background-image': `url(${icon_hidden_custom})`}); 26 } 27 28 $(once('view_password', '.shwpd', context)) 29 .on('click', function() { 30 // To toggle the images. 31 $(this).toggleClass('eye-close eye-open'); 32 $(this).removeAttr('style'); 33 34 if ($(this).hasClass('eye-open')) { 35 $(this) 36 .siblings(':password') 37 .prop('type', 'text'); 38 $(this) 39 .attr('aria-label', drupalSettings.view_password.hidePasswordLabel); 40 if (icon_exposed_custom !== '') { 41 $(this).css({'background-image': `url(${icon_exposed_custom})`}); 42 } 43 44 } else if ($(this).hasClass('eye-close')) { 45 $(this) 46 .siblings(':text') 47 .prop('type', 'password'); 48 $(this) 49 .attr('aria-label', drupalSettings.view_password.showPasswordLabel); 50 if (icon_hidden_custom !== '') { 51 $(this).css({'background-image': `url(${icon_hidden_custom})`}); 52 } 53 } 54 }); 55 } 56 }; 57})(jQuery, Drupal, drupalSettings, once);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.