1(function ($) { 2 "use strict"; 3 4 document.addEventListener("accessConfigButtonLoaded", function() { 5 initAccessTools(); 6 function initAccessTools() { 7 $(function () { 8 // init form to default 9 $.each($('.js-access-tools-content :input'), function(key, input) { 10 var value = input.value; 11 if (value.includes('default')) { 12 input.checked = true; 13 } 14 }); 15 16 // -------- init body and form with cookies --------- 17 //Get a list of all cookies as a semicolon+space-separated string 18 document.cookie.split(';') 19 //Filter determines if an element should remain in the array. Here we check if a search string appears at the beginning of the string 20 .filter(function(c) { 21 return c.trim().indexOf('a42') === 0; 22 }) 23 //Map applies a modifier to all elements in an array, here we trim spaces on both sides of the string 24 .map(function(c) { 25 var cookieValue = c.trim().split('=')[1]; 26 if (!cookieValue.includes("-default")) { 27 $('body').addClass(cookieValue); 28 } 29 $('input[value=' + cookieValue + ']').prop("checked", true); 30 // return c.trim(); 31 }); 32 // -------- END init body and form with cookies --------- 33 34 $('.js-access-tools-content :input').on('change', function(e) {
35 // fieldsetId = cookies Key 36 var fieldsetId = $(e.target)[0].parentElement.parentElement.parentElement.id; 37 var inputName = $(e.target).attr('name') 38 var inputValue = $(e.target).attr('value'); 39 if (inputName === 'contrast') { 40 $('body').removeClass(['a42-ac-high-contrast', 'a42-ac-inv-contrast']); 41 if (!inputValue.includes("-default")) { 42 $('body').addClass(inputValue); 43 } 44 } else { 45 if (inputValue.includes("-default")) { 46 var classCssToRemove = inputValue.replace("-default", ""); 47 $('body').removeClass(classCssToRemove); 48 } else { 49 $('body').addClass(inputValue); 50 } 51 } 52 document.cookie = fieldsetId + '=' + inputValue; 53 }); 54 55 $(document).on('keydown', function(event) { 56 if (event.key === "Escape") { 57 document.getElementById('button-close-accessibility-modal').click(); 58 } 59 }); 60 }); 61 } 62 }); 63})(jQuery);
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.