// these variables can be configured var travelstartIframeId = 'travelstartIframe-c26c344d-8700-4174-ab1b-0801fb85e02b'; var iframeUrl = 'https://www.travelstart.com.ng'; var logMessages = false; var showBanners = false; var affId = '209325'; var affCampaign = ''; var affCurrency = 'Default'; // ZAR / USD / NAD / ... var height = '0px'; var width = '100%'; var language = ''; // ar / en / leave empty for user preference // do not change these var iframe = $('#' + travelstartIframeId); var iframeVersion = '11'; var autoSearch = false; var urlParams = {}; var alreadyExist = []; var affiliateIdExist = false; var iframeParams = []; var cpySource = ''; var match, pl = /\+/g, search = /([^&=]+)=?([^&]*)/g, decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); }, query = window.location.search.substring(1); while (match = search.exec(query)){ urlParams[decode(match[1])] = decode(match[2]); } for (var key in urlParams){ if (urlParams.hasOwnProperty(key)){ if (key == 'search' && urlParams[key] == 'true'){ autoSearch = true; } if( key == 'affId' || key == 'affid' || key == 'aff_id'){ affiliateIdExist = true ; } iframeParams.push(key + '=' + urlParams[key]); alreadyExist.push(key); } } if(!('show_banners' in alreadyExist)){ iframeParams.push('show_banners=' + showBanners); } if(!('log' in alreadyExist)){ iframeParams.push('log=' + logMessages); } if(! affiliateIdExist){ iframeParams.push('affId=' + affId); } if(! affiliateIdExist){ iframeParams.push('language=' + language); } if(!('affCampaign' in alreadyExist)){ iframeParams.push('affCampaign=' + affCampaign); } if(cpySource !== '' && !('cpySource' in alreadyExist)){ iframeParams.push('cpy_source=' + cpySource); } if(!('utm_source' in alreadyExist)){ iframeParams.push('utm_source=affiliate'); } if(!('utm_medium' in alreadyExist)){ iframeParams.push('utm_medium=' + affId); } if(!('isiframe' in alreadyExist)){ iframeParams.push('isiframe=true'); } if(!('landing_page' in alreadyExist)){ iframeParams.push('landing_page=false'); } if (affCurrency.length == 3){ iframeParams.push('currency=' + affCurrency); } if(!('iframeVersion' in alreadyExist)){ iframeParams.push('iframeVersion=' + iframeVersion); } if(!('host' in alreadyExist)){ iframeParams.push('host=' + window.location.href.split('?')[0]); } var newIframeUrl = iframeUrl + (autoSearch ? '/search-on-index?search=true' : '/search-on-index?search=false') + '&' + iframeParams.join('&'); iframe.attr('src', newIframeUrl); function setIframeSize(newWidth, newHeight){ iframe.css('width', newWidth); iframe.width(newWidth); iframe.css('height', newHeight); iframe.height(newHeight); } setIframeSize(width, height); jQuery.receiveMessage(function(e, host){ try { if (typeof e.data !== 'undefined') { var dataElements = e.data.split('&'); if (dataElements) { if (dataElements.length === 1) { //Resize setIframeSize(width, e.data + 'px'); } else { // Set iframe Size var height = dataElements[1].split('='); setIframeSize(width, height[1]+'px'); // Scroll to position if (dataElements.length > 2) { var scrollTo = dataElements[2].split('='); if (scrollTo[1] !== 'none') { var iframeTop = iframe.position().top; if (scrollTo[1] == 'to-top') { window.scrollTo(0, iframeTop); } else { window.scrollTo(0, iframeTop+parseInt(scrollTo[1])); } } } } } } } catch (err) { window.console && console.log(err); } }, iframeUrl);
Post Top Ad
Responsive Ads Here
Wednesday 6 September 2017
Home
Unlabelled
travelstart-affiliate-code-11.js
travelstart-affiliate-code-11.js
Subscribe to:
Post Comments (Atom)
Post Top Ad
Responsive Ads Here
Author Details
Templatesyard is a blogger resources site is a provider of high quality blogger template with premium looking layout and robust design. The main mission of templatesyard is to provide the best quality blogger templates which are professionally designed and perfectlly seo optimized to deliver best result for your blog.
No comments:
Post a Comment