1/*! 2 * Author: Pierre-Henry Soria <[email protected]> 3 * Copyright: (c) 2020, Pierre-Henry Soria. All Rights Reserved. 4 */ 5const disagreedRedirectLink = "https://google.com"; // <= URL to show when the visitor is likely to be under 18yrs 6 7const openTabsKey = 'openTabsList'; 8Disclaimer.generateDialog(); 9 10const oDisclaimer = new Disclaimer(); 11 12if ($("#prevent_age_gate_popup_open_on_newtab").val() == 1) { 13 // Unique ID for this tab 14 const tabId = Date.now().toString() + Math.random().toString(36).substr(2, 5); 15 16 // Register this tab in localStorage 17 let openTabs = JSON.parse(localStorage.getItem(openTabsKey) || "[]"); 18 if (!openTabs.includes(tabId)) { 19 openTabs.push(tabId); 20 localStorage.setItem(openTabsKey, JSON.stringify(openTabs)); 21 } 22 23 // SESSION COOKIE HELPERS 24 function setSessionCookie(name) { 25 // No expiration = session cookie (cleared when browser closes) 26 document.cookie = name + "=1; path=/"; 27 } 28 29 function getSessionCookie(name) { 30 return document.cookie.split('; ').some(row => row.startsWith(name + '=')); 31 } 32 33 function clearSessionCookie(name) { 34 document.cookie = name + '=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT'; 35 } 36 37 // Override Disclaimer methods to use session cookie 38 Disclaimer.prototype.isAccepted = function () { 39 return getSessionCookie(localKeyName); 40 }; 41 42 Disclaimer.prototype.setAccepted = function () { 43 setSessionCookie(localKeyName); 44 }; 45 46 // Detect tab close 47 window.addEventListener("beforeunload", () => { 48 let openTabs = JSON.parse(localStorage.getItem(openTabsKey) || "[]"); 49 openTabs = openTabs.filter(id => id !== tabId); 50 localStorage.setItem(openTabsKey, JSON.stringify(openTabs)); 51 }); 52 53 // Listen to storage changes from other tabs 54 window.addEventListener("storage", () => { 55 let openTabs = JSON.parse(localStorage.getItem(openTabsKey) || "[]"); 56 if (openTabs.length === 0) { 57 // No tabs left, clear session cookie 58 clearSessionCookie(localKeyName); 59 localStorage.removeItem(openTabsKey); 60 } 61 }); 62} 63 64if (!oDisclaimer.isAccepted()) { 65 if ($("#prevent_age_gate_popup_open_on_newtab").val() == 1) { 66 if (!getSessionCookie(localKeyName) && $("#show_age_gate_popup").val() == 1) { 67 oDisclaimer.loadDialog(); 68 oDisclaimer.centerDialog(); 69 } 70 } else { 71 if($("#show_age_gate_popup").val()==1){ 72 oDisclaimer.loadDialog(); 73 oDisclaimer.centerDialog(); 74 } 75 } 76} 77 78if($("#age_pop_up_auto_pop_up").length==1){ 79 if (oDisclaimer.isAccepted()) { 80 // alert($("#popup_model").length); 81 if($("#popup_model").length>=1){ 82 alert('testtas'); 83 var POPUP = false; 84 if(POPUP==false && SF_POPUP!=0){ 85 setTimeout(function(){ 86 $(window).scroll(function() { return false; }); 87 $("#popup_model").show(); 88 },1000); 89 } 90 } 91 } 92} 93 94document.getElementById('agree-over18').onclick = function () { 95 oDisclaimer.disableDialog(); 96 oDisclaimer.setAccepted(); 97 if($("#age_pop_up_auto_pop_up").length==1){ 98 if($("#popup_model").length>=1 && !inIframe()){ 99 var POPUP = false; 100 if(POPUP==false && SF_POPUP!=0){ 101 setTimeout(function(){ 102 $(window).scroll(function() { return false; }); 103 $("#popup_model").show(); 104 },1000); 105 } 106 } 107 } 108 109}; 110 111document.getElementById('disagree-under18').onclick = function () { 112 location.href = disagreedRedirectLink 113}
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.