var _thchat_options = typeof _thchat_options == 'undefined' ? {type:'inbound',email:true,linkText:false, timeout:60} : _thchat_options; var _thchat_options_default = false; var fr_opts = fr_opts || {autoLoad:false}; var THA_VARS = THA_VARS || {webp:1}; var _th_log = console.log; var _th_log_on = true; var thlog = function(){ if(_th_log_on){ _th_log.apply(console, arguments); } }; var THH = { fry:new Date().getFullYear() - 1, pus:[], evs:[], awc:false, previewPP:false, getArgs:false, _ap:"https://www.trendhunter.com/apps/inc/kite-header", checkGTAGLoaded:function(){ if(!window.dataLayer){ return false; } for(var i in dataLayer){ if(dataLayer[i]['event'] && dataLayer[i]['event'] == 'gtm.load'){ return true; } } return false; }, load:function(){ var jqueryVersion = THH.isIE() ? "1.12.4" : "3.6.0"; if(typeof jQuery == 'undefined'){ var script = document.createElement("script"); script.type = "text/javascript"; script.src = "https://ajax.googleapis.com/ajax/libs/jquery/"+jqueryVersion+"/jquery.min.js"; script.onload = function(){ $(function(){ THH.init(); }); }; document.getElementsByTagName("head")[0].appendChild(script); }else{ $(function(){ THH.init(); }) } }, init:function(){ _thchat_options_default = $.extend(true,{},_thchat_options); THH.bind(); TButtons.init(); THH.getMemberInfo(); THH.getCatPages(); THH.trackCampaigns(); THH.checkHashLogin(); //webpUtils.checkWebp(); $('.thh__nav2').addClass('thh__nav2--show'); if(THH.isIE() || THH.isEdge()){ var iconUrl = "https://fonts.googleapis.com/css?family=Material+Icons", link = document.createElement("link"); link.type = "text/css"; link.rel = "stylesheet"; link.href = iconUrl; document.getElementsByTagName("head")[0].appendChild(link); } if(THH.isIE()){ var fontUrl = "https://fonts.googleapis.com/css?family=Roboto:700,400,300,100"; link = document.createElement("link"); link.type = "text/css"; link.rel = "stylesheet"; link.href = fontUrl; document.getElementsByTagName("head")[0].appendChild(link); } if(THH.isIE() == 'trident'){ $('body').addClass('th--isIE th--ieOther'); } if(THH.isEdge()){ $('body').addClass('th--isIE th--ieEdge'); } if(THH.isIE() == 'msie'){ $('.thh').addClass('thh--iefix'); $('body').addClass('th--isIE th--ieMSIE'); if(THH.detectIE() == 9){ $('body').addClass('th--ie9'); } } if($('.lp--sales').length){ THH.addChat(); } if(window.location.hash == '#buynow'){ window.scrollTo(0,$('#buynow').position().top - 100) } if($('.thai--fftoplabel').length || $('.lp--hastimers').length){ THH.tickFFTimers(); setInterval(THH.tickFFTimers,1000); } }, loadSurveyWaitlist:function(){ THFormUserLoad('surveywaitlist'); }, loadTHGPTTrial:function(){ THFormUserLoad('thgpttrial'); }, loadFreeWebinar:function(){ THFormUserLoad('webinar'); }, loadFreeTickets:function(){ THFormUserLoad('freeticket'); }, loadFreeReport:function(autoLoad){ THFormUserLoad(); }, loadWaitlist:function(autoLoad){ THFormUserLoad('aiwaitlist'); }, loadFreeEBook2:function(){ THFormUserLoad('ebook'); }, loadSpeakerContact:function(){ THFormUserLoad('speakercontact'); }, loadJGContact:function(){ THFormUserLoad('jgcontact'); }, loadFFContact:function(){ THFormUserLoad('ffcontact'); }, loadAssessmentContact:function(){ THFormUserLoad('assessmentcontact'); }, loadBrochure:function(){ THFormUserLoad('brochure'); }, loadServicesCatalog:function(){ THFormUserLoad('thservicescatalog'); }, loadFreeBrochure:function(autoLoad ){ window.location.href = 'https://go.trendhunter.com/FF2021-Brochure'; return; //THFormUserLoad(); //return; fr_opts = {autoLoad:false,label:'2020 Future Festival Tour',photo:'//cdn.trendhunterstatic.com/ff/future-festival-overview-2017.jpg',formType:'ff'}; autoLoad = autoLoad || false; fr_opts.autoLoad = autoLoad; _th_lb = "free report 3c"; THH.launchPop(); }, loadFreeEbook:function(autoLoad ){ fr_opts = {autoLoad:false,label:'Exploiting Chaos -
Jeremy Gutsche\'s
Award-Winning
Innovation eBook',photo:'//cdn.trendhunterstatic.com/i/2016/ExploitingChaos184b.jpg', formType:'ebook'}; autoLoad = autoLoad || false; fr_opts.autoLoad = autoLoad; _th_lb = "free report 3c"; THH.launchPop(); }, launchPop:function(){ if(typeof th_lb_load == "function"){th_lb_load();}else{ var script = document.createElement("script"); script.type = "text/javascript"; script.src = "//www.trendhunter.com/thlb-js?t="+new Date().getTime(); document.getElementsByTagName("head")[0].appendChild(script); } }, addChat:function(options){ if($('.th__chatFace').length){ return; } if(window.location.origin.indexOf('futurefestival.com') != -1 || window.location.origin.indexOf('jeremygutsche.com') != -1){ return; } var options = options || {type:'inbound',email:true,linkText:false, timeout:60}; window._thchat_options = options; var chatBtnClass = 'th__chatBtn'; if($('.lp--jgsales').length){ chatBtnClass = 'th__jgContactBtn'; }else if($('.lp--speakersales').length){ chatBtnClass = 'th__speakerContactBtn'; }else if($('.lp--ffsales').length){ chatBtnClass = 'th__ffContactBtn'; } $('body').append("
"); }, trackSponsoredClick:function(e){ e.preventDefault(); var $link = $(this), href = $link.attr('href'), spid = $link.data('spid'); var $req = THH.ajax({act:'thh-trspn',spid:spid},'POST',false); $req.always(function(){ window.location.href = href; }); return false; }, trackRelatedCampaign:function(e){ e.preventDefault(); var $link = $(this), href = $link.attr('href'), rrId = $link.data('rrcampaignid'); var $req = THH.ajax({act:'thh-trc',tt:'rrct',tid:rrId},'POST',false); $req.always(function(){ window.location.href = href; }); return false; }, trackHeaderBar:function(e){ e.preventDefault(); var $link = $(this), href = $link.attr('href'), trackId = $link.data('cid'); var $req = THH.ajax({act:'thh-trc',tt:'hct',tid:trackId},'POST',false); $req.always(function(){ window.location.href = href; }); return false; }, trackCampaigns:function(){ //add if there's a related campaign impression var rrImpression = $('[data-rrcampaignid]').length ? $('[data-rrcampaignid]').data('rrcampaignid') : 0; var spnImpression = $('.spn__trackLink[data-spid]').length ? $('.spn__trackLink[data-spid]').data('spid') : 0; if(rrImpression){ THH.ajax({act:'thh-tri',rri:rrImpression},'POST',false); } if(spnImpression){ THH.ajax({act:'thh-tspn',spid:spnImpression},'POST',false); } }, getCatPages:function(){ if(THH.isMobileMenu()){ return; } if(!$('.thh--hasCatMenu').length || !$('.thh--needsCatPages').length){ return; } var type = $('.thh--hasCatMenuPro').length ? 'pro' : 0; var $req = THH.ajax({aj:1, act:'thh-gcp',t:type},'GET',true); $req.done(function(r){ if(!r.success){ return; } $('.thh__catNav').after(r.data); }); }, getCookieItem:function(name, retObj){ var cookies = document.cookie.split(";"), name = name || false, retObj = retObj || false, obj = {}; if(name){ name = $.trim(name.toLowerCase()); } for(var i in cookies){ var cookie = cookies[i], cookieParts = cookie.split("="); if(cookieParts.length < 2){ continue; } var cookieName = $.trim(cookieParts[0].toLowerCase()), cookieVal = cookieParts[1]; obj[cookieName] = cookieVal; if(name && cookieName == name){ return cookieVal; } } if(retObj){ return obj; } return 0; }, getGET:function(){ if(THH.getArgs !== false){ return THH.getArgs; } if(typeof window.location.search != 'string'){ THH.getArgs = {}; return THH.getArgs; } var args = window.location.search.substring(1).split("&"), get = {}; for(var i in args){ var arg = args[i], parts = arg.split("="); if(parts.length < 2){ continue; } get[parts[0]] = parts[1]; } THH.getArgs = get; return get; }, getMemberInfo:function(){ var eid = $('.th__article[data-oeid]').data('oeid'); var params = { aj:1, act:'thh-gmi', iw:window.innerWidth, awc:THH.getCookieItem('_gcl_aw') }; if(window.location.pathname.indexOf('datatrends') != -1){ params['p'] = window.location.pathname; } var getArgs = THH.getGET(); if(getArgs['gclid']){ params['gclid'] = getArgs['gclid']; } if(getArgs['li_fat_id']){ params['li_fat_id'] = getArgs['li_fat_id']; } if(eid){ params['oeid'] = eid; } if(typeof window.location.search == 'string'){ var args = window.location.search.substring(1).split("&"); for(var i in args){ var arg = args[i], parts = arg.split("="); if(parts.length < 2){ continue; } if(parts[0] == 'hcampaign_preview'){ params['hcampaign'] = parseInt(parts[1]); } if(parts[0] == 'pp_preview' || parts[0].toLowerCase() == 'thpromo'){ params['ppvid'] = parseInt(parts[1]); THH.previewPP = true; } } } var $req = THH.ajax(params,'POST',false); $req .done(function(r){ if(!r.success){ return false; } if(r.data.ry){ THH.fry = r.data.ry; } if(r.data.awc){ THH.awc = r.data.awc; } if(r.data.evs){ THH.evs = r.data.evs; } if(r.data.pus && typeof r.data.pus == 'object'){ THH.pus = r.data.pus; if(THH.previewPP){ var type = Object.keys(THH.pus)[0]; THFormTestAuto(type); } } if(typeof window.memberInfoCallback == 'function'){ window.memberInfoCallback(r.data); } if(r.data.pa && typeof r.data.pa == 'string'){ THH.pa = r.data.pa; } if(r.data.pad){ THH.pad = r.data.pad; } if(r.data.hc && typeof r.data.hc == 'object'){ THH.handleHeaderCampaign(r.data.hc); } if(typeof window.memberInfoHooks == 'object' && window.memberInfoHooks.length){ for(var i in window.memberInfoHooks){ if(typeof window.memberInfoHooks[i] == 'function'){ window.memberInfoHooks[i](r.data); } } } var getParts = window.location.search.substr(1).split("&"); for(var i in getParts){ var gp = getParts[i].split("="); if(gp.length != 2){ continue; } if(gp[0] == 'hbfn' && typeof window[gp[1]] == 'function'){ window[gp[1]](); } } if(r.data.u && r.data.u.length){ $('.thh__link--login') .html(r.data.u) .attr('href','https://www.trendhunter.com/settings'); $('.thh__itemLbl--login').html('Logout'); $('.thh__itemLbl--login').siblings('.thh__itemDesc').html('Sign out of Trend Hunter until next time.'); } }); }, handleHeaderCampaign:function(data){ if(typeof data.html == 'undefined'){ return; } if($('.body--nohcamp').length){ return false; } var html = data.html; $('.thh__inner').prepend(html); setTimeout(function(){ if($('.lp__fixedBar').length){ $('.hcamp').removeClass('hcamp--bottom'); } $('.hcamp').addClass('hcamp--showing'); if($('.hcamp.hcamp--bottom').length == 0){ $('.thh').addClass('thh--hcampincluded'); }else{ $('body').addClass('lp--hasbottombar'); } },50); var $cdown = $('.hcamp__cdown2'); if($cdown.length){ hcCountdown2.initializeClock(); } $('.hcamp__close').on('click',function(e){ e.stopPropagation(); e.preventDefault(); $('.hcamp').remove(); $('.lp--hasbottombar').removeClass('lp--hasbottombar'); $('.thh--hcampincluded').removeClass('thh--hcampincluded'); var $req = THH.ajax({act:'s-hb-c'},'POST',false); /*if(window.location.hostname && window.location.hostname == 'www.trendhunter.com'){ var expireDate = new Date(); expireDate.setDate(expireDate.getDate() + 3); var cString = "ThHbar=1;expires="+expireDate+";domain=.trendhunter.com;"; document.cookie = cString; }else{ //have to aj to cp page to set cookie for .th domain var $req = THH.ajax({act:'s-hb-c'},'POST',false); }*/ return false; }); $('.hcamp[data-cid]').on('click',THH.trackHeaderBar); // $('.hcamp').on('click',function(){ // CPage.gevent('header-bar','click', $(this).data('cid'), $(this).attr('href')); // }); }, menuHover:{ item:null, timeout:null, delay:200, show:function(){ if(THH.menuHover.item){ if(THH.menuHover.item.hasClass('thh__page')){ THH.menuHover.item.addClass('thh__page--show'); }else if(THH.menuHover.item.hasClass('thh__catPage')){ THH.menuHover.item.addClass('thh__catPage--show'); } } }, set:function($item){ THH.menuHover.item = $item; THH.menuHover.timeout = setTimeout(THH.menuHover.show,THH.menuHover.delay); }, clear:function(){ THH.menuHover.item = null; clearTimeout(THH.menuHover.timeout); } }, checkHashLogin:function(){ if(typeof window.location.search != 'string'){ return false; } var args = window.location.search.substring(1).split("&"); for(var i in args){ var arg = args[i], parts = arg.split("="); if(parts.length < 2){ continue; } if(parts[0] == 'thlh'){ var hash = parts[1]; window.location.href = "https://www.trendhunter.com/hlogin?lh="+hash; } } return false; }, bind:function(){ $(document,window).on('scroll',THH.handleScroll); $('body') .on('click','.thh__pageLine',function(){ if(THH.isMobileMenu()){ return; } var href = $(this).find('.thh__itemLbl').attr('href'); window.location.href = href; }) .on('mouseenter','.thh__nav [data-page], .thh__icon[data-page], .thh__nav2 [data-page]',function(){ if(THH.isMobileMenu()){ return; } var page = $(this).data('page'); $('.thh__catPage').removeClass('thh__catPage--show'); $('.thh__catNavInner').removeClass('thh__catNavInner--hover'); $('.thh__page').removeClass('thh__page--show'); $('.thh__link--hover').removeClass('thh__link--hover'); THH.menuHover.set($('.thh__page[data-page="'+page+'"]')); // $('.thh__page[data-page="'+page+'"]').addClass('thh__page--show'); if($(this).parents('.thh__nav,.thh__nav2').length){ $(this).addClass('thh__link--hover'); } }) .on('mouseleave','.thh',function(){ if(THH.isMobileMenu()){ return; } var f = $('.thh .thh__textInput:focus'); if(f.length){ return; } $('.thh__page').removeClass('thh__page--show'); $('.thh__catPage').removeClass('thh__catPage--show'); $('.thh__catNavInner').removeClass('thh__catNavInner--hover'); $('.thh__link--hover').removeClass('thh__link--hover'); THH.menuHover.clear(); }) .on('mouseenter','.thh__catNav [data-cat]',function(){ if(THH.isMobileMenu()){ return; } var page = $(this).data('cat'); $('.thh__catLink').removeClass('thh__catLink--hover'); $(this).addClass('thh__catLink--hover'); $('.thh__page').removeClass('thh__page--show'); $('.thh__catPage').removeClass('thh__catPage--show'); // $('.thh__catPage[data-cat="'+page+'"]').addClass('thh__catPage--show'); THH.menuHover.set($('.thh__catPage[data-cat="'+page+'"]')); $('.thh__catNavInner').addClass('thh__catNavInner--hover'); }) .on('mouseenter','.thh__catNav .thh__catLink',function(){ if(THH.isMobileMenu()){ return; } $('.thh__catLink').removeClass('thh__catLink--hover'); $('.thh__catNavInner').addClass('thh__catNavInner--hover'); $(this).addClass('thh__catLink--hover'); }) .on('click','.thh__link', function(e){ if(!THH.isMobileMenu()){ return; } var page = $(this).data('page'), samepage = $('.thh__page[data-page="'+page+'"].thh__page--mobile.thh__page--show').length, hasNoSubMenu = $('.thh__page[data-page="'+page+'"]').length ? 0 : 1; if(hasNoSubMenu){ return; } e.preventDefault(); $('.thh__page--mobile.thh__page--show').remove(); if(samepage){ return; } var $page = $('.thh__page[data-page="'+page+'"]').clone().addClass('thh__page--mobile thh__page--show'); $(this).after($page); }) .on('click','.thh__menuBtn, .thh__searchTopIcon',function(){ $('.thh').toggleClass('thh--showmenu'); if($('.thh--showmenu').length){ $('body').css('overflow','hidden'); }else{ $('body').css('overflow','auto'); } }) .on('mouseenter','.thh__catSideLink[data-megatrend]',function(){ THH.loadArticles({act:'thh-lma',m:$(this).data('megatrend')}); }) .on('mouseenter','.thh__catSideLink[data-purl]',function(){ THH.loadArticles({act:'thh-lci',c:$(this).data('purl')}); }) .on('mouseenter','.thh__catSideLink[data-url]',function(){ THH.loadArticles({act:'thh-lca',c:$(this).data('url')}); }) .on('keyup','.thh__searchForm .thh__textInput',function(){ THH.checkTags(); }) .on('submit','.thh__searchForm',function(e){ var txt = $.trim($('.thh__searchForm .thh__textInput').val()); if(txt.length == 0){ e.preventDefault(); Prompt.alert('Please enter a search term to begin exploring.'); return false; } }) .on('mouseenter','.thar',function(){ THHActions.rotateImages(this); }) .on('mouseleave','.thar',function(){ THHActions.stopRotation(); }) .on('click','.thh__nav .thh__link',function(e){ return true; /*if(!THH.isMobileMenu()){ e.preventDefault(); CPage.gevent('header-links','header-link-click', $(this).text(), $(this).attr('href')); return; } CPage.gevent('header-links','header-link-click', $(this).text());*/ }) .on('click','.th__chatBtn',function(){ startTHChat(this); }) .on('click','.th__freeReportBtn',THH.loadFreeReport) .on('click','.th__aiwaitlistBtn',THH.loadWaitlist) .on('click','.th__freeWebinarBtn',THH.loadFreeWebinar) .on('click','.th__surveywaitlistBtn',THH.loadSurveyWaitlist) .on('click','.th__thgptTrialBtn',THH.loadTHGPTTrial) .on('click','.th__jgContactBtn', THH.loadJGContact) .on('click','.th__ffContactBtn', THH.loadFFContact) .on('click','.th__assessmentContactBtn', THH.loadAssessmentContact) .on('click','.th__brochureBtn', THH.loadBrochure) .on('click','.th__servicesBtn', THH.loadServicesCatalog) .on('click','.th__speakerContactBtn', THH.loadSpeakerContact) .on('click','.th__freeEbookBtn',THH.loadFreeEbook) .on('click','.th__freeEbookBtn2',THH.loadFreeEBook2) .on('click','.lp__topVideoPop',function(e){ e.preventDefault(); var yid = $(this).data('yid'); THH.topVideoPop(yid); }) .on('click','.th__freeBrochureBtn,.freeOverview',THH.loadFreeBrochure) .on('click','.lp__popClose, .lp__popBg', function (){ $('.lp__popCont').remove(); }) .on('click','.lp__videoThumb',THH.videoSwitch) .on('click','[data-rrcampaignid]',THH.trackRelatedCampaign) .on('click','.spn__trackLink[data-spid]',THH.trackSponsoredClick) .on('change','[name="ffp__togT"]',function(){ var val = $(this).val(); $('.ffp__tbl') .removeClass('ffp__tbl--client ffp__tbl--nonclient') .addClass('ffp__tbl--'+val); //move any other checkboxes on this page (for multiple events) to same value $('[name="ffp__togT"][value="'+val+'"]').prop('checked',true); }) .on('click','.lp__hiddenTextToggle',function(){ var $btn = $(this), htId = $btn.data('hiddentext'), hToggleOffId = $btn.data('hiddentoggleoff'), $ht = $('.lp__hiddenText[data-hiddentext="'+htId+'"]'), icon = 'expand_more'; $ht.toggle(); if($ht.is(":visible")){ icon = 'expand_less'; Lazy.reveal(); if(hToggleOffId && $('.lp__hiddenText[data-hiddentext="'+hToggleOffId+'"]:visible').length){ $('.lp__hiddenTextToggle[data-hiddentext="'+hToggleOffId+'"]').trigger('click'); } window.scrollTo(0,$ht.offset().top - 100) } $btn.find('i').html(icon); }).on('click','.jgl__vgalItem',function(){ var yid = $(this).data('yid'), link = "https://www.youtube.com/embed/"+yid+"?rel=0&showinfo=0"; if(window.innerWidth <= 810){ THH.topVideoPop(yid); return; } $('#jgl__vgalVideoPlayerCont iframe').attr('src',link); $("html,body").animate({scrollTop:$('#jgl__vgalVideoPlayerCont').offset().top - 120}); }); $(window).on('resize',function(){ if(!THH.isMobileMenu()){ $('.thh__page--mobile').remove(); $('body').css('overflow','auto'); } }); }, videoSwitch:function(){ var playerId = $(this).data('player'), yid = $(this).data('youtubeid'), $player = $(playerId), link = "https://www.youtube.com/embed/"+yid+"?rel=0&iv_load_policy=3&showinfo=0"; $player.attr('src', link); if($player.get(0).getBoundingClientRect().y < 0){ $(window).scrollTop($player.offset().top - 50); } }, lastScroll:new Date().getTime(), handleScroll:function(){ var currTime = new Date().getTime(), diff = currTime - THH.lastScroll; if(diff < 100){ return; } if($(document).scrollTop() > 1){ $('.thh').addClass('thh--shadow'); }else{ $('.thh').removeClass('thh--shadow'); } }, topVideoPop:function(yid){ $('.lp__popCont').remove(); var html = [ "
", "
", "
", "close", "
", "", "
", "
", "
" ].join(""); $('body').append(html); }, checkTags:function(){ var $inp = $('.thh__searchForm .thh__textInput'), txt = $inp.val(); if(txt.length < 2){ return; } var $req = THH.ajax({act:'tags', t:txt},'GET', true); $req.done(function(r){ if(!r.success){ return; } $('.thh__searchTags').html(r.data); }); }, loadArticles:function(params){ var $req = THH.ajax(params,'GET',true); $req.done(function(r){ if(!r.success){ return; } $('.thh__catPage--show .thh__catPageRight').html(r.data); }); }, isMobileMenu:function(){ return window.innerWidth <= 1000; }, isIE:function() { var ua = window.navigator.userAgent, msie = ua.indexOf('MSIE '), trident = ua.indexOf('Trident/') edge = ua.indexOf('Edge/'); if (msie > 0){ return "msie"; }else if(trident > 0){ return "trident"; }else{ return false; } }, ajax:function(params,type, cache){ var params = params || {}, type = type || 'GET', cache = cache || false; params['aj'] = 1; var _ap = params['_ap'] ? params['_ap'] : THH._ap; delete params['_ap']; var get = THH.getGET(); if(get['time']){ params['time'] = get['time']; } return $.ajax({ url:_ap, data:params, dataType:'json', type:type, cache:cache, xhrFields:{withCredentials:true}, crossDomain:true }); }, isEdge:function(){ var ua = window.navigator.userAgent, edge = ua.indexOf('Edge/'); return edge != -1 ? true : false; }, detectIE:function(){ var rv = -1; // Return value assumes failure. if (navigator.appName == 'Microsoft Internet Explorer'){ var ua = navigator.userAgent, re = new RegExp("MSIE ([0-9]{1,}[\\.0-9]{0,})"); if (re.exec(ua) !== null){ rv = parseFloat( RegExp.$1 ); } } else if(navigator.appName == "Netscape"){ /// in IE 11 the navigator.appVersion says 'trident' /// in Edge the navigator.appVersion does not say trident if(navigator.appVersion.indexOf('Trident') === -1) rv = 12; else rv = 11; } return rv; }, tickFFTimers:function(){ var $timers = $('.lp__ffTimer'); $timers.each(function(){ var $timer = $(this), curr = parseInt($timer.data('curr')), end = parseInt($timer.data('end')), seconds = end - curr, days = Math.floor(seconds/24/60/60), hoursLeft = Math.floor((seconds) - (days*86400)), hours = Math.floor(hoursLeft/3600), minutesLeft = Math.floor((hoursLeft) - (hours*3600)), minutes = Math.floor(minutesLeft/60), remainingSeconds = seconds % 60, parts = []; parts.push(remainingSeconds+"s"); if(seconds >= 60){ parts.push(minutes+"m"); } if(seconds >= 3600){ parts.push(hours+"h"); } if(seconds >= 86400){ parts.push(days+"d"); } parts = parts.reverse(); var str = parts.join(" "); curr = curr + 1; $timer.data('curr', curr); $timer.text(str); if($timer.parents('.lp__ffTimerCont:not(:visible)')){ $timer.parents('.lp__ffTimerCont').fadeIn(); } }); } } THH.load(); var TPop = { initialized:false, init:function(){ TPop.destroy(); if(!TPop.initialized){ TPop.bind(); } TPop.initialized = true; }, destroy:function(){ $('.thpop__cont').remove(); }, bind:function(){ $('body') .on('click','.thpop__bg',TPop.destroy) .on('click','.thpop__close',TPop.destroy); }, loadFFAd:function(autoload){ TPop.init(); var autoload = autoload || false; if(autoload && window.innerWidth <= 800){ return; } var img = '/i/2020/ffws-pu2.jpg', tc = '8ee7be10'; if((new Date()).getTime() > 1602734400000){ img = '/i/2020/ffvirtual2for1.png'; tc = '47e97b1c'; } var html = [ "
", "
", "
", "
", "close", "", "", "", "
", "
", "
" ].join(""); TPop.deploy(html); }, deploy:function(html){ $('body').append(html); setTimeout(function(){ $('.thpop__cont').addClass('thpop__cont--visible'); },100); } }; var webpUtils = { checkWebp:function(){ var isWebP = false ; var img_checkWebP = new Image(); img_checkWebP.src = "https://cdn.trendhunterstatic.com/i/2022/webptestimg.webp"; img_checkWebP.onload = function(){ isWebP = !!( img_checkWebP.height>0 && img_checkWebP.width>0 ) ; if ( !isWebP ) { webpUtils.removeWebp(); } }; img_checkWebP.onerror = function(){ webpUtils.removeWebp(); }; }, removeWebp:function(){ THA_VARS['webp'] = 0; $("*").each(function(){ if($(this).prop('nodeName') == 'IMG'){ webpUtils.fixImage(this); }else if($(this).css('background-image') != 'none'){ webpUtils.fixBackgroundImage(this); } }); }, fixImage:function(el){ var $el = $(el), src = $.trim($el.attr('src')), dataSrc = $.trim($el.attr('data-src')); if(src.indexOf("format=webp") != -1){ $el.attr('src',src.replace("format=webp","")); } if(dataSrc.indexOf("format=webp") != -1){ $el.attr('data-src',dataSrc.replace("format=webp","")); } }, fixBackgroundImage:function(el){ var $el = $(el), backgroundImage = $.trim($el.css('background-image')); if(backgroundImage.indexOf("url") == -1 || backgroundImage.indexOf("format=webp") == -1){ return; } backgroundImage = backgroundImage.replace("format=webp",""); $el.css('background-image',backgroundImage); } }; var Prompt = { settings:{title:'Trend Hunter', color:'black'}, deferred:{}, cancelDef:{}, background:function(){ $('body').append('
') setTimeout(function(){$('.prompt__background').addClass('prompt__background--showing')},1 ); }, focus:function(){ $('.prompt__ok').focus(); if($('.prompt').find('.prompt__ta').length > 0){ $('.prompt__ta').focus(); } if($('.prompt').hasClass('prompt--confirm')){ $('.prompt__cancel').focus(); } }, init:function(defname, deffunc, cancelfunc){ Prompt.background(); setTimeout(function(){$('.prompt').addClass('prompt--showing'); Prompt.focus();},1) $('.prompt__ok').on('click', Prompt.ok); $('.prompt__cancel').on('click',Prompt.cancel); if(!defname){ return; } Prompt.deferred[defname] = $.Deferred(); if(deffunc){ $.when(Prompt.deferred[defname]).done(deffunc); } Prompt.cancelDef[defname+"-cancel"] = $.Deferred(); if(cancelfunc){ $.when(Prompt.cancelDef[defname+"-cancel"]).done(function(val){ cancelfunc(val); }); } return Prompt.deferred[defname]; }, flash:function(msg){ Prompt.destroy(); var html = [ "
", "
"+Prompt.settings.title+"
", "
", "
"+msg+"
", "
", "
" ].join("\n"); $('body').prepend(html); setTimeout(function(){ Prompt.destroy(); },2000); return Prompt.init(); }, alert:function(msg, defname,deffunc){ if(typeof defname == 'function' || typeof defname == 'undefined'){ deffunc = defname; defname = 'pdef-'+Math.round(Math.random()*100); } Prompt.destroy(); var html = [ "
", "
"+Prompt.settings.title+"
", "
", "
"+msg+"
", "
", "", "
", "
", "
" ].join("\n"); $('body').prepend(html); return Prompt.init(defname, deffunc); }, custom:function(msg,btn1,btn2,func1,func2){ Prompt.destroy(); var html = [ "
", "
"+Prompt.settings.title+"
", "
", "
"+msg+"
", "
", "", "
", "
", "
" ].join("\n"); $('body').prepend(html); return Prompt.init('pdef-'+Math.round(Math.random()*100),func1,func2); }, confirm:function(msg, defname,deffunc, cancelfunc){ if(typeof defname == 'function' || typeof defname == 'undefined'){ cancelfunc = deffunc; deffunc = defname; defname = 'pdef-'+Math.round(Math.random()*100); } Prompt.destroy(); var html = [ "
", "
"+Prompt.settings.title+"
", "
", "
"+msg+"
", "
", "", "
", "
", "
" ].join("\n"); $('body').prepend(html); return Prompt.init(defname, deffunc, cancelfunc); }, ta:function(msg,defname,deffunc, cancelfunc){ if(typeof defname == 'function' || typeof defname == 'undefined'){ cancelfunc = deffunc; deffunc = defname; defname = 'pdef-'+Math.round(Math.random()*100); } Prompt.destroy(); var html = [ "
", "
"+Prompt.settings.title+"
", "
", "
"+msg+"
", "
", "
", "", "
", "
", "
" ].join("\n"); $('body').prepend(html); return Prompt.init(defname, deffunc, cancelfunc); }, prompt:function(msg, defname, deffunc,cancelfunc){ Prompt.destroy(); var html = [ "
", "
"+Prompt.settings.title+"
", "
", "
"+msg+"
", "
", "
", "", "
", "
", "
" ].join("\n"); $('body').prepend(html); return Prompt.init(defname, deffunc, cancelfunc); }, cancelDeferred:function(){ Prompt.deferred = {}; return true; }, cancel:function(){ for(var i in Prompt.cancelDef){ var val = $('.prompt__input').length > 0 ? $.trim($('.prompt__input').val()) : null; Prompt.cancelDef[i].resolve(val); } Prompt.cancelDef = {}; Prompt.destroy(); }, resolveDeferred:function(){ for(var i in Prompt.deferred){ var val = $('.prompt__input').length > 0 ? $.trim($('.prompt__input').val()) : null; Prompt.deferred[i].resolve(val); } return true; }, destroy:function(){ Prompt.cancelDeferred(); $('.prompt__background').remove(); $('.prompt').remove(); }, ok:function(){ Prompt.resolveDeferred(); Prompt.destroy(); } }; var hcCountdown2 = { getTimeRemaining:function(endtime) { var t = Date.parse(endtime) - Date.parse(new Date()), seconds = Math.floor((t / 1000) % 60), minutes = Math.floor((t / 1000 / 60) % 60), hours = Math.floor((t / (1000 * 60 * 60)) % 24), days = Math.floor(t / (1000 * 60 * 60 * 24)); return {'total': t,'days': days,'hours': hours,'minutes': minutes,'seconds': seconds}; }, initializeClock:function() { var $clock = $('.hcamp__cdown2'); if($clock.length == 0){ return false; } $clock.html("") var endTimestamp = $clock.data('end')*1000, endtime = new Date(endTimestamp), $timeLeftSpan = $('.cdown__timeleft'); function updateClock() { var t = hcCountdown2.getTimeRemaining(endtime), unit, num, plural; if(t.days >= 1){ unit = 'Day'; num = t.days; }else if(t.hours > 0){ unit = 'Hour'; num = t.hours; }else{ unit = 'Hour'; num = 1; } /*plural = num > 1 ? 's' : ''; $timeLeftSpan.html(num+" "+unit+plural+" Left");*/ var timeLbl = t.days+"d"+t.hours+"h Left"; $timeLeftSpan.html(timeLbl); } updateClock(); // var timeinterval = setInterval(updateClock, 1000); } }; var THHActions = { rotateInterval:null, rotateItem:null, rotateImages:function(item){ if($(item).data('pc') == 1 || !$(item).data('pc')){ return; } if($(item).hasClass('thar--toplist') && !$(item).data('rel')){ return; } if(!$(item).data('ci')){ $(item).data('ci',1); } THHActions.rotateItem = item; clearInterval(THHActions.rotateInterval); THHActions.rotateInterval = setInterval(THHActions.doRotation,1000); }, doRotation:function(){ var item = THHActions.rotateItem, $item = $(item), id = $item.data('id'), pc = $item.data('pc'), ci = $item.data('ci'), is = $item.data('is'); ci += 1; if(is == '230c'){ is = '468'; } if(ci > pc){ ci = 1; } $item.data('ci',ci); if($item.hasClass('thar--toplist')){ var index = ci - 1, rel = $item.data('rel'), eid = parseInt(rel[index]); var imageSrc = THHUtils.getImageSrc(eid,1,is); }else{ var imageSrc = THHUtils.getImageSrc(id,ci,is); } $item.find('img').attr('src',imageSrc); }, stopRotation:function(){ clearInterval(THHActions.rotateInterval); THHActions.rotateItem = false; } }; var THHUtils = { iHost:'https://cdn.trendhunterstatic.com', getImageSrc:function(eid,num,format,domain){ var domain = domain || THHUtils.iHost, webp = THA_VARS['webp'] ? "?auto=webp" : "", src = domain+"/phpthumbnails/"+Math.floor(eid/1000)+"/"+eid+"/"+eid+"_"+num+"_"+format+".jpeg"+webp; return src; } }; var Lazy = { reveal:function(){ var $items = $('.thai:not(.thai--loaded):visible'); if(!$items.length){ return; } var wHeight = window.innerHeight, tollerance = 400; $items.each(function(){ var info = this.getBoundingClientRect(), top = info.top, bottom = info.bottom, middle = (top + bottom)/2, istl = $(this).hasClass('thai--istoplistimage') ? true : false, tollerance = istl ? info.height + 50 : info.height + 200, min = 0 - tollerance, max = wHeight + tollerance; if((top > min && bottom < max)){ if(istl && typeof AUtils != 'undefined' && typeof AUtils.trackInternal != 'undefined'){ AUtils.trackInternal(); } $(this).addClass('thai--loaded'); if($(this).hasClass('thai--ffmap')){ var eid = $(this).data('eid'), html = ""; $(this).replaceWith(html); }else if($(this).hasClass('thai--youtube')){ var yid = $(this).data('yid'), html = ""; $(this).replaceWith(html); }else if($(this).hasClass('thai--bg')){ $(this).css('background-image',"url(\""+$(this).data('src')+"\")"); $('').attr('src',$(this).data('src')).on('load',function(){ $("[data-src='"+$(this).attr('src')+"']").addClass('thai--ot'); }) }else if($(this).hasClass('thai--ffpricing')){ var $cont = $(this), getArgs = THH.getGET(), eventIds = $cont.data('eventids'), promo = $cont.data('promo'); if(getArgs['promo']){ promo = getArgs['promo']; } var $req = THH.ajax({act:'thh-loadffpricing',eventIds:eventIds,promo:promo},'POST', false); $req.done(function(r){ if(!r.success){ console.log('Error loading pricing'); return false; } $cont.html(r.data); Lazy.reveal(); if($('#buytickets:visible').length && window.location.pathname != '/'){ console.log('scrolling'); window.scrollTo(0,$('#buytickets').position().top - 100); } }); $cont.html(html).addClass('thai--ot'); }else if($(this).hasClass('thai--fftoplabel')){ var $cont = $(this), eventId = $cont.data('eventid'), promo = $cont.data('promo'); $req = THH.ajax({act:'thh-loadfftoplabel', eventId:eventId, promo:promo},'POST',false); $req.done(function(r){ if(!r.success){ console.log('Error loading ff top label'); return false; } $cont.html(r.data.topLabel); Lazy.reveal(); }); $cont.html(html).addClass('thai--ot'); }else{ var src = $(this).data('src'), srcArgParts = src.split("?"), srcParts = src.split("."), ext = srcParts[srcParts.length - 1]; if(srcArgParts.length == 1 && THA_VARS['webp'] && ['jpeg','jpg','png'].indexOf(ext) != -1){ src += "?auto=webp"; }else if(srcArgParts.length > 1 && !THA_VARS['webp']){ var srcArgs = srcArgParts[1].split("&"); //remove webp from lazyload image var srcArgsGood = []; for(var i in srcArgs){ var srcArg = [i]; if(srcArg == 'format=webp'){ continue; } srcArgsGood.push(srcArg); } var src = srcArgParts[0]+"?"+srcArgsGood.join("&"); } $(this).on('load',function(){ $(this).addClass('thai--ot'); }); $(this).attr('src',src); } } }); } }; var CPage = { lastScroll:new Date().getTime(), page:1, moreCont:'.thm__page:last', init:function(){ setTimeout(Lazy.reveal,200); this.bind(); }, bind:function(){ var self = this; $(document,window).on('scroll',self.handleScroll); $(window).on('resize',self.handleResize); $('body') .on('click','[data-btn="more"]',self.loadMore); }, handleScroll:function(){ var self = CPage; var currTime = new Date().getTime(), diff = currTime - self.lastScroll; if(diff < 100){ return; } Lazy.reveal(); self.lastScroll = currTime; }, handleResize:function(){ Lazy.reveal(); }, loadMore:function(){ var self = CPage, page = self.page, nextPage = page + 1, params = {_ap:window.location.href,act:'lp',p:nextPage}, $req = THH.ajax(params,'GET', true); $('.tha__btn--more').hide(); $('.tha__moreLoader').show(); $req .done(function(r){ if(!r.success){ error(r.data); return false; } if(r.data.length == 0){ $('.tha__btn--more').remove(); return; } self.page = self.page + 1; $(self.moreCont).append(r.data); Lazy.reveal(); }) .fail(function(){ error('There was an error loading the next page'); }) .always(function(){ $('.tha__btn--more').show(); $('.tha__moreLoader').hide(); });; }, gevent:function(category,action,label, url){ label = label == null ? '' : label; category = category+""; action = action+""; label = label+""; var gtagArgs = { 'event_category':category, 'event_label':label }; if(!THH.checkGTAGLoaded() && url){ if(typeof url == 'function'){ url(); }else{ window.location.href = url; return true; } } if(url){ var callback = typeof url == 'function' ? function(id){ if(id.indexOf('GTM-') != -1){ url(); } } : function(id){ if(id.indexOf('GTM-') != -1){ window.location.href = url; } }; gtagArgs['event_callback'] = callback; } //console.log('gtag-kh-'+action, gtagArgs); gtag('event',action,gtagArgs); } }; function error(txt){ Prompt.alert(txt); } var thchatpage = '/apps/js/th-chat.js'; function startTHChat(context,givenContext){ CPage.gevent('th-sales-page','started-chat'); _thchat_options = $.extend(true,{},_thchat_options_default); if($(context).hasClass('thchat--consultation')){ _thchat_options['cre-test'] = 'consultation'; /*this schedules a call now*/ window.location.href = 'https://www.trendhunter.com/schedule-call/consultation'; return false; }else if($(context).hasClass('thchat--sponsorships')){ _thchat_options['customIntro'] = "Hello! We have many engaging opportunities, so paint us a brief picture of what you're looking to get out of a partnership, and we'll get back to you asap, or call us at 647-847-2292 ext 2122. Please make sure to state your name and company a well."; }else if($(context).hasClass('th__chatBtn--invoice')){ _thchat_options = {type:'invoice',email:true,linkText:false, customIntro:"Need an invoice for a service or product? Let us know the details and we'll reach out to you!"}; } _thchat_options['linkText'] = givenContext ? givenContext : context && typeof context.innerHTML != 'undefined' ? context.innerHTML : false; if(typeof TH_CHAT == 'undefined'){ var script = document.createElement("script"); script.type = "text/javascript"; script.src = "//www.trendhunter.com/"+thchatpage+"?_t="+new Date().getTime(); document.getElementsByTagName("head")[0].appendChild(script); }else{ TH_CHAT.load(); } return false; } var l2 = { on:function(){ bar.on(); loader.on(); }, off:function(){ bar.off(); loader.off(); } }; var bar = { on:function(){ $('.th__lbar').fadeIn('fast').addClass('show'); $('.th__lbarInner').css('width',"0%"); bar.interval = setInterval(function(){ bar.percent += 0.2; if(bar.percent > 100){ bar.percent = 100; } $('.th__lbarInner').css('width',bar.percent+"%"); },20); }, off:function(){ $('.th__lbarInner').css('width',"100%"); clearInterval(bar.interval); setTimeout(function(){ $('.th__lbar').hide().removeClass('show'); },200); bar.percent = 0; }, interval:null, percent:0 }; var loader = { on:function(){ $('.th__loader').show(); }, off:function(){ $('.th__loader').hide(); } }; function THFormPop(options){ var options = options || {}; this.formId = options['formId'] || "thform"+Math.round(Math.random()*100); this.iframeName = "thformname"+Math.round(Math.random()*100); this.method = options['method'] || "post"; this.submitted1 = false; this.submitted2 = false; this.submitted3 = false; this.formPage = options['formPage'] || window.location.href; this.required = options['required'] || 'all'; this.formType = options['formType'] || 'report'; this.scheduleCall = options['scheduleCall'] || 'occupation'; this.email = options['email'] || ''; this.autoload = false; this.forceAutoload = false; this.exitIntentAutoload = false; this.exitIntentDeployed = false; this.step1Email = ""; this.step1NewsletterChecked = false; this.currentStep = 1; this.guid = false; this.form1Image = "https://cdn.trendhunterstatic.com/i/2021/free-2021-trend-report.jpg?auto=webp"; this.variation = '2step_default_variation'; this.submitTrackingFired1 = false; this.submitTrackingFired2 = false; this.submitTrackingFired3 = false; this.s1t1 = "FREE 2021
TREND REPORT
(worth $1,500)"; this.s1t2 = "LEARN THE TOP 100 OPPORTUNITIES THAT WILL CHANGE 2021"; this.s1bt = "GET IT NOW"; this.action1 = "https://go.trendhunter.com/l/787783/2021-01-07/3csm3"; this.directActionLink = false; this.form2Image = "https://cdn.trendhunterstatic.com/i/2021/3-sample-custom-reports2.jpg"; this.s2t1 = "Last Step: Enter Your Details & Get 3 Sample Custom Reports, Videos & a Future Festival Ticket"; this.s2bt = "GET IT NOW"; this.action2 = "https://go.trendhunter.com/l/787783/2021-01-13/3d53y"; this.step2Disabled = 0; this.pData = false; this.vid = false; this.trackCategoryAuto = 0; this.companyType = false; //step 3 variables this.step3Enabled = 0; this.action3 = ""; this.step3Btn = ""; this.step3Text = ""; this.step3Image = ""; this.step3NoThanks = ""; this.step2FirstName = ""; this.step2LastName = ""; this.step2Industry = ""; this.step2JobTitle = ""; this.step1HasEvents = 0; this.step1EmailDomain = 0; this.validEmailDomain = 0; this.confirmedEmailSpelling = 0; this.callbackEventData = false; this.step3HasEvents = 0; this.events = []; this.checkCookieFirst = true; this.awc = false; this.submitting = false; this.isInline = false; this.isArchived = false; if(typeof options['scheduleCall'] != 'undefined' && options['scheduleCall'] == false){ this.scheduleCall = 0; } if(typeof options['scheduleCall'] != 'undefined' && options['scheduleCall'] === true){ this.scheduleCall = 1; } var self = this; this.popLoader = function(on){ if(on){ $('.lp__formPopLoader').show(); }else{ $('.lp__formPopLoader').hide(); } }; this.submit3 = function(){ //only events selector for now if(self.submitted3){ return false; } var $form = $("#"+self.formId+"-3"), phone = $form.find('[name="phonenumber"]').length ? $form.find('[name="phonenumber"]').val().trim() : false; if(['jgcontact','speakercontact'].indexOf(self.formType) != -1){ var priceRange = $form.find("[name='jgcf__radioStep3']:checked").val(); if(!priceRange){ Prompt.alert("Please specify a price range."); return false; } } if(self.step3HasEvents && !self.callbackEventData){ self.doEventCallback($form, 3); return false; } self.popLoader(true); self.submitting = true; if(!self.submitTrackingFired3){ self.doSubmitTracking(3); return false; } self.submitted3 = true; self.currentStep = 4; if(phone){ var ud = { "phone_number":self.cleanPhone(phone), "email":self.step1Email }; self.sendUserData(ud); } return true; }; this.cleanPhone = function(phone){ var phoneClean = phone.replace(/\D/g, ''); if(phoneClean.length == 10){ phoneClean = "1"+phoneClean; } phoneClean = "+"+phoneClean; return phoneClean; } this.submit2 = function(){ if(self.submitted2){ return false; } var valid = false; if(!self.checkEmail(2)){ return false; } var $form = $("#"+self.formId+"-2"), firstName = $.trim($form.find("[name='first_name']").val()), lastName = $.trim($form.find("[name='last_name']").val()), industry = $.trim($form.find("[name='industry']").val()), jobTitle = $.trim($form.find("[name='job_title']").val()), email2 = $form.find("[name='email2']").length ? $.trim($form.find("[name='email2']").val()) : false, email1 = self.step1Email, phone = $.trim($form.find("[name='phone']").val()); self.step2FirstName = firstName; self.step2LastName = lastName; self.step2Industry = industry; self.step2JobTitle = jobTitle; if(self.required == 'all'){ valid = self.checkRequiredAll(); }else{ valid = true; } if(!valid){ return false; } self.submitting = true; self.popLoader(true); if(!self.submitTrackingFired2){ self.doSubmitTracking(2); return false; } //if it's the same clear it so it doesn't submit if(email2 == email1){ $form.find("[name='email2']").val(''); } var ud = {}; if(email2 && email2 != email1){ ud['email'] = [email1,email2]; }else{ ud['email'] = email1; } if(phone){ ud['phone_number'] = self.cleanPhone(phone); } self.sendUserData(ud); self.submitted2 = true; self.currentStep = 3; // self.closePop(); return true; }; this.resubscribeNotify = function(){ var rHtml = [ "The provided email may have been unsubscribed from our emails.", "Click here to check your subscription status!" ].join("
"); $('body') .on('click','.prompt__resubscribeEmailLink', function(){ var email = $(this).data('email'); var $req = THH.ajax({act:'thh-refl',e:email},'POST', false); }); Prompt.alert(rHtml); }; this.sendUserData = function(ud){ gtag('set','user_data',ud); } this.step1Callback = function(){ self.submitting = false; if(self.step2Disabled){ if(self.step3Enabled){ self.currentStep = 3; self.goToStep3(); }else{ self.formCompleted(3) } }else{ self.currentStep = 2; self.goToStep2(); } }; this.submit1 = function(){ if(self.submitted1){ return false; } var $form = $("#"+self.formId+"-1"), email = $.trim($form.find("[name='email']").val()), newsletterChecked = $form.find('[name="newsletter"]:checked').length ? true : false, newsletterChecked = $form.find('[name="free_report"]:checked').length ? true : newsletterChecked; if(typeof grecaptcha == 'object'){ if(grecaptcha.getResponse().length == 0){ error('Please complete the captcha to proceed.'); return false; } } self.step1Email = email; self.step1NewsletterChecked = newsletterChecked; if(['jgcontact','speakercontact'].indexOf(self.formType) != -1){ var topic = $form.find('[name="jgcf__radioStep1"]:checked').val(), eventDetails = $.trim($form.find('[name="eventdetails"]').val()); if(!topic){ Prompt.alert("Please select a topic to continue."); return false; } if(!eventDetails.length){ Prompt.alert("Please fill out some details to submit."); return false; } } if(['ffcontact'].indexOf(self.formType) != -1){ var topic = $form.find('[name="ffc__radioStep1"]:checked').val(), details = $.trim($form.find('[name="ffquestion"]').val()); if(!topic){ Prompt.alert("Please select a topic to continue."); return false; } if(!details.length){ Prompt.alert("Please fill out some details to submit."); return false; } } if(['assessmentcontact'].indexOf(self.formType) != -1){ var topic = $form.find('[name="asc__radioStep1"]:checked').val(), details = $.trim($form.find('[name="ascQuestion"]').val()); if(!topic){ Prompt.alert("Please select a reason to continue."); return false; } } if(!self.checkEmail(1)){ return false; } if(self.step1HasEvents && !self.callbackEventData){ self.doEventCallback($form, 1); return false; } if(self.step1EmailDomain && !self.validEmailDomain){ if(!self.confirmedEmailSpelling){ var vCommon = ['gmail.com','hotmail.com','yahoo.com'], emailParts = email.split("@"), emailDomain = emailParts[emailParts.length - 1]; for(var i in vCommon){ var vc = vCommon[i]; if([1,2].indexOf(self.checkstrs(vc,emailDomain)) == -1){ continue; } var p = Prompt.confirm("Your email address may have a spelling mistake.
Click CONFIRM if your email is "+email+"
Click CANCEL to edit your email."); p.done(function(){ self.confirmedEmailSpelling = 1; self.doEmailDomainCheckCallback($form, 1); }); return false; } } } if(!self.validEmailDomain){ self.doEmailDomainCheckCallback($form, 1); return false; } self.submitting = true; self.popLoader(true); if(!self.submitTrackingFired1){ self.doSubmitTracking(1); return false; } self.submitted1 = true; self.sendUserData({'email':email}); var d = new Date(), t = d.getTime() + 86400000; d.setTime(t); document.cookie = "thpop1=1;expires="+d.toUTCString(); return true; }; this.formCompleted = function(step){ self.submitting = false; if(['insights','trendwall'].indexOf(self.formType) != -1){ self.closePop(); if(self.formType == 'insights' && PTUtils && typeof PTUtils.popfilled == 'function'){ PTUtils.popfilled(); }else if(self.formType == 'trendwall' && AUtils && typeof AUtils.popfilled == 'function'){ AUtils.popfilled(); } return true; } if(['jgcontact','speakercontact'].indexOf(self.formType) != -1){ var url = 'https://www.trendhunter.com/secret/jeremyinquiry'; window.location.href = url; return true; } self.redirectToThankYou(step); } this.doEmailDomainCheckCallback = function($form, step){ var params = {act:'pu-ed-c',e:self.step1Email,r:self.step1EmailDomain}; var $req = THH.ajax(params,'POST',false); $req .always(function(r){ self.popLoader(false); }) .done(function(r){ if(!r.success){ error(r.data); return false; } self.validEmailDomain = 1; $('#'+self.formId+'-'+step).submit(); }); } this.doEventCallback = function($form, step){ var ffEids = $form.find('.form__eventsCont input[name="event-ff[]"][type="checkbox"]:checked').map( function(){return $(this).val();} ).get(); var webinarEids = $form.find('.form__eventsCont input[name="event-webinar[]"][type="checkbox"]:checked').map( function(){return $(this).val();} ).get(); if(!ffEids.length && !webinarEids.length){ self.popLoader(false); Prompt.alert('Please check a box in order to register for an event.'); return false; } var params = {act:'pu-e-su', eids:ffEids,weids:webinarEids,e:self.step1Email}; if(step == 3){ if(self.step2FirstName && self.step2LastName){ params['fn'] = self.step2FirstName; params['ln'] = self.step2LastName; } } var $req = THH.ajax(params,'POST',false); $req .always(function(r){ self.popLoader(false); }) .done(function(r){ if(!r.success){ error('There was an error submitting your request.
Please contact us via https://www.trendhunter.com/contact if this continues.'); return false; } //inject into the form: event-person-hash ,evens-tickets var eventTickets = r.data.eventStr; // eventPersonHash = r.data.personHash; self.callbackEventData = {'ff':ffEids,'w':webinarEids}; self.track('free_report','free_event_signup',JSON.stringify(self.callbackEventData),function(){ $('#'+self.formId+'-'+step).submit(); }); $form.append(""); // $form.append(""); }); } this.doSubmitTracking = function(step){ var category = "free_report", action = "free_report_submit_step"+step, label = self.variation; if(step == 1){ self.submitTrackingFired1 = true; self.trackLinkedIn(); if(window.location.href.toLowerCase().indexOf('futurefestival.com') != -1){ gtag('event', 'conversion', {'send_to': 'AW-1068445809/vCJHCL715O0CEPHgvP0D'}); }else if( window.location.href.toLowerCase().indexOf('trendreports.com') != -1 || window.location.pathname.toLowerCase() == '/trendreports' ){ gtag('event', 'conversion', {'send_to': 'AW-1068445809/xKtJCKHrvO0CEPHgvP0D'}); } }else if(step == 2){ self.submitTrackingFired2 = true; }else if(step == 3){ self.submitTrackingFired3 = true; } var pop = self; self.track(category,action,label,function(){ var $req = self.trackInternal("step"+step+"submit"); if($req){ $req.always(function(){ $('#'+self.formId+'-'+step).submit(); }); }else{ $('#'+self.formId+'-'+step).submit(); } }); }; this.trackLinkedIn = function(){ /*$('body').append("");*/ }; this.track = function(category, action, label, url){ if(typeof CPage != 'undefined' && typeof CPage.gevent == 'function'){ CPage.gevent(category,action,label,url); }else if(typeof url == 'function'){ url(); } }; this.companyTypeChange = function(){ var $form = $("#"+self.formId+"-"+self.currentStep), companyType = $form.find("[name='company_type']").val(), $cont = $form.find('.lp__formInterestCont'), $callType = $form.find("[name='call_type']"), $companyNameText = $form.find("[name='company_type_text']"); $callType.val(0); $companyNameText.val(0); if(companyType != 0){ self.companyType = companyType; var $option = $form.find("[name='company_type'] option[value='"+companyType+"']"), callType = $option.data('call'), optionText= $option.text(); $companyNameText.val(optionText); $callType.val(callType); } $cont.empty(); return; if(companyType != 'largebrand'){ $cont.empty(); return; } var html = [ "
", "
LARGE BRANDS - If you're an existing client or prospect, we can send you a FREE sample in your category. What topics do you like?
", "", "
" ].join(""); $cont.html(html); }; this.checkEmail = function(step){ var $form = $("#"+self.formId+"-"+step), email = $.trim($form.find("[name='email']").val()), regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/, companyType = $form.find("[name='company_type']").val(); if(!email.length || !regex.test(email)){ Prompt.alert('You must provide a real email'); return false; } return true; }; this.checkRequiredAll = function(){ var fields = $('#'+self.formId+"-"+self.currentStep).find(":not(:hidden)").serializeArray(), goodFields = true; $('#'+self.formId+'-'+self.currentStep+' .lp__formInput--highlight').removeClass('lp__formInput--highlight'); for(var i in fields){ var field = fields[i], fieldName = field.name, fieldValue = field.value; if(fieldValue == 0 || fieldValue == "0" || $.trim(fieldValue).length == 0){ goodFields = false; $("[name='"+fieldName+"']").addClass('lp__formInput--highlight'); } } if(!goodFields){ Prompt.alert('Please fill out all form fields.'); return false; } return true; }; this.checkAutoload = function(){ /* check if they have the cookie if yes, do nothing if no if trends page and document.referrer is not google then deploy else if trends page and document.referrer is google then add exit intent call else if any other page then deploy autoload only fires after cookie comes back from member hook */ var isProtrendsPage = window.location.pathname.indexOf('/protrends/') != -1; if($('.body--nopop').length || isProtrendsPage){ return false; } if(typeof window.memberInfoHooks == 'undefined'){ window.memberInfoHooks = []; } window.memberInfoHooks.push(self.checkCookie); var ref = document.referrer ? document.referrer : "", refIsGoogle = ref.indexOf('google') !== -1 ? true : false, uaIsGoogle = navigator && navigator.userAgent && navigator.userAgent.toLowerCase().indexOf('googlebot') != -1 ? true : false, isMagazine = $('.thm.th__magazine').length ? true : false, trendsPages = ['keynote','course','protrends','slideshow','trends'], isTrendPage = false, path = window.location.pathname ? window.location.pathname : ""; self.isArchived = $('.tha[data-ok="1"]').length; for(var i in trendsPages){ if(path.indexOf("/"+trendsPages[i]+"/") != -1){ isTrendPage = true; break; } } if((isTrendPage || isMagazine) && (refIsGoogle || uaIsGoogle)){ this.exitIntentAutoload = true; } }; this.checkCookie = function(data){ // console.log(data); //delay so we can see if the hcamp is deployed if(self.checkCookieFirst){ self.checkCookieFirst = false; setTimeout(function(){ self.checkCookie(data); },50); return; } //if the header bar exists and this is mobile, don't force the pop up var hcamp = $('.hcamp:not(.hcamp--bottom)').length; if(window.innerWidth <= 810 && hcamp){ console.log('top header bar exists on mobile, don\'t do pop up'); return false; } var pa = 'report'; if(THH && THH.pa){ pa = THH.pa; } if(THH && THH.pad){ var host = window.location.host; for(var h in THH.pad){ if(host.indexOf(h) != -1){ pa = THH.pad[h]; } } } var bypassCookie = false, anyIntent = false; if(pa == 'ffbuy' && THH.pus[pa] && THH.pus[pa][0]['n'] == 'summerpromo24' && window.location.host.indexOf('futurefestival.com') != -1){ bypassCookie = true; } if((data.pu || self.isArchived) && !bypassCookie){ //console.log('pop up cookie exists, do not deploy'); return false; } //if the pa is set to freeticket but there is no free ticket options default to free report if(pa == 'freeticket' && !THH.evs.length){ pa = 'report'; } if(THH.getArgs.contact && window.location.host.indexOf('futurefestival.com') != -1){ pa = 'ffcontact'; anyIntent = true; } var pData = self.selectPopRandomly(pa,1,anyIntent); if(self.validatePData(pData)){ self.pData = pData; } if(self.exitIntentAutoload){ $(document).on('mouseleave',function(e){ if(!self.exitIntentDeployed){ self.deployPop(); self.setCookie(); self.exitIntentDeployed = true; } }); return false; } self.autoload = true; self.deployPop(); self.setCookie(); }; this.testAutoload = function(type){ self.autoload = true; var autoPopData = self.selectPopRandomly(type,1); if(autoPopData){ self.pData = autoPopData; }else{ console.log('no pu test matching req type, reverting to default'); } self.deployPop(); } this.setCookie = function(){ if(typeof THH != 'undefined' && typeof THH.ajax == 'function'){ THH.ajax({act:'s-pu-c'},'POST',false); } }; this.deployUserClick = function(type){ var type = type || 'report'; self.formType = type; var userPopData = self.selectPopRandomly(type,0); if(userPopData){ self.pData = userPopData; }else{ console.log('no pu matching req type, reverting to default'); } self.deployPop(); }; this.deployInline = function(type,variant){ var pus = THH.pus; if(!THH.pus[type]){ type = 'report'; var popData = self.selectPopRandomly('report', 1,true); }else{ var pops = THH.pus[type], popData = false; if(variant){ for(var i in pops){ var pop = pops[i]; if(pop.n && pop.n == variant){ popData = pop; break; } } } if(!variant || !popData){ popData = self.selectPopRandomly(type,1,true); } } self.pData = popData; self.formType = type; self.isInline = true; self.deployPop(); }; this.selectPopRandomly = function(type, isAuto, anyIntent){ var type = type || 'report'; var isAuto = isAuto || 0; var intent = isAuto ? 'auto' : 'user'; var anyIntent = anyIntent || false; if(!THH.pus || !THH.pus[type] || typeof THH.pus[type] != 'object'){ console.log('no pus of matching type'); if(type == 'report'){ return false; } //if it's not type of report, try to recurse back to report return self.selectPopRandomly('report', isAuto); } var pusByType = THH.pus[type]; var pusByIntent = {'auto':[],'user':[],'all':[]}; for(var i in pusByType){ var pus = pusByType[i]; //au vs aa if(pus.au){ pusByIntent['user'].push(pus); } if(pus.aa){ pusByIntent['auto'].push(pus); } pusByIntent['all'].push(pus); } intent = anyIntent ? 'all' : intent; if(pusByIntent[intent].length == 0 && !THH.previewPP){ console.log('no pus for type and intent'); return self.selectPopRandomly('report',true,1); } if(!THH.previewPP){ pData = pusByIntent[intent][Math.floor(Math.random() * pusByIntent[intent].length)]; }else{ pData = THH.pus[type][0]; } if(!self.validatePData(pData)){ return false; } self.formType = type; return pData; } this.validatePData = function(pData){ var reqFields = ['vid','n'], reqFields2 = ['p1bt','p1img','p1t1']; var valid = true; for(var i in reqFields){ if(!pData[reqFields[i]] || !pData[reqFields[i]].toString().length){ console.log('invalid pdata: ',reqFields[i]); valid = false; } } var data = pData.d ? pData.d : []; for(var i in reqFields2){ if(!data[reqFields2[i]] || !data[reqFields2[i]].length){ console.log('invalid pdata: ',reqFields2[i]); valid = false; } } if(data.length && !parseInt(data.step2_disabled)){ var step2Required = ['p2bt','p2fh','p2img','p2t1']; for(var i in step2Required){ if(!data[step2Required[i]] || !data[step2Required[i]].length){ console.log('invalid step2 pdata: ', step2Required[i]); valid = false; } } } if(data.length && data.step3_enabled){ var step3Required = ['step3_btn','step3_formHandler','step3_img','step3_nothanks','step3_text']; for(var i in step3Required){ if(!data[step3Required[i]] || !data[step3Required[i]].length){ console.log('invalid step3 pdata: ', step3Required[i]); valid = false; } } } if(!valid){ console.log('invalid p data'); } return valid; }; this.trackInternal = function(trackType){ if(!self.vid){ return false; } var params = {}; params['auto'] = this.trackCategoryAuto; params['vid'] = self.vid; params['track'] = trackType; params['act'] = 'thh-tpi'; return THH.ajax(params,'POST',false); } this.makeEventHtml = function(step){ if(!self.events.length){ return ""; } var eventHtml = ""; var eventSels = []; var zSels = {}; var eventTimeZone = 'EST'; for(var i in self.events){ var ev = self.events[i], eventId = ev.eid, eventName = ev.en, eventDate = ev.d; eventTime = ev.t; eventType = ev.type, eventGroup = ev.gt, eventTimeStart = ev.ts, checkedByDefault = ev.c ? " checked='checked' " : ""; eventTimeZone = ev.tz; if(eventType == 'ff'){ eventSels.push([ "
", "", "", "
" ].join("")); } if(eventType == 'webinar'){ if(typeof Hash == 'undefined' && eventId == 24){ continue; } if(typeof Hash != 'undefined'){ //Dont show RC Webinar if not on that page if(eventId == 24 && Hash.hash.v != 24){ continue; } // Dont show TH Webinar if on RC page if(Hash.hash.v == 24 && eventId != 24){ continue; } } eventSels.push([ "
", "", "", "
" ].join("")); } if(eventType == 'zoom-meet'){ if(!zSels[eventGroup]){ zSels[eventGroup] = {}; } if(!zSels[eventGroup][eventDate]){ zSels[eventGroup][eventDate] = []; } zSels[eventGroup][eventDate].push([ "
", "", "", "
" ].join("")); } } var egHtml = []; for(var g in zSels){ var dSels = zSels[g], dHtml = []; for(var d in dSels){ var sels = dSels[d], selHtml = sels.join(""); dHtml.push([ "
", "
"+d+" - All Times in "+eventTimeZone+"
", "
"+selHtml+"
", "
" ].join("")); } egHtml.push([ "
", "
"+g+"
", "
"+dHtml.join("")+"
", "
" ].join("")); } var eventSelHtml = eventSels.join(""); if(egHtml.length){ egHtml = "
"+egHtml.join("")+"
"; if(eventSels.length){ eventSelHtml = [ "
", "
Webinars
", "
"+eventSelHtml+"
", "
" ].join(""); } }else{ egHtml = ""; } eventHtml = "
"+egHtml+eventSelHtml+"
"; return eventHtml; }; this.makeJGInterestHtml = function(){ var selections = [ {'label':"Jeremy Gutsche's Keynotes", 'val':'jgkeynote'}, {'label':"Trend Hunter's Team of Speakers", 'val':'speakerteam'}, {'label':"Workshop Programs", 'val':'workshops'}, {'label':"Innovation Assessment", 'val':'assessment'}, {'label':"Custom Research", 'val':'customresearch'}, {'label':"Other", 'val':'other'} ]; var sels = []; for(var i in selections){ var selection = selections[i]; sels.push([ "
", "", "", "
" ]); } interests = "
"+sels.join("")+"
"; return interests; }; this.makeFFInterestHtml = function(){ var selections = [ {'label':"Agenda and Content", 'val':'agenda'}, {'label':"Custom Research Bundles", 'val':'customresearch'}, {'label':"Team Building & Experience", 'val':'teambuilding'}, {'label':"Workshop Programs", 'val':'workshops'}, {'label':"Travel Tips", 'val':'traveltips'}, {'label':"Follow-Up Programs, Post-Event", 'val':'followup'}, {'label':"Futurist Certification", 'val':'certification'}, {'label':"Other", 'val':'otherinterests'} ]; var sels = []; for(var i in selections){ var selection = selections[i]; sels.push([ "
", "", "", "
" ]); } var interests = "
"+sels.join("")+"
"; return interests; }; this.deployPop = function(){ self.guid = this.makeGuid(); if(self.pData){ self.parsePData(); } if(THH.evs.length){ self.parseEvents(THH.evs); } if(self.autoload){ self.track('free_report','free_report_auto_pop',self.variation); self.trackCategoryAuto = 1; }else if(self.exitIntentAutoload){ self.track('free_report','free_report_exit_pop',self.variation); self.trackCategoryAuto = 1; }else{ self.track('free_report','free_report_user_pop',self.variation); } self.trackInternal('step1impression'); var autoloadClass = self.autoload && !self.forceAutoload ? "lp__formPopCont--autoload" : ""; self.closePop(); //remove old pop var eventHtml = ""; if(self.step1HasEvents){ eventHtml = self.makeEventHtml(1); } var awcHtml = ""; if(THH.awc){ self.awc = THH.awc; awcHtml = ""; } var radioSection = ""; var newsletterLabel = "Get the Weekly Trend Report and a Trend Hunter Dashboard Account FREE - View Terms", newsletterFieldName = "newsletter", jgMoreInfo = ""; if(['jgcontact','speakercontact'].indexOf(self.formType) != -1){ var firstOption = ""; if(self.formType == 'speakercontact'){ firstOption = ""; } radioSection = [ "
", "
Please select a topic:
", "
", firstOption, "
", "
", "", "", "
", "
", "", "", "
", "
", "", "", "
", "
" ].join(""); newsletterLabel = self.formType == 'speakercontact' ? "Get the "+THH.fry+" Trend Report, Weekly Report and a FREE Dashboard Account - View Terms" : "Get Jeremy's "+THH.fry+" Trend Report, Weekly Report and a FREE Trend Hunter Dashboard Account - View Terms"; newsletterFieldName = "free_report"; var meUs = self.formType == 'speakercontact' ? 'us' : 'me'; jgMoreInfo = [ "
Please let "+meUs+" know your event details, contact info and a good time to chat.
", "" ].join(""); } if(['ffcontact'].indexOf(self.formType) != -1){ var radios = [ {val:'general',lbl:'General Inquiry'}, {val:'groupdiscounts',lbl:'Group Discounts'}, {val:'trendsafari',lbl:'Trend Safaris and Workshops'}, {val:'other',lbl:'Other / Sponsorship / Media'} ]; var radioHtml = []; for(var i in radios){ var r = radios[i], rNum = parseInt(i)+1; radioHtml.push( "
", "", "", "
"); } radioSection = [ "
", "
Please select a topic:
", radioHtml.join(""), "
" ].join(""); jgMoreInfo = [ "
Please let us know your question and a good time to chat
", "" ].join(""); } if(['assessmentcontact'].indexOf(self.formType) != -1){ var radios = [ {val:'discoveremployees',lbl:'Discover how employees view your organization from a culture & innovation perspective'}, {val:'uncovergaps',lbl:'Uncover any gaps across employee demographics (gender, demographics, location)'}, {val:'diagnose',lbl:'Diagnose key gaps/opportunities in your team'}, {val:'hire',lbl:'Hire / add more though diversity to your team'} ]; var radioHtml = []; for(var i in radios){ var r = radios[i], rNum = parseInt(i)+1; radioHtml.push( "
", "", "", "
"); } radioSection = [ "
", "
Why Get a Team Analysis:
", radioHtml.join(""), "
" ].join(""); jgMoreInfo = [ "
Any additional context? We'll be in touch shortly!
", "" ].join(""); } var inlineClass = self.isInline ? "lp__formPopCont--inline" : ""; if(self.form1Image.indexOf("?") == -1){ self.form1Image = self.form1Image + "?auto=webp"; } var accountCheckbox = "
"; var submitButton = ""; var emailInput = ""; var captcha = self.formType == 'trendwall' ? '
' : ""; if(self.directActionLink){ accountCheckbox = ""; emailInput = ""; submitButton = ""; } var popHtml = [ "
", "
", "
", "
", "
", "Trend Report Pop Up", "
", "
", "close", "
", "
", "
", "Trend Report Pop Up", "
", "
", self.s1t1, "
", "
", "
", "", "", "", "", "
"+self.s1t2+"
", radioSection, awcHtml, eventHtml, "
", emailInput, jgMoreInfo, captcha, submitButton, "", accountCheckbox, "
", "
", "", "
", "
", "
", "
", "
", "
" ].join(""); /* "
", */ if(self.isInline){ $('.pl__inlineContainer').html(popHtml); }else if(self.formType == 'insights' && $('.tpt').length){ console.log('insights form append'); $('.tpt').append(popHtml); }else if(self.formType == 'trendwall' && $('.tha').length){ $('.tha__outer').append(popHtml); if(typeof grecaptcha != 'object'){ var script = document.createElement('script'); script.setAttribute('type','text/javascript'); script.setAttribute('src','https://www.google.com/recaptcha/api.js'); document.getElementsByTagName("head")[0].appendChild(script); } }else if($('.th__header').length == 0){ $('body').append(popHtml); }else{ $('.thh__inner').prepend(popHtml); $('.thh').addClass('thh--popformincluded'); } $('.lp__formPopCont') .find('#'+self.formId+"-1").on('submit',self.submit1) .end() .find('.lp__formPopClose,.form1__noText').on('click', function(){self.userClosePop(self.currentStep)}); $('.lp__formPop').on('click',function(){self.userClosePop(self.currentStep);}); $('.lp__formPopInner').on('click',function(e){ e.stopPropagation(); if($(this).parents('.lp__formPopCont--autoload').length){ $(this).parents('.lp__formPopCont--autoload').removeClass('lp__formPopCont--autoload') } }); if(this.formType == 'thgpttrial'){ $('#'+self.formId+"-1 [name='newsletter']").on('click',(e)=>{ e.preventDefault(); Prompt.alert('A Dashboard account is required to access the Trend Hunter GPT Trial.'); }); } }; this.goToStep2 = function(){ self.trackInternal('step2impression'); self.track('free_report','free_report_step2_started',self.variation); var newsletterLabel = "Get the Weekly Trend Report and a Trend Hunter Dashboard Account FREE - View Terms", newsletterFieldName = "newsletter"; //there is no step 2 jg or speaker right now if(['jgcontact','speakercontact'].indexOf(self.formType) != -1){ newsletterLabel = self.formType == 'speakercontact' ? "Get the "+THH.fry+" Trend Report & Weekly Report" : "Get Jeremy's "+THH.fry+" Trend Report & Weekly Report"; newsletterFieldName = "free_report"; } var newsletterRow = [ "
", "
", "
" ].join(""); if(self.step1NewsletterChecked){ /* i don't think we need it being present at all for the second step */ newsletterRow = "";//""; } var emailHiddenTag = "", emailHidden = "", emailFieldName = 'email'; if(self.step1Email.length){ emailHidden = emailHiddenTag; emailFieldName = 'email2'; } var step2Html = [ "