1(function ( $ ) { 2 /** 3 * All of the code for your public-facing JavaScript source 4 * should reside in this file. 5 * 6 * Note that this assume you're going to use jQuery, so it prepares 7 * the $ function reference to be used within the scope of this 8 * function. 9 * 10 * From here, you're able to define handlers for when the DOM is 11 * ready: 12 * 13 * $(function() { 14 * 15 * }); 16 * 17 * Or when the window is loaded: 18 * 19 * $( window ).load(function() { 20 * 21 * }); 22 * 23 * ...and so on. 24 * 25 * Remember that ideally, we should not attach any more than a single DOM-ready or window-load handler 26 * for any particular page. Though other scripts in WordPress core, other plugins, and other themes may 27 * be doing this, we should try to minimize doing that in our own work. 28 */ 29 30 // </script> 31 32 function get_privacy_title( language ) { 33 if (smart_settings_js.modal_title) { 34 return smart_settings_js.modal_title 35 } 36 37 language = language || 'no'; 38 switch ( language ) { 39 case 'en': 40 return "Privacy Policy"; 41 case 'no': 42 default: 43 return "Personvernerklæring"; 44 } 45 } 46 47 function get_consent_content( language ) { 48 language = language || 'no'; 49 50 switch ( language ) { 51 case "en": 52 return { 53 "message": smart_settings_js.message.en.replace(/ [^\s]+[.!?]?$/, ''), 54 "dismiss": "Dismiss", 55 "link": smart_settings_js.message.en.split(/[, ]+/).pop(), 56 "href": "#", //smart_settings_js.post_path, 57 "title": "Privacy Policy" 58 }; 59 case "no": 60 default: 61 return { 62 "message": smart_settings_js.message.no.replace(/ [^\s]+[.!?]?$/, ''), 63 "dismiss": "Lukk", 64 "link": smart_settings_js.message.no.split(/[, ]+/).pop(), 65 "href": "#", //smart_settings_js.post_path, 66 "title": "Personvernerklæring" 67 } 68 } 69 70 } 71 72 73 if ( window.cookieconsent && window.cookieconsent.utils ) { // workaround for cookie-consent's auto-float on mobile 74 window.cookieconsent.utils.isMobile = function() { return false; } 75 } 76 77 window.addEventListener( "load", function () { 78 var contentObj = get_consent_content(smart_settings_js.language); 79 80 $("#privacy-modal").iziModal({ 81 padding: '10px', 82 top: '40px', 83 bottom: '40px', 84 padding: '15px', 85 iconColor: '#000000', 86 closeButton: true, 87 // headerColor: '#f2f2f2', 88 headerColor: smart_settings_js.header_color || '#252525', 89 focusInput: false, 90 zindex: 99999, 91 title: get_privacy_title(smart_settings_js.language), 92 93 transitionIn: 'tada', 94 transitionOut: 'comingOut', 95 transitionInOverlay: 'tada', 96 transitionOutOverlay: 'fadeOut' 97 }); 98 99 100 if(window.cookieconsent !== undefined && window.cookieconsent.initialise !== undefined) { 101 window.cookieconsent.initialise( { 102 palette: { 103 popup: { 104 background: smart_settings_js.colors.consent_background 105 }, 106 button: { 107 background: smart_settings_js.colors.consent_button 108 }, 109 }, 110 elements: { 111 messagelink: '<span id="cookieconsent:desc" class="cc-message">{{message}} ' + 112 '<a aria-label="learn more about cookies" tabindex="0" class="cc-link privacy-trigger" href="{{href}}">{{link}}</a></span>', 113 }, 114 // "theme": "classic", 115 // "overrideHTML": innerHtml 116 content: contentObj, 117 theme: smart_settings_js.force_fullwidth == 'on' ? 'mono' : 'block', 118 position: smart_settings_js.force_fullwidth == 'on' ? 'bottom' : 'bottom-left', 119 } ); 120 } // endif (CookieConsent-bar enabled) 121 122 $(document).on('click', '.privacy-trigger', function (event) { 123 event.preventDefault(); 124 var modal = $('#privacy-modal'); 125 modal.attr("aria-hidden","false") 126 modal.iziModal('setHeader', true); 127 modal.iziModal('open' ); 128 }); 129 130 } ); 131 132})( jQuery ); 133 134
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.