var qsRegex; var $grid; $(document).ready(function() { initGrid(); langDetect(); linkUpdate(); createObservers(); }); function initGrid() { $grid = $('.grid').isotope({ itemSelector: '.element-item', layoutMode: 'fitRows', filter: function() { var qsr = qsRegex; if ( qsr != undefined ) { if ( $(this).text().match( qsRegex ) != null ) { // case where filter matches but still hidden by unscrolled content if ($(this).attr('class').match(/gwd\-scroll\-hidden/g) ) { $(this).removeClass('gwd-scroll-hidden'); $(this).addClass('gwd-scroll-hidden-filter-show'); // case where filter matches but does not have a scroll-hidden class } else if ( $(this).attr('class').match(/gwd\-scroll\-hidden/g) ) { // $(_this).addClass('gwd-filter-show'); } // cae where tile is not matching filter (visibility: off) } else { // case where filter matches but still hidden by unscrolled content if ($(this).attr('class').match(/gwd\-scroll\-hidden\-filter\-show/g) ) { $(this).addClass('gwd-scroll-hidden'); $(this).removeClass('gwd-scroll-hidden-filter-show'); // case where filter matches but does not have a scroll-hidden class } } } return qsr ? $(this).text().match( qsRegex ) : true; }, }); } function langDetect( lang, path ) {} lang_pref = 'en_us'; // default function linkUpdate() {} var $quicksearch = $('.quicksearch').keyup( debounce( function() { initGrid(); qsRegex = ($quicksearch.val().length > 0) ? new RegExp( $quicksearch.val(), 'gi' ) : undefined; $grid.isotope(); }, 200 ) ); function skillClick( e, _filter, _reset ) { if (!_reset) { _reset = false; } qsa('.quicksearch')[0].value=''; if ( _reset ) { Object.keys(qsa('.btn-active')).forEach(function(e) { qsa('.btn-active')[e].classList.remove('btn-active'); }); $grid.isotope({filter: '*'}); return; } if ( ! e.currentTarget.classList.contains('btn-active') ) { Object.keys(qsa('.btn-active')).forEach(function(e) { qsa('.btn-active')[e].classList.remove('btn-active'); }); e.currentTarget.classList.add('btn-active'); $grid.isotope({filter: _filter}); } else { Object.keys(qsa('.btn-active')).forEach(function(e) { qsa('.btn-active')[e].classList.remove('btn-active'); }); e.currentTarget.classList.remove('btn-active'); $grid.isotope({filter: '*'}); } return; } function filterTiles( v ) { initGrid(); qsRegex = new RegExp( v, 'gi' ); $grid.isotope(); } function debounce( fn, threshold ) { var timeout; threshold = threshold || 100; return function debounced() { clearTimeout( timeout ); var args = arguments; var _this = this; function delayed() { fn.apply( _this, args ); } timeout = setTimeout( delayed, threshold ); }; } // mutation observation of glue-carousels var targetNodes=[]; var MutationObserver; var gwdObservers=[]; var obsConfig; function createObservers( idx ) { if (!idx) { idx = null; } if ( gwdObservers[0] ) gwdObservers[0].disconnect(); if ( gwdObservers[1] ) gwdObservers[1].disconnect(); targetNodes[0] = $('.glue-carousel'); targetNodes[1] = $('.gwd-glue-carousel'); MutationObserver = window.MutationObserver || window.WebKitMutationObserver; gwdObservers[0] = gwdObservers[1] = new MutationObserver ( debounce ( mutationHandler, 15 ) ); obsConfig = { childList: true, characterData: true, attributes: true, subtree: true }; if ( idx == null || idx === 0 ) { targetNodes[0].each ( function () { gwdObservers[0].observe(this, obsConfig); } ); } if ( idx == null || idx == 1 ) { targetNodes[1].each ( function () { gwdObservers[1].observe(this, obsConfig); } ); } } var mutationCounter = { i:0, f:0, a:0, w:0, fc:0 }; function mutationHandler ( mutationRecords ) { mutationRecords.forEach ( function (mutation) { var _id = mutation.target.id.split('car-')[1]; mutationCounter[_id] += 1; // feature carousels if (mutation.type === 'attributes' && mutation.target.id.indexOf('gwd-car-') !== -1 && mutationCounter[_id] >= 5 ) { debounce(vC( _id, true, true ), 1000); } // format carousel else if (mutation.type === 'attributes' && mutation.target.className.indexOf('gwd-format-item') !== -1 ) { var _id = 'fc'; mutationCounter[_id] += 1; if ( mutationCounter[_id] <= 23 ) { if ( mutationCounter[_id] == 6 ) { mutationCounter[_id] = 0; debounce( changeMarquee(), 0); } } } } ); } var format_marquees = ['Static Panorama','Video Lightbox','Static Cue Cards','Youtube Map Lightbox','Static Parallax']; function changeMarquee( ) { if ( qsa('.gwd-format-nav-list')[0] && qsa('.gwd-format-nav-list')[0].childNodes != null ) { _e = [qsa('.gwd-format-nav-list')[0].getElementsByTagName('button')]; _e.forEach( function(e) { var _em = qsa('.gwd-format-nav-list')[e]; }); } setTimeout(cb, 150); function cb() { Object.keys(qsa('.gwd-format-nav-list')[0].getElementsByTagName('li')).forEach( function(e) { var _pem = ( e > 0 ) ? qsa('.gwd-glue-carousel')[0].getElementsByTagName('li')[e-1] : 0; var _em = qsa('.gwd-format-nav-list')[0].getElementsByTagName('button')[e]; var _nem = ( e < 4 ) ? qsa('.gwd-glue-carousel')[0].getElementsByTagName('li')[e+1] : 0; if ( ( _em != null) && ( _em.hasAttribute('aria-selected') ) && ( _em.getAttribute('aria-selected').valueOf() === 'true' ) ) { if ( qs('#marquee').innerHTML != format_marquees[e]) qs('#marquee').innerHTML = format_marquees[e]; if ( _pem != undefined && e > 0 ) _pem.setAttribute('aria-hidden', 'false'); if ( _nem != undefined && e < 4 ) _nem.setAttribute('aria-hidden', 'false'); } if ( qs('#gwd-car-wrap').style.opacity.valueOf() === '' ) setTimeout( function() { fader('gwd-car-wrap', 0, 1, 700, new Date().getTime()) }, 200); }); } } // var aniPlayed_3; var cnt= 0; function scrollReveal() { var items = []; var lim = 3; var idx = 0; Object.keys(qsa('.gwd-scroll-hidden')).forEach( function(e) { cnt++; if ( idx < lim ) { var _ele = qsa('.gwd-scroll-hidden')[e]; var _e = _ele.cloneNode(true); _e.classList.remove('gwd-scroll-hidden'); _e.style.display = 'flex'; $('.grid').isotope('remove', _ele ); $('.grid').isotope('insert', _e ); _ele.style.display = 'none'; _ele.classList.remove('gwd-scroll-hidden'); idx++; } else { // idx = 0; } }); $('.grid').isotope('insert', items ); idx = 0; } function runBoundaryTests() { Object.keys(feat_videos).forEach( function(e) { var es = e.split('')[0]; // element section if ( qs(es+'Vid') === null ) return; if ( isInViewport( '#' + es + 'Vid') ) { gwdPlay( es + 'Vid', false, false); qs( es +'Vid').classList.add('gwd-fadein'); } else { if ( qs( es +'Vid') != null ) qs( es +'Vid').pause(); } }); // infinite scroll if ( qs('#gwd-scrollBound') ) { if ( isInViewport( qs('gwd-scrollBound'))) { debounce(scrollReveal(),500); } } // ideas to life (upper) animation if ( qs('#bound_test_1') ) { _div2 = qs('#bound_test_1') var bounding = _div2.getBoundingClientRect(); if ( isInViewport(_div2) ) { if ( ! aniPlayed_2 ) { // window.clearInterval( _iL2 ); aniPlayed_2 = true; setTimeout(function() { fader('gwd-life_bg', 0, 1, 600, new Date().getTime()); }, 1000); setTimeout(function() { fader('gwd-life_fg', 0, 1, 1000, new Date().getTime()); }, 600); } } else { } } // footer focus design/develop animation if ( qs('#gwd-focus-img') ) { _div = qs('#gwd-focus-img') var bounding = _div.getBoundingClientRect(); if ( isInViewport(_div) ) { if ( ! aniPlayed_1 ) { aniPlayed_1 = true; setTimeout(function() { fader('gwd-focus_bg', 0, 1, 600, new Date().getTime()); }, 1000); setTimeout(function() { fader('gwd-focus_codes', 0, 1, 600, new Date().getTime()); }, 1000); setTimeout(function() { fader('gwd-focus_mrec', 0, 1, 1000, new Date().getTime()); }, 600); } } else { } } } if ( qs('#marquee') ) { changeMarquee(); } kintaro_translations = [ 'de_de', 'en-GB', 'es_es', 'es-419', 'fr_fr', 'it_it', 'ja_jp', 'ko_ko', 'nl_nl', 'pl_pl', 'pt-BR', 'ru_ru', 'th_th', 'tr_tr', 'zh_cn', 'zh-TW' ] locale_aliases = { 'en_ALL': 'en_us', 'de_ALL': 'de_de', 'fr_ALL': 'fr_fr', 'ja_ALL': 'ja_jp', 'es_ALL': 'es_es', 'fr_ALL': 'fr_fr', 'it_ALL': 'it_it', 'ko_ko': 'ko_ALL', 'nl_ALL':'nl_nl', 'pl_ALL': 'pl_pl', 'pt-BR_ALL': 'pt-BR', 'ru_ALL': 'ru_ru', 'th_ALL': 'th_th', 'tr_ALL': 'tr_tr', 'zh-CN_ALL': 'CN_ALL' }