1(function () { 2 var Contrast = { 3 storage: 'contrastState', 4 cssClass: 'contrast', 5 currentState: null, 6 check: checkContrast, 7 getState: getContrastState, 8 setState: setContrastState, 9 toogle: toogleContrast, 10 updateView: updateViewContrast 11 }; 12 13 window.toggleContrast = function () { Contrast.toogle(); }; 14 15 if (document.body) { 16 Contrast.check(); 17 } else { 18 document.addEventListener('DOMContentLoaded', function () { 19 Contrast.check(); 20 }); 21 } 22 23 function checkContrast() { 24 this.updateView(); 25 } 26 27 function getContrastState() { 28 return localStorage.getItem(this.storage) === 'true'; 29 } 30 31 function setContrastState(state) { 32 localStorage.setItem(this.storage, '' + state); 33 this.currentState = state; 34 this.updateView(); 35 } 36 37 function updateViewContrast() { 38 var body = document.body; 39 if (!body) return; 40 41 if (this.currentState === null) 42 this.currentState = this.getState(); 43 44 if (this.currentState) 45 body.classList.add(this.cssClass); 46 else 47 body.classList.remove(this.cssClass); 48 } 49 50 function toogleContrast() { 51 this.setState(!this.currentState); 52 } 53})();
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.