1/* 2 * Chris Rodriguez 3 * [email protected] 4 */ 5 6// Cookie handler, non-$ style 7function createCookie(name, value, days) { 8 if (days) { 9 var date = new Date(); 10 date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); 11 var expires = "; expires=" + date.toGMTString(); 12 } else { 13 var expires = ''; 14 } 15 16 document.cookie = name + "=" + value + expires + "; path=/"; 17} 18 19function readCookie(name) { 20 var nameEQ = name + "="; 21 var ca = document.cookie.split(';'); 22 for (var i = 0; i < ca.length; i++) { 23 var c = ca[i]; 24 while (c.charAt(0) == ' ') c = c.substring(1, c.length); 25 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); 26 } 27 28 return null; 29} 30 31function eraseCookie(name) { 32 createCookie(name, ""); 33} 34 35( function( $ ) { 36 // Saturation handler 37 if (readCookie('a11y-desaturated')) { 38 $('body').addClass('desaturated'); 39 $('#is_normal_color').attr('id', 'is_grayscale').attr('aria-pressed', true).addClass('active'); 40 } 41 42 if (readCookie('a11y-high-contrast')) { 43 $('body').addClass('contrast'); 44 $('head').append($("<link href='" + a11y_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />")); 45 $('#is_normal_contrast').attr('id', 'is_high_contrast').attr('aria-pressed', true).addClass('active'); 46 $('.a11y-toolbar ul li a i').addClass('icon-white'); 47 } 48 49 if (readCookie('a11y-larger-fontsize')) { 50 $('html').addClass('fontsize'); 51 $('#is_normal_fontsize').attr('id', 'is_large_fontsize').attr('aria-pressed', true).addClass('active'); 52 } 53 54 $('.toggle-grayscale').on('click', function (e) { 55 if ($(this).attr('id') == "is_normal_color") { 56 $('body').addClass('desaturated'); 57 $(this).attr('id', 'is_grayscale').attr('aria-pressed', true).addClass('active'); 58 createCookie('a11y-desaturated', '1'); 59 } else { 60 $('body').removeClass('desaturated'); 61 $(this).attr('id', 'is_normal_color').attr('aria-pressed', false).removeClass('active'); 62 eraseCookie('a11y-desaturated'); 63 } 64 65 return false; 66 }); 67 68 $('.toggle-contrast').on('click', function (e) { 69 if ($(this).attr('id') == "is_normal_contrast") { 70 $('head').append($("<link href='" + a11y_stylesheet_path + "' id='highContrastStylesheet' rel='stylesheet' type='text/css' />")); 71 $('body').addClass('contrast'); 72 $(this).attr('id', 'is_high_contrast').attr('aria-pressed', true).addClass('active'); 73 createCookie('a11y-high-contrast', '1'); 74 } else { 75 $('#highContrastStylesheet').remove(); 76 $('body').removeClass('contrast'); 77 $(this).attr('id', 'is_normal_contrast').attr('aria-pressed', false).removeClass('active'); 78 eraseCookie('a11y-high-contrast'); 79 } 80 81 return false; 82 }); 83 84 $('.toggle-fontsize').on('click', function (e) { 85 if ($(this).attr('id') == "is_normal_fontsize") { 86 $('html').addClass('fontsize'); 87 $(this).attr('id', 'is_large_fontsize').attr('aria-pressed', true).addClass('active'); 88 createCookie('a11y-larger-fontsize', '1'); 89 } else { 90 $('html').removeClass('fontsize'); 91 $(this).attr('id', 'is_normal_fontsize').attr('aria-pressed', false).removeClass('active'); 92 eraseCookie('a11y-larger-fontsize'); 93 } 94 95 return false; 96 }); 97 98} )( 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.