3 lines
1.3 KiB
JavaScript
3 lines
1.3 KiB
JavaScript
function inIframe(){try{return window.self!==window.top}catch(t){return!1}}function load_preview(){var t=document.createElement("script");t.type="text/javascript",t.src=trustpilot_widget_script_url,t.async=!0,document.head.appendChild(t),inIframe()&&window.addEventListener("message",function(t){var e=new URL(window.location).hostname;if(t.data&&-1!==t.origin.indexOf(e))if("undefined"!=typeof TrustpilotPreview)if("string"==typeof t.data&&"submit"===t.data)TrustpilotPreview.sendTrustboxes();else try{(i=JSON.parse(t.data)).trustbox?TrustpilotPreview.setSettings(i.trustbox):i.customised&&TrustpilotPreview.updateActive(i.customised)}catch(t){console.log(`Error while loading trustbox preview: ${t.message} with data ${t.data}`)}else try{var i=JSON.parse(t.data);if(i.trustboxes){var r=document.createElement("script");r.type="text/javascript",r.onload=function(){const e=t.source.parent.document.getElementById("configuration_iframe").contentWindow;TrustpilotPreview.init([trustpilot_preview_css_url],i,e,t.source)},r.src=trustpilot_preview_script_url,document.head.appendChild(r)}}catch(t){console.log(`TrustpilotPreview couldn't load due to an error: ${t.message} with data ${t.data}`)}})}"undefined"!=typeof trustpilot_widget_script_url?load_preview():window.addEventListener("DOMContentLoaded",load_preview);
|
|
//# sourceMappingURL=tp_preview.min.js.map
|