@valu/3rdparty
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -1,1 +0,1 @@ | ||
!function(){var t=function(){};function e(t,e){for(var o=0;o<t.length;o++)e(t[o])}function o(t){e(document.getElementsByTagName("iframe"),t)}function n(e){var o=e.getAttribute("data-blocked");o?(t("Unblocking iframe "+o,e),e.setAttribute("src",o)):t("No data-blocked present, nothing to unblock.",e),e.removeAttribute("data-blocked")}function i(t){return t.hasAttribute("data-blocked")}"undefined"!=typeof window&&window.localStorage.valuIFramesDebug&&(t=function(){var t;(t=console).log.apply(t,["[ValuIFrames]"].concat([].slice.call(arguments)))});var a=function(){function a(t){this.monitoring=!1,this.unblock=n,this.isBlocked=i,this.forEachIframe=o,this.disableKey="valuIFramesDisableBlockAll",this.options=t||{}}var l=a.prototype;return l.createPlaceholder=function(t){return this.options.placeholderSrc?this.options.placeholderSrc:"data:text/plain;base64,PGgxPkJsb2NrZWQ8L2gxPgo="},l.unblockAll=function(){this.stopMonitoring(),o(n)},l.isBlockAllDisabled=function(){return Boolean(window.localStorage[this.disableKey])},l.disableBlockAll=function(){window.localStorage[this.disableKey]="1"},l.enableBlockAll=function(){delete window.localStorage[this.disableKey]},l.blockAll=function(){var e=this;this.isBlockAllDisabled()?t("Ingoring blockAll() because localStorage.valuIFramesDisableBlockAll is set"):(this.startMonitoring(),o(function(t){return e.block(t)}))},l.startMonitoring=function(){var o=this;this.isBlockAllDisabled()?t("Ingoring startMonitoring() because localStorage.valuIFramesDisableBlockAll is set"):this.observer||(this.monitoring=!0,this.observer=new MutationObserver(function(n){o.monitoring&&e(n,function(n){e(n.addedNodes,function(e){e instanceof HTMLIFrameElement&&(t("Found new iframe from mutation observer",e.src||e),o.block(e))})})}),this.observer.observe(document.documentElement,{childList:!0,subtree:!0}))},l.stopMonitoring=function(){this.monitoring=!1},l.block=function(e){var o=e.getAttribute("data-blocked");if(o)t("Already blocked",o,e);else{var n=e.src;if(n){t("Blocking "+n,e);try{var a,l;"function"==typeof(null==(a=e.contentWindow)?void 0:a.stop)?e.contentWindow.stop():null==(l=e.contentWindow)||l.document.execCommand("Stop")}catch(t){console.error("[ValuIFrames] Failed to stop iframe for "+n,t,e)}e.addEventListener("load",function(){i(e)&&e.contentWindow&&e.contentWindow.postMessage({valuOriginalSrc:n},"*")}),e.setAttribute("data-blocked",n);var r,s,c=this.createPlaceholder(n);e.src=c,e.setAttribute("src",c),r=function(){e.src+=""},s=String(Math.random()),window.addEventListener("message",function t(e){e.data.valuSetImmediate===s&&(window.removeEventListener("message",t),r())}),window.postMessage({valuSetImmediate:s},"*")}else t("No src attribute. Nothing to block",e)}},a}();if("undefined"!=typeof window){var l=document.getElementById("valu-iframes-options"),r={};l&&(r=JSON.parse(l.innerHTML));var s=new a(r);s.blockAll(),window.ValuIFrames=s}}(); | ||
!function(){var t=function(){};function e(t,e){for(var o=0;o<t.length;o++)e(t[o])}function o(t){e(document.getElementsByTagName("iframe"),t)}function n(e){var o=e.getAttribute("data-blocked");o?(t("Unblocking iframe "+o,e),e.setAttribute("src",o)):t("No data-blocked present, nothing to unblock.",e),e.removeAttribute("data-blocked")}function i(t){return t.hasAttribute("data-blocked")}"undefined"!=typeof window&&window.localStorage.valuIFramesDebug&&(t=function(){var t;(t=console).log.apply(t,["[ValuIFrames]"].concat([].slice.call(arguments)))});var a=function(){function a(t){this.monitoring=!1,this.unblock=n,this.isBlocked=i,this.forEachIframe=o,this.disableKey="valuIFramesDisableBlockAll",this.options=t||{}}var l=a.prototype;return l.createPlaceholder=function(t){return this.options.placeholderSrc?this.options.placeholderSrc:"data:text/plain;base64,PGgxPkJsb2NrZWQ8L2gxPgo="},l.unblockAll=function(){this.stopMonitoring(),o(n)},l.isBlockAllDisabled=function(){return Boolean(window.localStorage[this.disableKey])},l.disableBlockAll=function(){window.localStorage[this.disableKey]="1"},l.enableBlockAll=function(){delete window.localStorage[this.disableKey]},l.blockAll=function(){var e=this;this.isBlockAllDisabled()?t("Ingoring blockAll() because localStorage.valuIFramesDisableBlockAll is set"):(this.startMonitoring(),o(function(t){return e.block(t)}))},l.startMonitoring=function(){var o=this;this.isBlockAllDisabled()?t("Ingoring startMonitoring() because localStorage.valuIFramesDisableBlockAll is set"):this.observer||(this.monitoring=!0,this.observer=new MutationObserver(function(n){o.monitoring&&e(n,function(n){e(n.addedNodes,function(e){e instanceof HTMLIFrameElement&&(t("Found new iframe from mutation observer",e.src||e),o.block(e))})})}),this.observer.observe(document.documentElement,{childList:!0,subtree:!0}))},l.stopMonitoring=function(){this.monitoring=!1},l.block=function(e){var o=e.getAttribute("data-blocked");if(o)t("Already blocked",o,e);else{var n=e.src;if(n){t("Blocking "+n,e);try{var a,l;"function"==typeof(null==(a=e.contentWindow)?void 0:a.stop)?e.contentWindow.stop():null==(l=e.contentWindow)||l.document.execCommand("Stop")}catch(t){console.error("[ValuIFrames] Failed to stop iframe for "+n,t,e)}e.addEventListener("load",function(){i(e)&&e.contentWindow&&e.contentWindow.postMessage({valuOriginalSrc:n},"*")}),e.setAttribute("data-blocked",n);var r,s,c=this.createPlaceholder(n);e.src=c,e.setAttribute("src",c),r=function(){e.src+=""},s=String(Math.random()),window.addEventListener("message",function t(e){var o;(null==(o=e.data)?void 0:o.valuSetImmediate)===s&&(window.removeEventListener("message",t),r())}),window.postMessage({valuSetImmediate:s},"*")}else t("No src attribute. Nothing to block",e)}},a}();if("undefined"!=typeof window){var l=document.getElementById("valu-iframes-options"),r={};l&&(r=JSON.parse(l.innerHTML));var s=new a(r);s.blockAll(),window.ValuIFrames=s}}(); |
@@ -42,3 +42,4 @@ "use strict"; | ||
var cb = function (e) { | ||
if (e.data.valuSetImmediate === key) { | ||
var _a; | ||
if (((_a = e.data) === null || _a === void 0 ? void 0 : _a.valuSetImmediate) === key) { | ||
window.removeEventListener("message", cb); | ||
@@ -169,2 +170,4 @@ fn(); | ||
} | ||
// Post the original src to the placeholder so it can unblock itself if | ||
// needed | ||
node.addEventListener("load", function () { | ||
@@ -171,0 +174,0 @@ if (isBlocked(node) && node.contentWindow) { |
@@ -22,3 +22,2 @@ "use strict"; | ||
} | ||
console.log("HTML", html); | ||
if (options.script) { | ||
@@ -25,0 +24,0 @@ var code = ""; |
{ | ||
"name": "@valu/3rdparty", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Tools for managing 3rd party scripts and tracking consents (aka. cookie prompts) optionally via Google Tag Manager and/or Cookiebot.", | ||
@@ -5,0 +5,0 @@ "main": "dist/lazy-script.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
61934
1136