var pmaWidgetInstance60a4ba7f0067a2ef5981cd11 = { debug: false, baseUrl: "https://public.pricemania.sk", exitLink: "https://www.pricemania.sk/exitv2/?data=f8aeae66ec56faddf841609ac8abbf7e:40404b0b0b9e39f291120f4a50b834f8923065d5f278ff3bb8382d1e87b715ed27b699182081ffc1a50bc4438533f3062f90da449f1d071b1fc4699c2ba257433f9c294231813afe8a15773f171f27a4afaf649ec55e505e209e8c3758d22e88b5b899d782210f3616332ee628484f94692a70c3e53cd2ee3e9da1fb891bda4d3efd0dad1fcadb1ef43a44be1d5ce252f87d05dec11347b143bcc3d188045783d1567fa6f8bfe479bfee1e2f6246a488e125728bca64c5ef77b2ef51f6718cd6d821877a59792b9ef8457ec2f20fb1eb", shop_name: "drmax.sk", shop_logo: "https://y1.sk/t/s/130x50/52053.jpg", product_price: "415,69 €", product_shipping: "0,00 €", product_availability: "Skladom", initWidget: function(widgetId){ this.insertLinkToButton(widgetId); }, insertLinkToButton: function(widgetId){ const instance = this; const btns = this.findButtonWidgets(widgetId); for(var btn of btns){ instance.insertButtonVariables(btn); if(btn.tagName == "A"){ btn.href = this.exitLink; btn.target = "_blank"; btn.rel = "nofollow"; } else { btn.onclick = function(event){ event.stopPropagation(); window.open(instance.exitLink); } } } }, findButtonWidgets: function(widgetId){ var currentModalButtons = []; var modalButtons = document.getElementsByClassName(`pma-widget`); for(var modalButton of modalButtons){ if(modalButton.getAttribute('data-id') == widgetId){ currentModalButtons.push(modalButton); } } return currentModalButtons; }, insertButtonVariables: function(element){ element.innerHTML = element.innerHTML.replaceAll("{{shop_name}}",this.shop_name?this.shop_name:""); element.innerHTML = element.innerHTML.replaceAll("{{shop_logo}}",this.shop_logo?this.shop_logo:""); element.innerHTML = element.innerHTML.replaceAll("{{product_price}}",this.product_price?this.product_price:""); element.innerHTML = element.innerHTML.replaceAll("{{product_shipping}}",this.product_shipping?this.product_shipping:""); element.innerHTML = element.innerHTML.replaceAll("{{product_availability}}",this.product_availability?this.product_availability:""); } } docReady(function(){ pmaWidgetInstance60a4ba7f0067a2ef5981cd11.initWidget("60a4ba7f0067a2ef5981cd11"); }) function docReady(fn) { if (document.readyState === "complete" || document.readyState === "interactive") { setTimeout(fn, 1); } else { document.addEventListener("DOMContentLoaded", fn); } }