1(function (Drupal, drupalSettings) { 2 3 Drupal.behaviors.cbn_bef = { 4 attach: function (context) { 5 if(typeof drupalSettings.cbn_bef != 'undefined' && typeof drupalSettings.cbn_bef.focus_selector != 'undefined' && drupalSettings.cbn_bef.focus_selector != 'nofocus'){ 6 var focusElements = context.querySelectorAll('[data-drupal-selector="' + drupalSettings.cbn_bef.focus_selector + '"]'); 7 focusElements.forEach(function(elem){ 8 var elemLen = elem.value.length; 9 // For IE Only 10 if (document.selection) { 11 // Set focus 12 elem.focus(); 13 // Use IE Ranges 14 var oSel = document.selection.createRange(); 15 // Reset position to 0 & then set at end 16 oSel.moveStart('character', -elemLen); 17 oSel.moveStart('character', elemLen); 18 oSel.moveEnd('character', 0); 19 oSel.select(); 20 } 21 else if (elem.selectionStart || elem.selectionStart == '0') { 22 // Firefox/Chrome 23 elem.selectionStart = elemLen; 24 elem.selectionEnd = elemLen; 25 elem.focus(); 26 } 27 }); 28 } 29 } 30 }; 31})(Drupal, drupalSettings); 32 33
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.