Skip to Content

JavaScript File

URL: https://cdn.envybox.io/widget/cbk.js?wcb_code=a3ac80c66a457acfa5ec8d2da8e6fd9b
HTTP Status: 200 OK
MIME Type: application/javascript
Last Modified: Tue, 04 Jul 2023 07:18:22 GMT
Download Time: Less than a second
Cookies: None
Size: 9 KB
HTTP Headers:  9 headers
Links In:  1 pages
OK Issues: No issues found

1var EnvyWidget=function(){this.serverUrl="https://whitesaas.com",this.staticServerUrl="https://cdn.envybox.io",this.whiteSaasCode=window.whitesaas_code,this.localStoragePrefix="WhiteSaas_"}

2;EnvyWidget.prototype.init=function(){var _this=this;if(this.frameCheck()){if("object"==typeof document.EW)return void console.log("zOnly one instance of EnvyWidget can be run");document.EW=this}

3else{if("object"==typeof window.top.EW)return void console.log("Only one instance of EnvyWidget can be run");window.top.EW=this}

4return window.whitesaas_code||this.parseCode(),!window.whitesaas_code&&window.callbackkiller_code&&(window.whitesaas_code=window.callbackkiller_code),this.whiteSaasCode=window.whitesaas_code,this.removeOldValuesFromLocalStorage(),this.initSettings(),this.whiteSaasCode?this.checkBot()?void console.log("bot"):(document.referrer&&""!=document.referrer&&!this.getLocalStorageItem("WhiteSaas_referrer")&&this.setLocalStorageItem("WhiteSaas_referrer",document.referrer,60),void _this.loadSettings(_this)):void console.log("whiteSaasCode required")}

5,EnvyWidget.prototype.frameCheck=function(){try{return window!=window.top||document!=top.document||window.location!=top.location}

6catch(e){return!0}

7}

8,EnvyWidget.prototype.initSettings=function(){"object"==typeof window.WBK_Settings&&(window.WBK_Settings.serverUrl&&(this.serverUrl=window.WBK_Settings.serverUrl),window.WBK_Settings.staticServerUrl&&(this.staticServerUrl=window.WBK_Settings.staticServerUrl),window.WBK_Settings.whiteSaasCode&&(this.whiteSaasCode=window.WBK_Settings.whiteSaasCode))}

9,EnvyWidget.prototype.loadSettings=function(context,visitorHash){var _this=context,url=_this.serverUrl+"/api?";try{JSON.stringify||"undefined"==typeof JSON.encode||(JSON.stringify=JSON.encode),JSON.parse||"undefined"==typeof JSON.decode||(JSON.parse=JSON.decode)}

10catch(e){}

11_this.jsonp(url+_this.getLoadParams(visitorHash),function(result){_this.scriptInit(result)}

12)}

13,EnvyWidget.prototype.scriptInit=function(data){var url=data.Settings.widgetUrl;this.getScript(url,function(){var settings={whiteSaasCode:this.whiteSaasCode}

14;"object"==typeof window.WBK_Settings&&jWS.extend(settings,window.WBK_Settings),jWS().WBK(settings,data)}

15)}

16,EnvyWidget.prototype.getLoadParams=function(visitorHash){var siteUrl="";document.URL&&(siteUrl=encodeURIComponent(document.URL));var _platform;try{_platform=navigator.platform}

17catch(e){}

18var referrer=this.getLocalStorageItem("WhiteSaas_referrer"),params={action:"load",code:this.whiteSaasCode,url:siteUrl,referrer:referrer?encodeURIComponent(referrer):"",cookie:this.getAllCookies(),visit_count:this.getVisitCount(),visitorId:!!this.getCookie("WhiteCallback_visitorId")&&this.getCookie("WhiteCallback_visitorId"),platform:_platform,quizId:window.quizId?window.quizId:null}

19;return this.param(params)}

20,EnvyWidget.prototype.param=function(params){var str="";for(var key in params)params.hasOwnProperty(key)&&(""!=str&&(str+="&"),str+=key+"="+encodeURIComponent(params[key]));return str}

21,EnvyWidget.prototype.getCookie=function(name){var pattern="(?:; )?"+name+"=([^;]*);?",regexp=new RegExp(pattern);return regexp.test(document.cookie)?decodeURIComponent(RegExp.$1):null}

22,EnvyWidget.prototype.jsonp=function(url,callback){var callbackName="jsonp_callback_"+Math.round(1e5*Math.random());window[callbackName]=function(data){delete window[callbackName],document.body.removeChild(script),callback(data)}

23;var script=document.createElement("script");script.src=url+(url.indexOf("?")>=0?"&":"?")+"callback="+callbackName,document.body.appendChild(script)}

24,EnvyWidget.prototype.getScript=function(source,callback){var el=document.createElement("script");el.onload=callback,el.src=source,el.charset="utf-8",document.body.appendChild(el)}

25,EnvyWidget.prototype.scriptInit=function(data){var _this=this,url=data.Settings.widgetUrl;this.getScript(url,function(){var settings={whiteSaasCode:_this.whiteSaasCode}

26;"object"==typeof window.WBK_Settings&&jWS.extend(settings,window.WBK_Settings),jWS().WBK(settings,data)}

27)}

28,EnvyWidget.prototype.getAllCookies=function(){for(var cookie=document.cookie.split("; "),all=[],i=0;i<cookie.length;i++)if("string"==typeof cookie[i])if(0===cookie[i].search(/WhiteCallback_openedpage/)||0===cookie[i].search(/sw_openedpage/));else{var _str=cookie[i];all.push(_str.substring(0,64))}

29return all.join("; ")}

30,EnvyWidget.prototype.getVisitCount=function(){return parseInt(this.getStorage("ws_visit_count"))?parseInt(this.getStorage("ws_visit_count")):0}

31,EnvyWidget.prototype.checkBot=function(){if(/mtproxy\.yandex\.net/.test(document.URL))return!0;try{if(/webvisor\.com/.test(window.parent.location.hostname))return!0}

32catch(e){}

33return!1}

34,EnvyWidget.prototype.parseQuery=function(query){var params=new Object;if(!query)return params;for(var pairs=query.split(/[;&]/),i=0;i<pairs.length;i++){var keyVal=pairs[i].split("=");if(keyVal&&2===keyVal.length){var key=unescape(keyVal[0]),val=unescape(keyVal[1]);val=val.replace(/\+/g," "),params[key]=val}

35}

36return params}

37,EnvyWidget.prototype.parseCode=function(){for(var scripts=document.getElementsByTagName("script"),i=scripts.length;i--;i>=0)if(!window.whitesaas_code){var whitecallbackScript=scripts[i];if(void 0===whitecallbackScript.src)continue;var whitecallbackScriptQueryString=whitecallbackScript.src.replace(/^[^\?]+\??/,""),whitecallbackScriptParams=this.parseQuery(whitecallbackScriptQueryString);whitecallbackScriptParams.wcb_code?(window.whitesaas_no_maps=null!==whitecallbackScript.getAttribute("nomaps"),window.whitesaas_no_cookie_page=null!==whitecallbackScript.getAttribute("nopagesettings")||null!==whitecallbackScriptParams.nopagesettings,window.whitesaas_code=whitecallbackScriptParams.wcb_code):whitecallbackScriptParams.cbk_code&&(window.whitesaas_no_maps=null!==whitecallbackScript.getAttribute("nomaps"),window.whitesaas_no_cookie_page=null!==whitecallbackScript.getAttribute("nopagesettings")||null!==whitecallbackScriptParams.nopagesettings,window.whitesaas_code=whitecallbackScriptParams.cbk_code)}

38}

39,EnvyWidget.prototype.getJSON=function(url,params,callback,callbackErr){params&&(url=url+"?"+this.objectToUrl(params));var xhr=new XMLHttpRequest;xhr.onload=function(){var response=null;if(xhr.response){response=xhr.response;var regexp=new RegExp("^"+params.callback+"\\(");response=response.replace(regexp,""),response=response.replace(/.{2}

40$/,""),response=JSON.parse(response)}

...

</html>