var apiPath = 'https://api.titlecapture.com/api-30/'; var rootPath = 'https://widget.netsheet.com/'; var tcwTpl = 'https://widget.netsheet.com/'; var apiNodePath = 'https://api-node.titlecapture.com/'; var apiNetSheetPath = 'https://api.netsheet.com/'; var appNetSheetPath = 'https://app.netsheet.com/'; var netsheetWebPath = 'https://www.netsheet.com/'; var tcApiPhpAccessToken = 'TC_PROD_ATVPoBw3k3XKn3kXLREZ1WQV'; var tcApiPhpQuotesAccessToken = 'TC_PROD_YqkgPWMZlJew70SrHS4LPmu6'; var whoami = 'production'; (function (global) { // make a global object to store stuff in if(!global.tcWidget) { global.tcWidget = {}; }; var tcWidget = global.tcWidget; var vdate = new Date(); var vtime = vdate.getTime(); var widgetInfo; var x = sessionStorage.getItem('tqc'); var sessionInfo = JSON.parse(x); if(sessionInfo !== null && typeof parseInt(sessionInfo) === 'number') { widgetInfo = sessionInfo; } else { widgetInfo = window.tclp_Option.q; } sessionStorage.setItem('apiPath', apiPath); sessionStorage.setItem('rootPath', rootPath); sessionStorage.setItem('apiNodePath', apiNodePath); sessionStorage.setItem('apiNetSheetPath', apiNetSheetPath); sessionStorage.setItem('appNetSheetPath', appNetSheetPath); sessionStorage.setItem('netsheetWebPath', netsheetWebPath); sessionStorage.setItem('tcApiPhpAccessToken', tcApiPhpAccessToken); sessionStorage.setItem('tcApiPhpQuotesAccessToken', tcApiPhpQuotesAccessToken); sessionStorage.setItem('whoami', whoami); // To keep track of which embeds we have already processed if(!tcWidget.processedScripts) { tcWidget.processedScripts = []; }; var processedScripts = tcWidget.processedScripts; if(!tcWidget.styleTags) { tcWidget.styleTags = []; }; var styleTags = tcWidget.styleTags; var interval = null; function showWidget(type = null) { var iframeBnt = this.document.getElementById('tcWidgetBtn'); var iframePopUp = this.document.getElementById('tcWidgetPopup'); if (iframeBnt.contentWindow) { var contentIframeBtnDoc = iframeBnt.contentWindow.document; var contentIframePopUpDoc = iframePopUp.contentWindow.document; var isActive = contentIframeBtnDoc.getElementById('netsheetBtn').classList.contains('active'); var findClass = contentIframePopUpDoc.getElementsByClassName('tcPopupWidget')[0].classList.contains(type); if(!isActive){ contentIframeBtnDoc.getElementById('netsheetBtn').click(); } contentIframePopUpDoc.getElementsByClassName('tcPopupWidget')[0].classList.remove('buyer', 'seller'); let win = iframePopUp['contentWindow']; if (type != null) { console.log(interval); if (interval) { clearInterval(interval); } win.swapScreen(type); } } } var scriptTags = document.getElementsByTagName('script'); for(var i = 0; i < scriptTags.length; i++) { var scriptTag = scriptTags[i]; //if ( scriptTag.id == 'tc_widget_js' && processedScripts.indexOf(scriptTag) < 0 ) { if ( scriptTag.id == 'tc_widget_js' ) { processedScripts.push(scriptTag); if(styleTags.length == 0) { // add a style tag to the head var linkTag = document.createElement('link'); linkTag.href = tcwTpl + 'css/tcw-common.css?v=' + vtime; linkTag.type = 'text/css'; linkTag.rel = 'stylesheet'; linkTag.id = 'tcw-common-style'; document.getElementsByTagName('head')[0].appendChild(linkTag); } // Create a Button var tcwBtn = document.createElement('iframe'); tcwBtn.id = 'tcWidgetBtn'; tcwBtn.scrolling= 'no'; tcwBtn.allowTransparency='true'; tcwBtn.frameBorder='0'; tcwBtn.style.background = 'transparent'; tcwBtn.style.border = 'none'; tcwBtn.style.position = 'fixed'; tcwBtn.style.zIndex = '999999'; tcwBtn.style.width = '190px'; tcwBtn.style.height = '150px'; if( widgetInfo.offsetRight ){ tcwBtn.style.right = ( widgetInfo.offsetRight - 15 )+ 'px'; }else{ tcwBtn.style.right = '25px'; } if( widgetInfo.offsetBottom ){ tcwBtn.style.bottom = ( widgetInfo.offsetRight - 15 ) + 'px'; }else{ tcwBtn.style.bottom = '25px'; } document.body.appendChild(tcwBtn); //Trigger Widget from outside document.body.addEventListener('click',(target) => { //check if is a valid path if (typeof target.path != 'undefined') { switch(target.path[0].id) { case 'netsheet-widget-seller': showWidget('seller') break; case 'netsheet-widget-buyer': showWidget('buyer') break; case 'netsheet-widget-menu': showWidget(null) break; } } }) //add js for launcher var jsURI = tcwTpl + 'js/tcw-launcher.js?v=' + vtime; var iframeHTML = ''; tcwBtn.contentWindow.document.write(iframeHTML); // Create a click to see text if ( widgetInfo.showcase == true ){ } }/* end : if */ } })(this);