/** * SmartXSP Atom Loader - Elegant JavaScript API * Ultra-lightweight ad delivery with fluent interface * * @version 1.0.99 * @license MIT */ !function(t){"use strict";var e=-1!==(document.currentScript&&document.currentScript.src||"").indexOf("ng.deepsmx.test")?"https://ng.deepsmx.test":"https://ng.deepsmx.com";function r(t){return this.params={id:t,cb:Date.now()},this}function a(r,a,n){var s=[];for(var i in r)r.hasOwnProperty(i)&&s.push(encodeURIComponent(i)+"="+encodeURIComponent(r[i]));var o=document.createElement("script");if(o.src=e+"/atom.js?"+s.join("&"),o.async=!0,o.className="smx-atom-script",n){var c=document.currentScript;c&&c.parentNode?c.parentNode.insertBefore(o,c.nextSibling):(document.head||document.getElementsByTagName("head")[0]).appendChild(o)}else{t!==a&&t.frameElement&&(a._smxSourceFrames||(a._smxSourceFrames={}),a._smxSourceFrames[r.cb]=t.frameElement);var p=a.document;(p.head||p.getElementsByTagName("head")[0]).appendChild(o)}return o}r.prototype.click=function(t){return this.params.click=t,this},r.prototype.view=function(t){return this.params.view=t,this},r.prototype.referer=function(t){return this.params.x_ref=t,this},r.prototype.dsp=function(t){return t.adserver&&(this.params.adserver=t.adserver),t.publisher&&(this.params.x_pub=t.publisher),t.placement&&(this.params.x_placement=t.placement),t.campaign&&(this.params.x_cpg=t.campaign),t.order&&(this.params.x_order=t.order),t.line&&(this.params.x_line=t.line),t.creative&&(this.params.x_cre=t.creative),t.seller&&(this.params.x_seller=t.seller),t.exchange&&(this.params.x_seller=t.exchange),t.deal&&(this.params.x_deal=t.deal),t.bid&&(this.params.x_bid=t.bid),t.price&&(this.params.x_bid=t.price),t.site&&(this.params.x_site=t.site),t.source&&(this.params.x_ref=t.source),t.format&&(this.params.f=t.format),t.width&&(this.params.x_w=t.width),t.height&&(this.params.x_h=t.height),this},r.prototype.size=function(t,e){return this.params.x_w=t,this.params.x_h=e,this},r.prototype.creative=function(t){return this.params.creative_id=t,this},r.prototype.macros=function(t){return this.params.macros=JSON.stringify(t),this},r.prototype.param=function(t,e){return this.params[t]=e,this},r.prototype.params=function(t){for(var e in t)t.hasOwnProperty(e)&&(this.params[e]=t[e]);return this},r.prototype.debug=function(){return this.params.smx_dbg="true",this},r.prototype.disableStats=function(){return this.params.ds="true",this},r.prototype.fallbackDsp=function(t){return this.params.fbc=void 0===t?9660:t,this},r.prototype.load=function(){var r=function(t){for(var e=t;e!==e.top;)try{var r=e.parent;r.document,e=r}catch(t){break}return e}(t),n=function(t,e){var r={};try{var a=e.location.search;if(a&&a.length>1)for(var n=a.slice(1).split("&"),s=0;s1?decodeURIComponent(i[1]||""):"";o&&(r[o]=c)}}catch(t){}for(var p in t)t.hasOwnProperty(p)&&void 0!==t[p]&&(r[p]=t[p]);return r}(this.params,r);(function(t){try{if(t.$sf&&t.$sf.ext)return!0}catch(t){}if(t===t.top)return!1;try{return t.top.document,!1}catch(t){return!0}})(t)&&(n.sf="1");var s="dsp"===this.params.f;return n.gdpr_consent?a(n,r,s):(function(e,r){try{if("function"==typeof e.__tcfapi)return void e.__tcfapi("getTCData",2,function(t,e){r(t,e,!0)})}catch(t){}try{if("function"==typeof t.__tcfapi)return void t.__tcfapi("getTCData",2,function(t,e){r(t,e,!0)})}catch(t){}var a=Date.now(),n=!1;function s(e){if(e&&e.data&&e.data.__tcfapiReturn){var i=e.data.__tcfapiReturn;i.callId===a&&(n=!0,t.removeEventListener("message",s),r(i.returnValue,i.success,!0))}}t.addEventListener("message",s);for(var i=t;i!==i.top;){try{i.parent.postMessage({__tcfapiCall:{command:"getTCData",version:2,callId:a}},"*")}catch(t){}i=i.parent}try{i.postMessage({__tcfapiCall:{command:"getTCData",version:2,callId:a}},"*")}catch(t){}setTimeout(function(){n||(t.removeEventListener("message",s),r(null,!1,!1))},500)}(r,function(i,o,c){if(c&&(n.gdpr="1"),o&&i&&i.tcString){n.gdpr_consent=i.tcString;var p=i.purpose&&i.purpose.consents,u=i.vendor&&i.vendor.consents,m=!(!p||!p[1]),d=!(!p||!p[3]),f=!(!p||!p[4]),h=!(!u||!u[1338]);n.ob_tcf=m&&d&&f&&h?"1":"0"}else c&&(n.ob_tcf="0",function(r){var a=null;try{"function"==typeof r.__tcfapi&&(a=r.__tcfapi.bind(r))}catch(t){}if(!a)try{"function"==typeof t.__tcfapi&&(a=t.__tcfapi.bind(t))}catch(t){}if(a){var n=!1;a("addEventListener",2,function(t,r){if(!n&&r&&t){var a=t.eventStatus;if(("useractioncomplete"===a||"tcloaded"===a)&&t.tcString){n=!0;var s=t.purpose&&t.purpose.consents,i=t.vendor&&t.vendor.consents,o=s&&s[1]&&s&&s[3]&&s&&s[4]&&i&&i[1338]?"1":"0";(new Image).src=e+"/set-ob-uid.php?gdpr=1&gdpr_consent="+encodeURIComponent(t.tcString)+"&ob_tcf="+o+"&cb="+Date.now()}}})}}(r));a(n,r,s)}),null)},r.prototype.render=r.prototype.load,r.prototype.push=r.prototype.load,t.SmartAtom=r,t.smartAtom=function(t){return new r(t)}}(window);