Changeset 3291964
- Timestamp:
- 05/12/2025 02:42:45 PM (9 months ago)
- Location:
- adthrive-ads/trunk
- Files:
-
- 5 edited
-
js/adblock-detection.js (modified) (1 diff)
-
js/email-detection-helpers.js (modified) (3 diffs)
-
js/min/adblock-detection.min.js (modified) (1 diff)
-
js/min/email-detection.min.js (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
adthrive-ads/trunk/js/adblock-detection.js
r2778320 r3291964 1 (function(doc) { 2 var adBlockerCookieKey = '__adblocker'; 3 if(doc.cookie.indexOf(adBlockerCookieKey) === -1) { 4 doc.cookie = adBlockerCookieKey + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/"; 5 var request = new XMLHttpRequest(); 6 request.open('GET', 'https://ads.adthrive.com/abd/abd.js', true); 7 request.onreadystatechange = function() { 8 if(XMLHttpRequest.DONE === request.readyState) { 9 if(request.status === 200) { 10 var script = doc.createElement("script"); 11 script.innerHTML = request.responseText; 12 doc.getElementsByTagName("head")[0].appendChild(script); 13 } else { 14 var date = new Date(); 15 date.setTime(date.getTime() + 60 * 5 * 1000); 16 doc.cookie = adBlockerCookieKey + "=true; expires=" + date.toUTCString() + "; path=/"; 17 } 18 } 19 }; 20 request.send(); 21 } 1 (function (doc) { 2 const timeZoneToRegulationMap = { 3 'Europe/Brussels': 'gdpr', // Belgium 4 'Europe/Sofia': 'gdpr', // Bulgaria 5 'Europe/Prague': 'gdpr', // Czech Republic 6 'Europe/Copenhagen': 'gdpr', // Denmark 7 'Europe/Berlin': 'gdpr', // Germany 8 'Europe/Tallinn': 'gdpr', // Estonia 9 'Europe/Dublin': 'gdpr', // Ireland 10 'Europe/Athens': 'gdpr', // Greece 11 'Europe/Madrid': 'gdpr', // Spain 12 'Africa/Ceuta': 'gdpr', // Spain (excl. Canary Islands) 13 'Europe/Paris': 'gdpr', // France 14 'Europe/Zagreb': 'gdpr', // Croatia 15 'Europe/Rome': 'gdpr', // Italy 16 'Asia/Nicosia': 'gdpr', // Cyprus 17 'Europe/Nicosia': 'gdpr', // Cyprus (Europe TZ) 18 'Europe/Riga': 'gdpr', // Latvia 19 'Europe/Vilnius': 'gdpr', // Lithuania 20 'Europe/Luxembourg': 'gdpr', // Luxembourg 21 'Europe/Budapest': 'gdpr', // Hungary 22 'Europe/Malta': 'gdpr', // Malta 23 'Europe/Amsterdam': 'gdpr', // Netherlands 24 'Europe/Vienna': 'gdpr', // Austria 25 'Europe/Warsaw': 'gdpr', // Poland 26 'Europe/Lisbon': 'gdpr', // Portugal (mainland) 27 'Atlantic/Madeira': 'gdpr', // Portugal (Madeira) 28 'Europe/Bucharest': 'gdpr', // Romania 29 'Europe/Ljubljana': 'gdpr', // Slovenia 30 'Europe/Bratislava': 'gdpr', // Slovakia 31 'Europe/Helsinki': 'gdpr', // Finland 32 'Europe/Stockholm': 'gdpr', // Sweden 33 'Europe/London': 'gdpr', // United Kingdom / Great Britain 34 'Europe/Vaduz': 'gdpr', // Liechtenstein 35 'Atlantic/Reykjavik': 'gdpr', // Iceland 36 'Europe/Oslo': 'gdpr', // Norway 37 'Europe/Istanbul': 'gdpr', // Turkey 38 'Europe/Zurich': 'gdpr', // Switzerland 39 }; 40 41 const inferRegulation = () => { 42 const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; 43 return timeZoneToRegulationMap[timeZone] || null; 44 }; 45 46 const regulation = inferRegulation(); 47 if (regulation === null || regulation !== 'gdpr') { 48 const adBlockerCookieKey = '__adblocker'; 49 if (doc.cookie.indexOf(adBlockerCookieKey) === -1) { 50 const request = new XMLHttpRequest(); 51 request.open('GET', 'https://ads.adthrive.com/abd/abd.js', true); 52 request.onreadystatechange = function () { 53 if (XMLHttpRequest.DONE === request.readyState) { 54 if (request.status === 200) { 55 const script = doc.createElement('script'); 56 script.innerHTML = request.responseText; 57 doc.getElementsByTagName('head')[0].appendChild(script); 58 } else { 59 const date = new Date(); 60 date.setTime(date.getTime() + 60 * 5 * 1000); 61 doc.cookie = adBlockerCookieKey + '=true; expires=' + date.toUTCString() + '; path=/'; 62 } 63 } 64 }; 65 request.send(); 66 } 67 } 22 68 })(document); -
adthrive-ads/trunk/js/email-detection-helpers.js
r3107591 r3291964 101 101 }); 102 102 103 window.adthrive = window.adthrive || {}; 104 window.adthrive.cmd = window.adthrive.cmd || []; 103 105 if (plainTextQueryParam) { 104 106 if (validateEmail(plainTextQueryParam.value)) { … … 109 111 created: Date.now(), 110 112 }; 111 localStorage.setItem(localStorageKey, JSON.stringify(data)); 112 localStorage.setItem( 113 localStorageSrcKey, 114 plainTextQueryParam.emsrc 115 ); 113 window.adthrive.cmd.push(function () { 114 window.adthrive.api.browserStorage.setInternalLocalStorage( 115 localStorageKey, 116 JSON.stringify(data) 117 ); 118 window.adthrive.api.browserStorage.setInternalLocalStorage( 119 localStorageSrcKey, 120 plainTextQueryParam.emsrc 121 ); 122 }); 116 123 } 117 124 }); … … 125 132 created: Date.now(), 126 133 }; 127 128 localStorage.setItem(localStorageKey, JSON.stringify(data)); 129 localStorage.setItem(localStorageSrcKey, hashedQueryParam.emsrc); 134 window.adthrive.cmd.push(function () { 135 window.adthrive.api.browserStorage.setInternalLocalStorage( 136 localStorageKey, 137 JSON.stringify(data) 138 ); 139 window.adthrive.api.browserStorage.setInternalLocalStorage( 140 localStorageSrcKey, 141 hashedQueryParam.emsrc 142 ); 143 }); 130 144 } 131 145 -
adthrive-ads/trunk/js/min/adblock-detection.min.js
r2778320 r3291964 1 !function(){"use strict";!function(e){ if(-1===e.cookie.indexOf("__adblocker")){e.cookie="__adblocker=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";var t=new XMLHttpRequest;t.open("GET","https://ads.adthrive.com/abd/abd.js",!0),t.onreadystatechange=function(){if(XMLHttpRequest.DONE===t.readyState)if(200===t.status){var a=e.createElement("script");a.innerHTML=t.responseText,e.getElementsByTagName("head")[0].appendChild(a)}else{var n=new Date;n.setTime(n.getTime()+3e5),e.cookie="__adblocker=true; expires="+n.toUTCString()+"; path=/"}},t.send()}}(document)}();1 !function(){"use strict";!function(e){const r={"Europe/Brussels":"gdpr","Europe/Sofia":"gdpr","Europe/Prague":"gdpr","Europe/Copenhagen":"gdpr","Europe/Berlin":"gdpr","Europe/Tallinn":"gdpr","Europe/Dublin":"gdpr","Europe/Athens":"gdpr","Europe/Madrid":"gdpr","Africa/Ceuta":"gdpr","Europe/Paris":"gdpr","Europe/Zagreb":"gdpr","Europe/Rome":"gdpr","Asia/Nicosia":"gdpr","Europe/Nicosia":"gdpr","Europe/Riga":"gdpr","Europe/Vilnius":"gdpr","Europe/Luxembourg":"gdpr","Europe/Budapest":"gdpr","Europe/Malta":"gdpr","Europe/Amsterdam":"gdpr","Europe/Vienna":"gdpr","Europe/Warsaw":"gdpr","Europe/Lisbon":"gdpr","Atlantic/Madeira":"gdpr","Europe/Bucharest":"gdpr","Europe/Ljubljana":"gdpr","Europe/Bratislava":"gdpr","Europe/Helsinki":"gdpr","Europe/Stockholm":"gdpr","Europe/London":"gdpr","Europe/Vaduz":"gdpr","Atlantic/Reykjavik":"gdpr","Europe/Oslo":"gdpr","Europe/Istanbul":"gdpr","Europe/Zurich":"gdpr"},p=(()=>{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;return r[e]||null})();if(null===p||"gdpr"!==p){const r="__adblocker";if(-1===e.cookie.indexOf(r)){const p=new XMLHttpRequest;p.open("GET","https://ads.adthrive.com/abd/abd.js",!0),p.onreadystatechange=function(){if(XMLHttpRequest.DONE===p.readyState)if(200===p.status){const r=e.createElement("script");r.innerHTML=p.responseText,e.getElementsByTagName("head")[0].appendChild(r)}else{const p=new Date;p.setTime(p.getTime()+3e5),e.cookie=r+"=true; expires="+p.toUTCString()+"; path=/"}},p.send()}}}(document)}(); -
adthrive-ads/trunk/js/min/email-detection.min.js
r3107591 r3291964 1 !function(){"use strict";function e(e){const t=e.match(/((?=([a-z0-9._!#$%+^&*()[\]<>-]+))\2@[a-z0-9._-]+\.[a-z0-9._-]+)/gi);return t?t[0]:""}function t(t){return e(a(t.toLowerCase()))}function a(e){return e.replace(/\s/g,"")}async function n(e){const t={sha256Hash:"",sha1Hash:""};if(!("msCrypto"in window)&&"https:"===location.protocol&&"crypto"in window&&"TextEncoder"in window){const a=(new TextEncoder).encode(e),[n, c]=await Promise.all([s("SHA-256",a),s("SHA-1",a)]);t.sha256Hash=n,t.sha1Hash=c}return t}async function s(e,t){const a=await crypto.subtle.digest(e,t);return Array.from(new Uint8Array(a)).map(e=>("00"+e.toString(16)).slice(-2)).join("")}function c(e){let t=!0;return Object.keys(e).forEach(a=>{0===e[a].length&&(t=!1)}),t}function i(e,t,a){e.splice(t,1);const n="?"+e.join("&")+a.hash;history.replaceState(null,"",n)}var o={checkEmail:e,validateEmail:t,trimInput:a,hashEmail:n,hasHashes:c,removeEmailAndReplaceHistory:i,detectEmails:async function(){const e=new URL(window.location.href),a=Array.from(e.searchParams.entries()).map(e=>`${e[0]}=${e[1]}`);let s,o;const r=["adt_eih","sh_kit"];if(a.forEach((e,t)=>{const a=decodeURIComponent(e),[n,c]=a.split("=");if("adt_ei"===n&&(s={value:c,index:t,emsrc:"url"}),r.includes(n)){o={value:c,index:t,emsrc:"sh_kit"===n?"urlhck":"urlh"}}}),s)t(s.value)&&n(s.value).then(e=>{if(c(e)){const t={value:e,created:Date.now()};localStorage.setItem("adt_ei",JSON.stringify(t)),localStorage.setItem("adt_emsrc",s.emsrc)}});else if(o){const e={value:{sha256Hash:o.value,sha1Hash:""},created:Date.now()};localStorage.setItem("adt_ei",JSON.stringify(e)),localStorage.setItem("adt_emsrc",o.emsrc)}s&&i(a,s.index,e),o&&i(a,o.index,e)},cb:"adthrive"};const{detectEmails:r,cb:l}=o;r()}();1 !function(){"use strict";function e(e){const t=e.match(/((?=([a-z0-9._!#$%+^&*()[\]<>-]+))\2@[a-z0-9._-]+\.[a-z0-9._-]+)/gi);return t?t[0]:""}function t(t){return e(a(t.toLowerCase()))}function a(e){return e.replace(/\s/g,"")}async function n(e){const t={sha256Hash:"",sha1Hash:""};if(!("msCrypto"in window)&&"https:"===location.protocol&&"crypto"in window&&"TextEncoder"in window){const a=(new TextEncoder).encode(e),[n,r]=await Promise.all([i("SHA-256",a),i("SHA-1",a)]);t.sha256Hash=n,t.sha1Hash=r}return t}async function i(e,t){const a=await crypto.subtle.digest(e,t);return Array.from(new Uint8Array(a)).map(e=>("00"+e.toString(16)).slice(-2)).join("")}function r(e){let t=!0;return Object.keys(e).forEach(a=>{0===e[a].length&&(t=!1)}),t}function o(e,t,a){e.splice(t,1);const n="?"+e.join("&")+a.hash;history.replaceState(null,"",n)}var s={checkEmail:e,validateEmail:t,trimInput:a,hashEmail:n,hasHashes:r,removeEmailAndReplaceHistory:o,detectEmails:async function(){const e=new URL(window.location.href),a=Array.from(e.searchParams.entries()).map(e=>`${e[0]}=${e[1]}`);let i,s;const c=["adt_eih","sh_kit"];if(a.forEach((e,t)=>{const a=decodeURIComponent(e),[n,r]=a.split("=");if("adt_ei"===n&&(i={value:r,index:t,emsrc:"url"}),c.includes(n)){s={value:r,index:t,emsrc:"sh_kit"===n?"urlhck":"urlh"}}}),window.adthrive=window.adthrive||{},window.adthrive.cmd=window.adthrive.cmd||[],i)t(i.value)&&n(i.value).then(e=>{if(r(e)){const t={value:e,created:Date.now()};window.adthrive.cmd.push((function(){window.adthrive.api.browserStorage.setInternalLocalStorage("adt_ei",JSON.stringify(t)),window.adthrive.api.browserStorage.setInternalLocalStorage("adt_emsrc",i.emsrc)}))}});else if(s){const e={value:{sha256Hash:s.value,sha1Hash:""},created:Date.now()};window.adthrive.cmd.push((function(){window.adthrive.api.browserStorage.setInternalLocalStorage("adt_ei",JSON.stringify(e)),window.adthrive.api.browserStorage.setInternalLocalStorage("adt_emsrc",s.emsrc)}))}i&&o(a,i.index,e),s&&o(a,s.index,e)},cb:"adthrive"};const{detectEmails:c,cb:d}=s;c()}(); -
adthrive-ads/trunk/readme.txt
r3279398 r3291964 34 34 35 35 == Changelog == 36 = 3.7.6 = 37 * Ensure browser storage use with user consent 38 36 39 = 3.7.5 = 37 40 * Tested up to 6.8
Note: See TracChangeset
for help on using the changeset viewer.