1(function (jQuery) { 2 "use strict"; 3 // data-mode="click" for using event 4 // data-dark="false" for property 5 // icon class // la-sun // la-moon 6 const storageDark = localStorage.getItem('dark') 7 console.log(storageDark) 8 if($('body').hasClass('dark')){ 9 changeMode('true'); 10 } else { 11 changeMode('true'); 12 } 13 if (storageDark !== 'null') { 14 changeMode(storageDark) 15 } 16 jQuery(document).on("change", '.change-mode input[type="checkbox"]' ,function (e) { 17 const dark = $(this).attr('data-active'); 18 if (dark === 'true') { 19 $(this).attr('data-active','false') 20 } else { 21 $(this).attr('data-active','true') 22 } 23 changeMode(dark) 24 }) 25 function changeMode (dark) { 26 const body = jQuery('body') 27 if (dark === 'true') { 28 // $('[data-mode="toggle"]').find('i.a-right').removeClass('ri-sun-line'); 29 // $('[data-mode="toggle"]').find('i.a-left').addClass('ri-moon-clear-line'); 30 $('#dark-mode').prop('checked', true).attr('data-active', 'false') 31 $('.darkmode-logo').removeClass('d-none') 32 $('.light-logo').addClass('d-none') 33 body.addClass('dark') 34 dark = true 35 } else { 36 // $('[data-mode="toggle"]').find('i.a-left').removeClass('ri-moon-clear-line'); 37 // $('[data-mode="toggle"]').find('i.a-right').addClass('ri-sun-line'); 38 $('#dark-mode').prop('checked', false).attr('data-active', 'true'); 39 $('.light-logo').removeClass('d-none') 40 $('.darkmode-logo').addClass('d-none') 41 body.removeClass('dark') 42 dark = false 43 } 44 updateLocalStorage(dark) 45 const event = new CustomEvent("ChangeColorMode", {detail: {dark: dark} }); 46 document.dispatchEvent(event); 47 } 48 function updateLocalStorage(dark) { 49 localStorage.setItem('dark', dark) 50 } 51 52})(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.