1( function() { 2 const html = document.querySelector( 'html' ); 3 const notice = document.querySelector( '.easy-notification-bar' ); 4 5 const cleanup = () => { 6 html.classList.remove( 'easy-notification-bar-is-disabled' ); 7 const styleSheet = document.querySelector( '#easy-notification-bar-css' ); 8 if ( styleSheet ) { 9 styleSheet.remove(); 10 } 11 const inlineStyle = document.querySelector( '#easy-notification-bar-inline-css' ); 12 if ( inlineStyle ) { 13 inlineStyle.remove(); 14 } 15 const script = document.querySelector( '#easy-notification-bar-js' ); 16 if ( script ) { 17 script.remove(); 18 } 19 const scriptExtras = document.querySelector( '#easy-notification-bar-js-extra' ); 20 if ( scriptExtras ) { 21 scriptExtras.remove(); 22 } 23 }; 24 25 if ( notice && html && html.classList.contains( 'easy-notification-bar-is-disabled' ) ) { 26 notice.remove(); 27 cleanup(); 28 } 29 30 const removeOldKeys = function() { 31 var oldKeys = []; 32 for (let i = 0; i < localStorage.length; i++){ 33 if ( 'easy_notification_bar_is_hidden' === localStorage.key(i).substring(0,31) ) { 34 oldKeys.push(localStorage.key(i)); 35 } 36 } 37 for (let i = 0; i < oldKeys.length; i++) { 38 localStorage.removeItem(oldKeys[i]); 39 } 40 }; 41 42 const getLocalStorageKeyName = () => { 43 if ( 'object' === typeof easyNotificationBar ) { 44 return easyNotificationBar.local_storage_keyname || 'easy_notification_bar_is_hidden'; 45 } else { 46 return 'easy_notification_bar_is_hidden'; 47 } 48 } 49 50 document.addEventListener( 'click', (e) => { 51 const toggle = e.target.closest( '[data-easy-notification-bar-close]' ); 52 53 if ( ! toggle ) { 54 return; 55 } 56 57 const isButtonLink = toggle.classList.contains( 'easy-notification-bar-button__link' ); 58 59 if ( ! isButtonLink || ( isButtonLink && '#' === toggle.getAttribute( 'href' ) ) ) { 60 e.preventDefault(); 61 } 62 63 const notice = document.querySelector( '.easy-notification-bar' ); 64 65 if ( notice ) { 66 notice.remove(); 67 } 68 69 if ( html ) { 70 html.classList.remove( 'has-easy-notification-bar' ); 71 } 72 73 if ( 'undefined' !== typeof localStorage ) { 74 removeOldKeys(); 75 localStorage.setItem( getLocalStorageKeyName(), 'yes' ); 76 toggle.dispatchEvent( new CustomEvent( 'easy-notification-bar:close', { bubbles: true } ) ); 77 } 78 } ); 79 80} )();
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.