1var Drupal = Drupal || {}; 2 3(function($, Drupal){ 4 Drupal.behaviors.a11y = { 5 attach: function(context) { 6 var html = $('html'); 7 8 if ($.cookie('Drupal.boot2017.a11y') != undefined) { 9 const cookie_classes = $.cookie('Drupal.boot2017.a11y'); 10 const classes = cookie_classes.split(/\s+/); 11 $.each(classes, function(index, item) { 12 $('#a11y #btn-' + item).addClass('active'); 13 html.addClass('a11y-' + item); 14 }); 15 } 16 17 $('#a11y button').each(function() { 18 $(this).click(function() { 19 const btn_parts = this.id.split('-', 3); // btn-key-value 20 const classes = html.attr('class').split(/\s+/); 21 22 if (btn_parts[1] == 'RESET') { 23 $.cookie('Drupal.boot2017.a11y', null, {path: '/'}); 24 $('#a11y button').removeClass('active'); 25 $.each(classes, function(index, item) { 26 if (item.substring(0, 5) == 'a11y-') { 27 html.removeClass(item); 28 } 29 }); 30 } 31 else { 32 $.each(classes, function(index, item) { 33 const class_parts = item.split('-', 3); // a11y-key-value 34 if (class_parts[0] == 'a11y' && btn_parts[1] == class_parts[1]) { 35 if (btn_parts[2] != class_parts[2]) { 36 html.removeClass(item); 37 } 38 } 39 html.addClass('a11y-' + btn_parts[1] + '-' + btn_parts[2]); 40 }); 41 $('#group-' + btn_parts[1] + ' button').removeClass('active'); 42 $(this).addClass('active'); 43 44 const new_classes = html.attr('class').split(/\s+/); 45 var storable_classes = []; 46 $.each(new_classes, function(index, item) { 47 var found; 48 if (found = item.match(/^a11y-(.+)$/)) { 49 storable_classes.push(found[1]); 50 } 51 }); 52 $.cookie('Drupal.boot2017.a11y', storable_classes.join(' '), {expires: 90, path: '/'}); 53 } 54 }); 55 }); 56 } 57 } 58})(jQuery, Drupal);
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.