1/** 2 * Load utils - BEGIN 3 */ 4/* 5 CSS Browser Selector 1.0 6 Originally written by Rafael Lima (http://rafael.adm.br) 7 http://rafael.adm.br/css_browser_selector 8 License: http://creativecommons.org/licenses/by/2.5/ 9 10 Co-maintained by: 11 https://github.com/ridjohansen/css_browser_selector 12 https://github.com/wbruno/css_browser_selector 13 */ 14 15"use strict"; 16 17window.requestAnimFrame = (function() { 18 return window.requestAnimationFrame || 19 window.webkitRequestAnimationFrame || 20 window.mozRequestAnimationFrame || 21 window.oRequestAnimationFrame || 22 window.msRequestAnimationFrame || 23 function(/* function */ callback, /* DOMElement */ element){ 24 window.setTimeout(callback, 1000 / 60); 25 }; 26})(); 27 28window.requestTimeout = function(fn, delay) { 29 if( !window.requestAnimationFrame && 30 !window.webkitRequestAnimationFrame && 31 !(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support 32 !window.oRequestAnimationFrame && 33 !window.msRequestAnimationFrame) 34 return window.setTimeout(fn, delay); 35 36 var start = new Date().getTime(), 37 handle = new Object(); 38 39 function loop(){ 40 var current = new Date().getTime(), 41 delta = current - start; 42 43 delta >= delay ? fn.call() : handle.value = requestAnimFrame(loop); 44 }; 45 46 handle.value = requestAnimFrame(loop); 47 return handle; 48}; 49 50window.clearRequestTimeout = function(handle) { 51 if ( typeof handle !== 'undefined' ) { 52 window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) : 53 window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) : 54 window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */ 55 window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) : 56 window.oCancelRequestAnimationFrame ? window.oCancelRequestAnimationFrame(handle.value) : 57 window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) : 58 clearTimeout(handle); 59 } 60}; 61 62var uaInfo = { 63 ua: '', 64 is: function(t) { 65 return RegExp(t, "i").test(uaInfo.ua); 66 }, 67 version: function(p, n) { 68 n = n.replace(".", "_"); 69 var i = n.indexOf('_'), 70 ver = ""; 71 while (i > 0) { 72 ver += " " + p + n.substring(0, i); 73 i = n.indexOf('_', i + 1); 74 } 75 ver += " " + p + n; 76 return ver; 77 }, 78 getBrowser: function() { 79 var g = 'gecko', 80 w = 'webkit', 81 c = 'chrome', 82 f = 'firefox', 83 s = 'safari', 84 o = 'opera', 85 a = 'android', 86 bb = 'blackberry', 87 dv = 'device_', 88 ua = uaInfo.ua, 89 is = uaInfo.is; 90 return [ 91 (!(/opera|webtv/i.test(ua)) && /msie\s(\d+)/.test(ua)) ? ('ie ie' + (/trident\/4\.0/.test(ua) ? '8' : RegExp.$1)) 92 : is('edge\/') ? 'edge ie' + (/edge\/(\d+)\.(\d+)/.test(ua) ? RegExp.$1 + ' ie' + RegExp.$1 + '_' + RegExp.$2 : '') // IE Edge 93 : is('trident\/') ? 'ie ie'+ (/trident\/.+rv:(\d+)/i.test(ua) ? RegExp.$1 : '') //ie11+ 94 : is('firefox/') ? g + " " + f + (/firefox\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) ? ' ' + f + RegExp.$2 + ' ' + f + RegExp.$2 + "_" + RegExp.$4 : '') 95 : is('gecko/') ? g 96 : is('opera') ? o + (/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) ? ' ' + o + RegExp.$2 + ' ' + o + RegExp.$2 + "_" + RegExp.$4 : (/opera(\s|\/)(\d+)\.(\d+)/.test(ua) ? ' ' + o + RegExp.$2 + " " + o + RegExp.$2 + "_" + RegExp.$3 : '')) 97 : is('konqueror') ? 'konqueror' 98 : is('blackberry') ? (bb + (/Version\/(\d+)(\.(\d+)+)/i.test(ua) ? " " + bb + RegExp.$1 + " " + bb + RegExp.$1 + RegExp.$2.replace('.', '_') : (/Blackberry ?(([0-9]+)([a-z]?))[\/|;]/gi.test(ua) ? ' ' + bb + RegExp.$2 + (RegExp.$3 ? ' ' + bb + RegExp.$2 + RegExp.$3 : '') : ''))) // blackberry 99 : is('android') ? (a + (/Version\/(\d+)(\.(\d+))+/i.test(ua) ? " " + a + RegExp.$1 + " " + a + RegExp.$1 + RegExp.$2.replace('.', '_') : '') + (/Android (.+); (.+) Build/i.test(ua) ? ' ' + dv + ((RegExp.$2).replace(/ /g, "_")).replace(/-/g, "_") : '')) //android 100 : is('chrome') ? w + ' ' + c + (/chrome\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) ? ' ' + c + RegExp.$2 + ((RegExp.$4 > 0) ? ' ' + c + RegExp.$2 + "_" + RegExp.$4 : '') : '') 101 : is('iron') ? w + ' iron' 102 : is('applewebkit/') ? (w + ' ' + s + (/version\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) ? ' ' + s + RegExp.$2 + " " + s + RegExp.$2 + RegExp.$3.replace('.', '_') : (/ Safari\/(\d+)/i.test(ua) ? ((RegExp.$1 == "419" || RegExp.$1 == "417" || RegExp.$1 == "416" || RegExp.$1 == "412") ? ' ' + s + '2_0' : RegExp.$1 == "312" ? ' ' + s + '1_3' : RegExp.$1 == "125" ? ' ' + s + '1_2' : RegExp.$1 == "85" ? ' ' + s + '1_0' : '') : ''))) //applewebkit 103 : is('mozilla/') ? g : '' 104 ]; 105 }, 106 getPlatform : function() { 107 var wp = 'winphone', 108 a = 'android', 109 bb = 'blackberry', 110 dv = 'device_', 111 112 ua = uaInfo.ua, 113 version = uaInfo.version, 114 is = uaInfo.is; 115 116 return [ 117 is('j2me') ? 'j2me' 118 :is('windows phone') ? (wp + (/Windows Phone (\d+)(\.(\d+))+/i.test(ua) ? " " + wp + RegExp.$1 + " " + wp + RegExp.$1 + RegExp.$2.replace('.', '_') : (/Windows Phone OS (\d+)(\.(\d+))+/i.test(ua) ? " " + wp + RegExp.$1 + " " + wp + RegExp.$1 + RegExp.$2.replace('.', '_') : ''))) // Windows Phone 119 :is('blackberry') ? (bb + (/Version\/(\d+)(\.(\d+)+)/i.test(ua) ? " " + bb + RegExp.$1 + " " + bb + RegExp.$1 + RegExp.$2.replace('.', '_') : (/Blackberry ?(([0-9]+)([a-z]?))[\/|;]/gi.test(ua) ? ' ' + bb + RegExp.$2 + (RegExp.$3 ? ' ' + bb + RegExp.$2 + RegExp.$3 : '') : ''))) // blackberry 120 :is('android') ? (a + (/Version\/(\d+)(\.(\d+))+/i.test(ua) ? " " + a + RegExp.$1 + " " + a + RegExp.$1 + RegExp.$2.replace('.', '_') : '') + (/Android (.+); (.+) Build/i.test(ua) ? ' ' + dv + ((RegExp.$2).replace(/ /g, "_")).replace(/-/g, "_") : '')) //android 121 :is('ipad|ipod|iphone') ? ( 122 (/CPU( iPhone)? OS (\d+[_|\.]\d+([_|\.]\d+)*)/i.test(ua) ? 'ios' + version('ios', RegExp.$2) : '') + ' ' + (/(ip(ad|od|hone))/gi.test(ua) ? RegExp.$1 : "")) //'iphone' 123 //:is('ipod')?'ipod' 124 //:is('ipad')?'ipad' 125 :is('playbook') ? 'playbook' 126 :is('kindle|silk') ? 'kindle' 127 :is('playbook') ? 'playbook' 128 :is('mac') ? 'mac' + (/mac os x ((\d+)[.|_](\d+))/.test(ua) ? (' mac'
128+ (RegExp.$2) + ' mac' + (RegExp.$1).replace('.', "_")) : '') 129 :is('win') ? 'win' + (is('windows nt 10.0') ? ' win10' 130 :is('windows nt 6.3') ? ' win8_1' 131 :is('windows nt 6.2') ? ' win8' 132 :is('windows nt 6.1') ? ' win7' 133 :is('windows nt 6.0') ? ' vista' 134 :is('windows nt 5.2') || is('windows nt 5.1') ? ' win_xp' 135 :is('windows nt 5.0') ? ' win_2k' 136 :is('windows nt 4.0') || is('WinNT4.0') ? ' win_nt' : '') 137 :is('freebsd') ? 'freebsd' 138 :is('x11|linux') ? 'linux' : '' 139 ]; 140 }, 141 getMobile: function() { 142 var is = uaInfo.is; 143 return [ 144 is("android|mobi|mobile|j2me|iphone|ipod|ipad|blackberry|playbook|kindle|silk") ? 'mobile' : '' 145 ]; 146 }, 147 getIpadApp: function() { 148 var is = uaInfo.is; 149 return [ 150 (is('ipad|iphone|ipod') && !is('safari')) ? 'ipad_app' : '' 151 ]; 152 }, 153 getLang: function() { 154 var ua = uaInfo.ua; 155 return [/[; |\[](([a-z]{2})(\-[a-z]{2})?)[)|;|\]]/i.test(ua) ? ('lang_' + RegExp.$2).replace("-", "_") + (RegExp.$3 != '' ? (' ' + 'lang_' + RegExp.$1).replace("-", "_") : '') : '']; 156 } 157} 158var screenInfo = { 159 width: document.documentElement.clientWidth ? document.documentElement.clientWidth + 15 : window.outerWidth, 160 height: document.documentElement.clientHeight || window.outerHeight, 161 screens: [ 162 [340, 'screen-xxs'], 163 [570, 'screen-xs'], 164 [960, 'screen-sm'], 165 [1500, 'screen-md'], 166 [1700, 'screen-lg'], 167 ], 168 screenSize: function() { 169 screenInfo.width = document.documentElement.clientWidth ? document.documentElement.clientWidth + 15 : window.outerWidth; 170 screenInfo.height = document.documentElement.clientHeight || window.outerHeight; 171 var screens = screenInfo.screens, 172 i = screens.length, 173 arr = []; 174 175 while (i--) { 176 if (screenInfo.width >= screens[i][0]) { 177 arr.push(screens[i][1]); 178 } 179 } 180 181 return arr; 182 }, 183 getOrientation: function() { 184 return screenInfo.width < screenInfo.height ? ["orientation_portrait"] : ["orientation_landscape"]; 185 }, 186 getInfo: function() { 187 var arr = []; 188 arr = arr.concat(screenInfo.screenSize()); 189 arr = arr.concat(screenInfo.getOrientation()); 190 return arr; 191 }, 192 getPixelRatio: function() { 193 var arr = [], 194 pixelRatio = window.devicePixelRatio ? window.devicePixelRatio : 1; 195 if (pixelRatio > 1) { 196 arr.push('retina_' + parseInt(pixelRatio) + 'x'); 197 arr.push('hidpi'); 198 } else { 199 arr.push('no-hidpi'); 200 } 201 return arr; 202 } 203} 204var dataUriInfo = { 205 data: new Image(), 206 div: document.createElement("div"), 207 isIeLessThan9: false, 208 getImg: function() { 209 dataUriInfo.data.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; 210 dataUriInfo.div.innerHTML = "<!--[if lt IE 9]><i></i><![endif]-->"; 211 dataUriInfo.isIeLessThan9 = dataUriInfo.div.getElementsByTagName("i").length == 1; 212 return dataUriInfo.data; 213 }, 214 checkSupport: function() { 215 if (dataUriInfo.data.width != 1 || dataUriInfo.data.height != 1 || dataUriInfo.isIeLessThan9) { 216 return ["no-datauri"]; 217 } else { 218 return ["datauri"]; 219 } 220 } 221} 222 223function css_browser_selector(u, ns) { 224 var html = document.documentElement, 225 b = [] 226 ns = ns ? ns : ""; 227 /* ua */ 228 uaInfo.ua = u.toLowerCase(); 229 var browser = uaInfo.getBrowser(); 230 if (browser == 'gecko') browser = (!(window.ActiveXObject) && "ActiveXObject" in window) ? 'ie ie11' : browser; 231 var pattTouch = /no-touch/g; 232 if (pattTouch.test(html.className)) b = b.concat('no-touch'); 233 else b = b.concat('touch'); 234 var pattAdmin = /admin-mode/g; 235 if (pattAdmin.test(html.className)) b = b.concat('admin-mode'); 236 b = b.concat(browser); 237 b = b.concat(uaInfo.getPlatform()); 238 b = b.concat(uaInfo.getMobile()); 239 b = b.concat(uaInfo.getIpadApp()); 240 b = b.concat(uaInfo.getLang()); 241 /* js */ 242 b = b.concat(['js']); 243 /* no animations */ 244 var noAnimations = /no-cssanimations/g; 245 if (noAnimations.test(html.className)) { 246 b = b.concat('no-cssanimations'); 247 } 248 /* pixel ratio */ 249 b = b.concat(screenInfo.getPixelRatio()); 250 /* screen */ 251 b = b.concat(screenInfo.getInfo()); 252 var updateScreen = function() { 253 html.className = html.className.replace(/ ?orientation_\w+/g, "").replace(/ [min|max|cl]+[w|h]_\d+/g, ""); 254 html.className = html.className.replace(/ ?screen-\w+/g, ""); 255 html.className = html.className + ' ' + screenInfo.getInfo().join(' '); 256 } 257 window.addEventListener('resize', updateScreen); 258 window.addEventListener('orientationchange', updateScreen); 259 /* dataURI */ 260 var data = dataUriInfo.getImg(); 261 data.onload = data.onerror = function() { 262 html.className += ' ' + dataUriInfo.checkSupport().join(' '); 263 }
264 /* removendo itens invalidos do array */ 265 b = b.filter(function(e) { 266 return e; 267 }); 268 /* prefixo do namespace */ 269 b[0] = ns ? ns + b[0] : b[0]; 270 html.className = b.join(' ' + ns); 271 return html.className; 272 } 273 // define css_browser_selector_ns before loading this script to assign a namespace 274var css_browser_selector_ns = css_browser_selector_ns || ""; 275// init 276css_browser_selector(navigator.userAgent, css_browser_selector_ns); 277/** 278 * skip-link-focus-fix.js 279 * 280 * Helps with accessibility for keyboard only users. 281 * 282 * Learn more: https://github.com/Automattic/_s/pull/136 283 */ 284(function() { 285 var is_webkit = navigator.userAgent.toLowerCase().indexOf('webkit') > -1, 286 is_opera = navigator.userAgent.toLowerCase().indexOf('opera') > -1, 287 is_ie = navigator.userAgent.toLowerCase().indexOf('msie') > -1; 288 if ((is_webkit || is_opera || is_ie) && document.getElementById && window.addEventListener) { 289 window.addEventListener('hashchange', function() { 290 var id = location.hash.substring(1), 291 element; 292 if (!(/^[A-z0-9_-]+$/.test(id))) { 293 return; 294 } 295 element = document.getElementById(id); 296 if (element) { 297 if (!(/^(?:a|select|input|button|textarea)$/i.test(element.tagName))) { 298 element.tabIndex = -1; 299 } 300 element.focus(); 301 } 302 }, false); 303 } 304})(); 305// Polyfill for creating CustomEvents on IE9/10/11 306// code pulled from: 307// https://github.com/d4tocchini/customevent-polyfill 308// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill 309try { 310 new CustomEvent("test"); 311} catch (e) { 312 var CustomEvent = function(event, params) { 313 var evt; 314 params = params || { 315 bubbles: false, 316 cancelable: false, 317 detail: undefined 318 }; 319 evt = document.createEvent("CustomEvent"); 320 evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); 321 return evt; 322 }; 323 CustomEvent.prototype = window.Event.prototype; 324 window.CustomEvent = CustomEvent; // expose definition to window 325} 326// Evento - v1.0.0 327// by Erik Royall <[email protected]> (http://erikroyall.github.io) 328// Dual licensed under MIT and GPL 329// Array.prototype.indexOf shim 330// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf 331Array.prototype.indexOf || (Array.prototype.indexOf = function(n) { 332 "use strict"; 333 if (null == this) throw new TypeError; 334 var t, e, o = Object(this), 335 r = o.length >>> 0; 336 if (0 === r) return -1; 337 if (t = 0, arguments.length > 1 && (t = Number(arguments[1]), t != t ? t = 0 : 0 != t && 1 / 0 != t && t != -1 / 0 && (t = (t > 0 || -1) * Math.floor(Math.abs(t)))), t >= r) return -1; 338 for (e = t >= 0 ? t : Math.max(r - Math.abs(t), 0); r > e; e++) 339 if (e in o && o[e] === n) return e; 340 return -1 341}); 342var evento = function(n) { 343 var t, e, o, r = n, 344 i = r.document, 345 f = {}; 346 return t = function() { 347 return "function" == typeof i.addEventListener ? function(n, t, e) { 348 n.addEventListener(t, e, !1), f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t].push(e) 349 } : "function" == typeof i.attachEvent ? function(n, t, e) { 350 n.attachEvent(t, e), f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t].push(e) 351 } : function(n, t, e) { 352 n["on" + t] = e, f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t].push(e) 353 } 354 }(), e = function() { 355 return "function" == typeof i.removeEventListener ? function(n, t, e) { 356 n.removeEventListener(t, e, !1), Helio.each(f[n][t], function(o) { 357 o === e && (f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t][f[n][t].indexOf(o)] = void 0) 358 }) 359 } : "function" == typeof i.detachEvent ? function(n, t, e) { 360 n.detachEvent(t, e), Helio.each(f[n][t], function(o) { 361 o === e && (f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t][f[n][t].indexOf(o)] = void 0) 362 }) 363 } : function(n, t, e) { 364 n["on" + t] = void 0, Helio.each(f[n][t], function(o) { 365 o === e && (f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t][f[n][t].indexOf(o)] = void 0) 366 }) 367 } 368 }(), o = function(n, t) { 369 f[n] = f[n] || {}, f[n][t] = f[n][t] || []; 370 for (var e = 0, o = f[n][t].length; o > e; e += 1) f[n][t][e]() 371 }, { 372 add: t, 373 remove: e, 374 trigger: o, 375 _handlers: f 376 } 377}(this); 378// DOM class helper 379(function(window) { 380 'use strict'; 381 // class helper functions from bonzo https://github.com/ded/bonzo 382 function classReg(className) { 383 return new RegExp("(^|\\s+)" + className + "(\\s+|$)"); 384 } 385 // classList support for class management 386 // altho to be fair, the api sucks because it won't accept multiple classes at once 387 var hasClass, addClass, removeClass; 388 if ('classList' in document.documentElement) { 389 hasClass = function(elem, c) { 390 if ( elem !== null && typeof elem !== 'undefined' && typeof elem.classList !== 'undefined' ) return elem.classList.contains(c); 391 }; 392 addClass = function(elem, c) { 393 if ( elem !== null && typeof elem !== 'undefined' && typeof elem.classList !== 'undefined' ) elem.classList.add(c); 394 }; 395 removeClass = function(elem, c) { 396 if ( elem !== null && typeof elem !== 'undefined' && typeof elem.classList !== 'undefined' ) elem.classList.remove(c); 397 }; 398 } else { 399 hasClass = function(elem, c) { 400 if (elem !== null) return classReg(c).test(elem.className); 401 }; 402 addClass = function(elem, c) { 403 if (!hasClass(elem, c)) { 404 if (elem !== null) elem.className = elem.className + ' ' + c; 405 } 406 }; 407 removeClass = function(elem, c) { 408 if (elem !== null) elem.className = elem.className.replace(classReg(c), ' '); 409 }; 410 } 411 412 function toggleClass(elem, c) { 413 var fn = hasClass(elem, c) ? removeClass : addClass; 414 fn(elem, c); 415 } 416 var classie = { 417 // full names 418 hasClass: hasClass, 419 addClass: addClass, 420 removeClass: removeClass, 421 toggleClass: toggleClass, 422 // short names 423 has: hasClass, 424 add: addClass, 425 remove: removeClass, 426 toggle: toggleClass 427 }; 428 // transport 429 if (typeof define === 'function' && define.amd) { 430 // AMD 431 define(classie); 432 } else { 433 // browser global 434 window.classie = classie; 435 } 436 437 window.wrap = function(wrapper, elms) { 438 if (!elms.length) { 439 elms = [elms]; 440 } 441 442 for (var i = elms.length - 1; i >= 0; i--) { 443 var child = (i > 0) ? wrapper.cloneNode(true) : wrapper; 444 var el = elms[i]; 445 446 var parent = el.parentNode; 447 var sibling = el.nextSibling; 448 449 child.appendChild(el); 450 451 if (sibling) { 452 parent.insertBefore(child, sibling); 453 } else { 454 parent.appendChild(child); 455 } 456 } 457 }; 458 459 window.wrapAll = function(wrapper, nodes) { 460 var parent = nodes[0].parentNode; 461 var previousSibling = nodes[0].previousSibling; 462 463 for (var i = 0; nodes.length - i;
463 wrapper.firstChild === nodes[0] && i++) { 464 wrapper.appendChild(nodes[i]); 465 } 466 467 var nextSibling = previousSibling ? previousSibling.nextSibling : parent.firstChild; 468 parent.insertBefore(wrapper, nextSibling); 469 470 return wrapper; 471 }; 472})(window); 473/* From Modernizr */ 474function whichTransitionEvent() { 475 var t; 476 var el = document.createElement('fakeelement'); 477 var transitions = { 478 'transition': 'transitionend', 479 'OTransition': 'oTransitionEnd', 480 'MozTransition': 'transitionend', 481 'WebkitTransition': 'webkitTransitionEnd' 482 } 483 for (t in transitions) { 484 if (el.style[t] !== undefined) { 485 return transitions[t]; 486 } 487 } 488 } 489function whichAnimationEvent() { 490 var t; 491 var el = document.createElement('fakeelement'); 492 var animations = { 493 'animation': 'animationend', 494 'OAnimation': 'oAnimationEnd', 495 'MozAnimation': 'animationend', 496 'WebkitAnimation': 'webkitAnimationEnd' 497 } 498 for (t in animations) { 499 if (el.style[t] !== undefined) { 500 return animations[t]; 501 } 502 } 503 } 504/** 505 * Load utils - END 506 */ 507 508/** 509 * Start main js 510 */ 511(function(window, undefined) { 512 'use strict'; 513 514 // Init variables 515 var bodyTop, 516 scrollbarWidth = false, 517 noScroll = false, 518 boxEvent = new CustomEvent('boxResized'), 519 menuClose = new CustomEvent('menuClose'), 520 menuOpen = new CustomEvent('menuOpen'), 521 bodyBorder = 0, 522 adminBarHeight = 0, 523 boxWidth = 0, 524 boxLeft = 0, 525 parallaxRows, 526 parallaxCols, 527 parallaxHeaders, 528 kenburnsHeaders, 529 kenburnsRows, 530 kenburnsCols, 531 backwashHeaders, 532 backwashRows, 533 backwashCols, 534 visibleRows, 535 headerWithOpacity, 536 speedDivider = SiteParameters.parallax_factor, 537 adminBar, 538 pageHeader, 539 headerVideo, 540 masthead, 541 mastheadMobile, 542 menuMobileTransparent, 543 mastheadMobilePaddingTop = 0, 544 maincontainer, 545 menuwrapper, 546 menuhide, 547 $mainHeader, 548 mainHeader, 549 $mainWrapper, 550 $initBox, 551 menusticky, 552 menuStickyMobile, 553 menuHeight = 0, 554 menuMobileHeight = 0, 555 mainmenu = new Array(), 556 secmenu = new Array(),
557 secmenuHeight = 0, 558 transmenuHeight = 0, 559 header, 560 transmenuel, 561 logo, 562 logoel, 563 logolink, 564 logoMinScale, 565 lastScrollValue = 0, 566 wwidth = uaInfo.getIpadApp() == 'ipad_app' ? document.documentElement.clientWidth : window.innerWidth || document.documentElement.clientWidth, 567 wheight = uaInfo.getIpadApp() == 'ipad_app' ? document.documentElement.clientHeight : window.innerHeight || document.documentElement.clientHeight, 568 mediaQuery = 959, 569 mediaQueryMobile = 569, 570 printDialogOpen = false, 571 isScrolling = false, 572 boxWrapper, 573 docheight = 0, 574 isMobile = wwidth <= mediaQuery, 575 isIE = classie.hasClass(document.documentElement, 'ie') || classie.hasClass(document.documentElement, 'opera12') ? true : false, 576 isFF = classie.hasClass(document.documentElement, 'firefox') ? true : false, 577 isFullPage, 578 isFullPageSnap, 579 isFrontEndEditor, 580 transitionEvent = whichTransitionEvent(), 581 animationEvent = whichAnimationEvent(), 582 footerScroller = false, 583 menuOpened = false, 584 overlayOpened = false, 585 menuMobileTriggerEvent = new CustomEvent('menuMobileTrigged'), 586 resizeTimer_, 587 resizeTimer, 588 hidingTimer, 589 isSplitMenu = false, 590 mainNavMenu, 591 mainNavWrapper, 592 isMobileTransparent = false, 593 isMobileParallaxAllowed = SiteParameters.mobile_parallax_allowed, 594 loadedFonts = new Array(), 595 already_font = false, 596 scrollRowHeight_fix = window.pageYOffset, 597 isQuickView = false, 598 menuStickyMobileOverlay = false, 599 600 checkVisible = function( elm ) { 601 var rect = elm.getBoundingClientRect(); 602 var viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight); 603 return !(rect.bottom < 0 || rect.top - viewHeight >= 0); 604 }, 605 initBox = function() { 606 var bodyBorderDiv = document.querySelectorAll('.body-borders .top-border'); 607 if (bodyBorderDiv.length) { 608 bodyBorder = outerHeight(bodyBorderDiv[0]); 609 } else bodyBorder = 0; 610 UNCODE.isRTL = classie.hasClass(document.body, 'rtl') ? true : false, 611 UNCODE.bodyBorder = bodyBorder; 612 UNCODE.isFrontEndEditor = classie.hasClass(document.body, 'compose-mode') && classie.hasClass(document.body, 'vc_editor'); 613 UNCODE.isFullPage = !UNCODE.isFrontEndEditor && classie.hasClass(document.body, 'uncode-fullpage-slide') && !( UNCODE.isMobile && classie.hasClass(document.body, 'uncode-fp-mobile-disable') && window.innerWidth < 570 ); 614 UNCODE.isFullPageSnap = !UNCODE.isFrontEndEditor && classie.hasClass(document.body, 'uncode-scroll-snap'); 615 if (bodyBorder != 0) { 616 if ( !UNCODE.isFullPage ) { 617 document.documentElement.style.paddingTop = bodyBorder + 'px'; 618 } 619 wheight = (uaInfo.getIpadApp() == 'ipad_app' ? document.documentElement.clientWidth : window.innerHeight || document.documentElement.clientHeight) - (bodyBorder * 2); 620 } 621 if (!isMobile && !scrollbarWidth) { 622 // Create the measurement node 623 var scrollDiv = document.createElement("div"); 624 scrollDiv.className = "scrollbar-measure"; 625 var dombody = document.body; 626 if (dombody != null) { 627 dombody.appendChild(scrollDiv); 628 // Get the scrollbar width 629 scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; 630 // Delete the DIV 631 dombody.removeChild(scrollDiv); 632 } 633 } 634 if (!isMobile) { 635 forEachElement('.box-container', function(el, i) { 636 if (!classie.hasClass(el, 'limit-width')) { 637 var elWidth = outerWidth(el), 638 newWidth = 12 * Math.ceil((wwidth - scrollbarWidth) / 12); 639 boxWidth = newWidth - (bodyBorder * 2); 640 boxLeft = (wwidth - boxWidth - scrollbarWidth) / 2; 641 el.style.width = boxWidth + 'px'; 642 if ( UNCODE.isRTL ) 643 el.style.marginRight = boxLeft + 'px'; 644 else 645 el.style.marginLeft = boxLeft + 'px'; 646 if (mainmenu != undefined && mainmenu[0] != undefined) { 647 mainmenu[0].style.width = boxWidth + 'px'; 648 } 649 } 650 }); 651 } 652 653 if (classie.hasClass(document.body, 'menu-mobile-transparent') && !classie.hasClass(document.body, 'hmenu-center')) isMobileTransparent = true; 654 655 if (!isMobileTransparent) { 656 if (wwidth > mediaQuery && classie.hasClass(document.body, 'menu-force-opacity')) classie.removeClass(document.body, 'menu-force-opacity'); 657 if (wwidth <= mediaQuery && !classie.hasClass(document.body, 'menu-force-opacity')) classie.addClass(document.body, 'menu-force-opacity'); 658 } 659 660 UNCODE.isQuickView = isQuickView; 661 662 }, 663 fixMenuHeight = function() { 664 if (!classie.hasClass(document.body, 'vmenu')) noScroll = true; 665 666 menuwrapper = document.querySelectorAll(".menu-wrapper"); 667 masthead = document.getElementById("masthead"); 668 if (classie.hasClass(document.body, 'hmenu-center-split') && document.getElementById("logo-container-mobile") != null && document.getElementById("main-logo") != null ) { 669 mastheadMobile = new Array(document.getElementById("logo-container-mobile"), document.getElementById("main-logo").parentNode); 670 } else mastheadMobile = document.getElementById("logo-container-mobile"); 671 menuhide = document.querySelector('#masthead .menu-hide, .main-header .menu-hide, #masthead .menu-hide-vertical');
672 menusticky = document.querySelectorAll('.menu-sticky, .menu-sticky-vertical'); 673 transmenuel = document.querySelectorAll('.menu-transparent:not(.vmenu-container)'); 674 var menuItemsButton = document.querySelectorAll('.menu-item-button .menu-btn-table'); 675 logo = document.querySelector('#main-logo'); 676 if (logo != undefined) logolink = (logo.firstElementChild || logo.firstChild); 677 if (logolink != undefined) logoMinScale = logolink.getAttribute("data-minheight"); 678 logoel = document.querySelectorAll('.menu-shrink .logo-container'); 679 mainmenu = document.querySelectorAll('.vmenu .vmenu-container, .menu-primary .menu-container'); 680 if (classie.hasClass(document.body, 'hmenu-center')) { 681 var mainmenucenter = document.querySelectorAll('.hmenu-center .menu-container-mobile'); 682 var first_array = Array.prototype.slice.call(mainmenu); 683 var second_array = Array.prototype.slice.call(mainmenucenter); 684 mainmenu = first_array.concat(second_array); 685 } 686 secmenu = document.querySelectorAll('.menu-secondary'); 687 calculateMenuHeight(true); 688 for (var k = 0;
688 k < menuItemsButton.length; k++) { 689 var a_item = menuItemsButton[k].parentNode, 690 buttonHeight = outerHeight(menuItemsButton[k]); 691 a_item.style.height = buttonHeight + 'px'; 692 } 693 if (classie.hasClass(document.body, 'hmenu-center-split')) { 694 mainNavMenu = document.querySelector('#masthead .navbar-main .menu-primary-inner'); 695 mainNavWrapper = document.querySelector('#masthead > .menu-container'); 696 isSplitMenu = true; 697 } 698 fixMenu(); 699 menuOpacity(); 700 }, 701 menuOpacity = function(){ 702 transmenuel = document.querySelectorAll('.menu-transparent:not(.vmenu-container)'); 703 if (typeof transmenuel === 'undefined' || !transmenuel.length) { 704 return false; 705 } 706 if (wwidth > mediaQuery && classie.hasClass(transmenuel[0], 'menu-desktop-transparent')) { 707 classie.removeClass(transmenuel[0], 'menu-desktop-transparent'); 708 classie.addClass(transmenuel[0], 'menu-desktop-transparent'); 709 } else if (wwidth <= mediaQuery && classie.hasClass(transmenuel[0], 'menu-desktop-transparent')) { 710 classie.removeClass(transmenuel[0], 'menu-desktop-transparent'); 711 classie.addClass(transmenuel[0], 'menu-desktop-transparent'); 712 } 713 }, 714 verticalRightMenu = function() { 715 var setVrightMenu, vRightMenuw; 716 var vRightMenu = function(){ 717 $initBox = document.getElementById("initBox"); 718 $mainHeader = document.querySelector('.main-header'); 719 mainHeader = $mainHeader.innerHTML; 720 $mainWrapper = document.querySelector('.main-wrapper'); 721 if ( classie.hasClass(document.body, 'vmenu') && ( ( classie.hasClass(document.body, 'vmenu-position-right') && ! classie.hasClass(document.body, 'rtl') ) || ( classie.hasClass(document.body, 'vmenu-position-left') && classie.hasClass(document.body, 'rtl') ) ) ) { 722 if ( wwidth <= mediaQuery ) { 723 $initBox.parentNode.insertBefore($mainHeader, $initBox.nextSibling); 724 } else { 725 $mainWrapper.parentNode.insertBefore($mainHeader, $mainWrapper.nextSibling); 726 } 727 $mainHeader.removeChild; 728 } 729 }; 730 vRightMenu(); 731 window.addEventListener("resize", function() { 732 if ( wwidth != vRightMenuw ) { 733 clearRequestTimeout(setVrightMenu); 734 setVrightMenu = requestTimeout( function(){ 735 vRightMenuw = wwidth; 736 vRightMenu(); 737 }, 100 ); 738 } 739 }); 740 }, 741 calculateMenuHeight = function(first) { 742 menuHeight = transmenuHeight = secmenuHeight = 0; 743 744 if (mastheadMobile != null) { 745 if (mastheadMobile.length === 2) { 746 if (wwidth > mediaQuery) { 747 UNCODE.menuMobileHeight = outerHeight(mastheadMobile[1]); 748 mastheadMobilePaddingTop = parseFloat(getComputedStyle(mastheadMobile[1]).paddingTop); 749 } else { 750 UNCODE.menuMobileHeight = outerHeight(mastheadMobile[0]); 751 mastheadMobilePaddingTop = parseFloat(getComputedStyle(mastheadMobile[0]).paddingTop); 752 } 753 } else { 754 UNCODE.menuMobileHeight = outerHeight(mastheadMobile); 755 mastheadMobilePaddingTop = parseFloat(getComputedStyle(mastheadMobile).paddingTop); 756 } 757 } 758 759 if (wwidth > mediaQuery) { 760 for (var i = 0; i < mainmenu.length; i++) { 761 if (classie.hasClass(document.body, 'hmenu-center') && i === 1) continue; 762 if (!classie.hasClass(masthead, 'masthead-vertical')) { 763 menuHeight = menuHeight + outerHeight(mainmenu[i]); 764 } else menuHeight = 0; 765 766 if (isIE && first) { 767 getDivChildren(mainmenu[i], '.menu-horizontal-inner', function(innerMenu, i) { 768 innerMenu.style.height = menuHeight + 'px'; 769 }); 770 } 771 772 if (classie.hasClass(mainmenu[i].parentNode, 'menu-transparent')) { 773 transmenuHeight += menuHeight; 774 } 775 } 776 777 for (var j = 0; j < secmenu.length; j++) { 778 secmenuHeight += outerHeight(secmenu[j]); 779 } 780 menuHeight += secmenuHeight; 781 } else { 782 secmenu = document.querySelectorAll('.menu-secondary:not(.menu-primary)'); 783 menuHeight = UNCODE.menuMobileHeight; 784 if (isMobileTransparent) { 785 for (var i = 0; i < mainmenu.length; i++) { 786 if (classie.hasClass(mainmenu[i].parentNode, 'menu-transparent')) { 787 transmenuHeight += menuHeight; 788 } 789 } 790 } 791 var search_box = document.querySelectorAll('.search-icon .drop-menu'); 792 for (var i = 0; i < search_box.length; i++) { 793 search_box[i].removeAttribute('style'); 794 } 795 796 for (var j = 0; j < secmenu.length; j++) {
797 secmenuHeight += outerHeight(secmenu[j]); 798 } 799 menuHeight += secmenuHeight; 800 } 801 802 803 if (classie.hasClass(document.documentElement, 'admin-mode')) { 804 adminBar = document.getElementById("wpadminbar"); 805 if (wwidth > 600) { 806 if (adminBar != null) adminBarHeight = outerHeight(adminBar); 807 else { 808 if (wwidth > 782) adminBarHeight = 32; 809 else adminBarHeight = 46; 810 } 811 } else adminBarHeight = 0; 812 } 813 UNCODE.adminBarHeight = adminBarHeight; 814 UNCODE.menuHeight = menuHeight; 815 816 if ( UNCODE.isFullPage && ! UNCODE.isFrontEndEditor ) { 817 if ( UNCODE.adminBarHeight > 0 ) 818 document.body.style.marginTop = ( ( UNCODE.adminBarHeight + UNCODE.bodyBorder ) * -1 ) + 'px'; 819 820 document.body.style.paddingTop = ( UNCODE.adminBarHeight + UNCODE.bodyBorder ) + 'px'; 821 } else { 822 document.body.style.marginTop = 0; 823 document.body.style.paddingTop = 0; 824 } 825 826 if (masthead != undefined) { 827 //masthead.parentNode.style.height = menuHeight + 'px'; 828 if (classie.hasClass(masthead, 'menu-transparent')) { 829 if (wwidth > mediaQuery) masthead.parentNode.style.height = '0px'; 830 } 831 } 832 833 if (typeof menuhide == 'object' && menuhide != null && mainmenu[0] != undefined) { 834 var sticky_element = (typeof mainmenu.item === 'undefined' ? ((wwidth > mediaQuery) ? mainmenu[0] : mainmenu[1]) : mainmenu[0]); 835 if (sticky_element.style.top != '') { 836 sticky_element.style.top = UNCODE.bodyBorder + 'px' 837 } 838 } 839 840 }, 841 centerSplitMenu = function() { 842 if (wwidth > mediaQuery && mainNavMenu) { 843 if (mainNavMenu.style.left == '') { 844 mainNavMenu.style.left = '0px'; 845 var logoPos = logo.parentNode.getBoundingClientRect(); 846 mainNavMenu.style.left = (wwidth / 2) - (logoPos.left + (logoPos.width / 2) ) + 'px'; 847 mainNavWrapper.style.opacity = '1'; 848 } 849 mainNavWrapper.style.opacity = '1'; 850 } 851 }, 852 initHeader = function() { 853 pageHeader = document.getElementById("page-header"); 854 if (SiteParameters.dynamic_srcset_active === '1') { 855 UNCODE.adaptive_srcset_replace_bg(pageHeader); 856 } 857 UNCODE.adaptive(); 858 859 parallaxHeaders = document.querySelectorAll('.header-parallax > .header-bg-wrapper'); 860 header = document.querySelectorAll('.header-wrapper.header-uncode-block, .header-wrapper.header-revslider, .header-wrapper.header-layerslider, .header-basic .header-wrapper, .header-uncode-block > .row-container:first-child > .row > .row-inner > .col-lg-12 > .uncol, .header-uncode-block .uncode-slider .owl-carousel > .row-container:first-child .column_child .uncoltable'); 861 headerWithOpacity = document.querySelectorAll('.header-scroll-opacity'); 862 if ( typeof pageHeader === 'object' && pageHeader !== null ) { 863 headerVideo = pageHeader.querySelectorAll('.uncode-video-container:not(.t-entry-drop)'); 864 kenburnsHeaders = pageHeader.querySelectorAll('.with-kburns > .header-bg-wrapper'); 865 backwashHeaders = pageHeader.querySelectorAll('.with-zoomout > .header-bg-wrapper'); 866 if ( headerVideo.length ) { 867 classie.addClass(pageHeader, 'has-video'); 868 } 869 } 870 if (pageHeader != undefined) { 871 var backs = pageHeader.querySelectorAll('.header-bg'), 872 backsCarousel = pageHeader.querySelectorAll('.header-uncode-block .background-inner'), 873 uri_pattern = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»ââââ]))/ig; 874 if (backs.length == 0 && backsCarousel.length == 0) { 875 pageHeader.setAttribute('data-imgready', 'true'); 876 } else { 877 if (backsCarousel.length) { 878 for (var j = 0; j < backsCarousel.length; j++) { 879 if (j == 0) { 880 if (!!backsCarousel[j].style.backgroundImage && backsCarousel[j].style.backgroundImage !== void 0) { 881 var url = (backsCarousel[j].style.backgroundImage).match(uri_pattern), 882 image = new Image(); 883 if ( url === null ) { 884 url = (backsCarousel[j].style.backgroundImage).slice(4, -1).replace(/"/g, ""); 885 } 886 image.onload = function() { 887 pageHeader.setAttribute('data-imgready', 'true'); 888 }; 889 image.src = url[0]; 890 } else { 891 pageHeader.setAttribute('data-imgready', 'true'); 892 } 893 } 894 } 895 } else { 896 for (var i = 0; i < backs.length; i++) { 897 if (i == 0) { 898 if (!!backs[i].style.backgroundImage && backs[i].style.backgroundImage !== void 0) { 899 var url = (backs[i].style.backgroundImage).match(uri_pattern), 900 image = new Image(); 901 if ( url === null ) { 902 url = (backs[i].style.backgroundImage).slice(4, -1).replace(/"/g, ""); 903 } 904 image.onload = function() { 905 pageHeader.setAttribute('data-imgready', 'true'); 906 }; 907 image.src = url[0]; 908 } else { 909 pageHeader.setAttribute('data-imgready', 'true'); 910 } 911 } 912 } 913 } 914 } 915 } 916 917 if (masthead != undefined && !classie.hasClass(masthead, 'masthead-vert
917ical')) { 918 if (header.length) { 919 masthead.parentNode.style.height = menuHeight + 'px'; 920 if (menuwrapper[0] != undefined) classie.addClass(menuwrapper[0], 'with-header'); 921 for (var j = 0; j < header.length; j++) { 922 var headerel = header[j], 923 closestStyle = getClosest(headerel, 'style-light'), 924 wcClosestStyle = getClosest(headerel, 'wc-parent-style-light'); 925 if (closestStyle != null && classie.hasClass(closestStyle, 'style-light')) { 926 switchColorsMenu(0, 'light'); 927 } else if (wcClosestStyle != null && classie.hasClass(wcClosestStyle, 'wc-parent-style-light')) { 928 switchColorsMenu(0, 'light'); 929 } else if (getClosest(headerel, 'style-dark') != null) { 930 switchColorsMenu(0, 'dark'); 931 } else if (getClosest(headerel, 'wc-parent-style-dark') != null) { 932 switchColorsMenu(0, 'dark'); 933 } else { 934 if (masthead.style.opacity !== 1) masthead.style.opacity = 1; 935 } 936 if (classie.hasClass(masthead, 'menu-transparent')) { 937 if (isMobileTransparent || wwidth > mediaQuery) { 938 masthead.parentNode.style.height = '0px'; 939 if (classie.hasClass(masthead, 'menu-add-padding')) { 940 var headerBlock = getClosest(headerel, 'header-uncode-block'); 941 if (headerBlock != null) { 942 var parentRow = headerBlock.querySelector('.vc_row'); 943 if (parentRow != null) { 944 var innerRows = parentRow.querySelectorAll('.column_parent > .uncol > .uncoltable > .uncell > .uncont, .uncode-slider .column_child > .uncol > .uncoltable > .uncell > .uncont'); 945 for (var k = 0; k < innerRows.length; k++) { 946 if (innerRows[k] != undefined) { 947 if (wwidth > mediaQuery) innerRows[k].style.paddingTop = transmenuHeight + 'px'; 948 else innerRows[k].style.paddingTop = (transmenuHeight - mastheadMobilePaddingTop) + 'px'; 949 } 950 } 951 } 952 } else { 953 getDivChildren(headerel, '.header-content', function(headerContent, i) { 954 if (wwidth > mediaQuery) headerContent.style.paddingTop = transmenuHeight + 'px'; 955 else headerContent.style.paddingTop = (transmenuHeight - mastheadMobilePaddingTop) + 'px'; 956 }); 957 } 958 } 959 } 960 } 961 if (classie.hasClass(headerel, 'uncoltable')) { 962 break; 963 } 964 } 965 } else { 966 if (menuwrapper[0] != undefined) classie.addClass(menuwrapper[0], 'no-header'); 967 classie.removeClass(masthead, 'menu-transparent'); 968 transmenuHeight = 0; 969 isMobileTransparent = false; 970 } 971 } else { 972 isMobileTransparent = false; 973 } 974 if (typeof transmenuel === 'undefined' || !transmenuel.length) isMobileTransparent = false; 975 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 976 UNCODE.bodyTop = bodyTop; 977 headerHeight('.header-wrapper'); 978 if (!classie.hasClass(document.body, 'vmenu')) 979 initBox(); 980 scrollFunction(); 981 showHideScrollup(bodyTop); 982 983 if ( UNCODE.isMobile ) { 984 985 var eventName = 'loadedmetadata'; 986 eventName = eventName.replace(/^on/, ''); 987 var elt = document.createElement('video'[eventName]); 988 var eventIsSupported = ('on'+eventName in elt); 989 elt = null; 990 if ( ! eventIsSupported || ( classie.hasClass(document.documentElement, 'firefox') && classie.hasClass(document.documentElement, 'android') ) ) { 991 classie.addClass(document.body, 'video-not-supported'); 992 } 993 } 994 995 }, 996 initRow = function(currentRow) { 997 if (SiteParameters.dynamic_srcset_active === '1') { 998 UNCODE.adaptive_srcset_replace_bg(currentRow); 999 } 1000 UNCODE.adaptive(); 1001 var el = typeof currentRow.parentNode !== 'undefined' && currentRow.parentNode.parentNode.getAttribute("data-parent") == 'true' ? currentRow.parentNode : ( currentRow.getAttribute("data-parent") == 'true' ? currentRow.querySelector('.row-parent') : currentRow.parentNode.parentNode ), 1002 rowParent = el.parentNode, 1003 rowInner = currentRow.parentNode, 1004 percentHeight = el.getAttribute("data-height-ratio"), 1005 minHeight = el.getAttribute("data-minheight"), 1006 calculateHeight, 1007 calculatePadding = 0, 1008 isHeader = false, 1009 isFirst = false, 1010 uri_pattern = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»ââââ]))/ig; 1011 1012 /** Add class to the row when contains responsive column size */ 1013 getDivChildren(el.parentNode, '.column_parent, .column_child', function(obj, i, total) { 1014 if ((obj.className).indexOf("col-md-") > - 1) { 1015 classie.addClass(obj.parentNode, 'cols-md-responsive'); 1016 } 1017 obj.className = obj.className.replace(/vc_col-sm-(\d{1,2})/g, ""); 1018 if ((obj.className).indexOf("col-sm-") > - 1 && (obj.className).indexOf("col-sm-clear") == - 1) { 1019 classie.addClass(obj.parentNode, 'cols-sm-responsive'); 1020 } 1021 }); 1022 1023 setRowHeight(el); 1024 1025 var elements = 0; 1026 getDivChildren(el, '.row-internal .background-inner', function(obj, i, total) { 1027 elements++; 1028 if (i == 0) { 1029 if (!!obj.style.backgroundImage && obj.style.backgroundImage !== void 0) { 1030 var url = (obj.style.backgroundImage).match(uri_pattern), 1031 image = new Image(); 1032 if ( url === null ) { 1033 url = (obj.style.backgroundImage).slice(4, -1).replace(/"/g, ""); 1034 } 1035 image.onload = function() { 1036 el.setAttribute('data-imgready', 'true'); 1037 el.dispatchEvent(new CustomEvent('imgLoaded')); 1038 }; 1039 image.src = url[0]; 1040 } else { 1041 el.setAttribute('data-imgready', 'true'); 1042 el.dispatchEvent(new CustomEvent('imgLoaded')); 1043 } 1044 } 1045 }); 1046 if (elements == 0) { 1047 el.setAttribute('data-imgready', 'true'); 1048 } 1049 1050 // var $bgs = rowParent.querySelectorAll('.background-inner'); 1051 1052 // for (var i = 0; i < $bgs.length; i++) { 1053 // var $bg = $bgs[i]; 1054 // if ($bg.style.backgroundImage && $bg.style.backgroundImage !== '') { 1055 // var url = ($bg.style.backgroundImage).match(uri_pattern), 1056 // image = new Image(); 1057 // url = url[0]; 1058 // image.source = url; 1059 // image.el = $bg; 1060 // image.onload = function() { 1061 // var _this = this; 1062 // _this.el.setAttribute('data-imgloaded', 'true'); 1063 // }; 1064 // image.src = url; 1065 // } else { 1066 // $bg.setAttribute('data-imgloaded', 'true'); 1067 // } 1068 // } 1069 1070 /** init parallax is not mobile */ 1071 if ( ! UNCODE.isFullPage ) { 1072 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 1073 kenburnsRows = el.parentNode.parentNode.querySelectorAll('.with-kburns > .row-background > .background-wrapper, .with-kburns > .fp-tableCell > .row-background > .background-wrapper, .with-kburns > .fp-tableCell > .fp-scrollable > .fp-scroller > .row-background > .background-wrapper'); 1074 kenburnsCols = el.querySelectorAll('.with-kburns > .column-background > .background-wrapper'); 1075 backwashRows = el.parentNode.parentNode.querySelectorAll('.with-zoomout > .row-background > .background-wrapper, .with-zoomout > .fp-tableCell > .row-background > .background-wrapper, .with-zoomout > .fp-tableCell > .fp-scrollable > .fp-scroller > .row-background > .background-wrapper'); 1076 backwashCols = el.querySelectorAll('.with-zoomout > .column-background > .background-wrapper'); 1077 if (isMobileParallaxAllowed || !UNCODE.isMobile) {
1078 parallaxRows = el.parentNode.parentNode.querySelectorAll('.with-parallax > .row-background > .background-wrapper, .with-parallax > .fp-tableCell > .row-background > .background-wrapper, .with-parallax > .fp-tableCell > .fp-scrollable > .fp-scroller > .row-background > .background-wrapper'); 1079 parallaxCols = el.querySelectorAll('.with-parallax > .column-background > .background-wrapper'); 1080 visibleRows = el.parentNode.parentNode; 1081 parallaxRowCol(bodyTop); 1082 visibleRowCol(bodyTop); 1083 } else { 1084 if (UNCODE.isMobile) { 1085 kenburnsHeader(bodyTop); 1086 kenburnsRowCol(bodyTop); 1087 backwashHeader(bodyTop); 1088 backwashRowCol(bodyTop); 1089 } 1090 } 1091 } 1092 1093 shapeDivider(); 1094 1095 var wrapLinesWw = wwidth; 1096 1097 //Text animation, automatic lines and highlights 1098 var setWrap; 1099 1100 //Font style of grouped products 1101 function product_relative_font_style(el){ 1102 var $labels = el.querySelectorAll('.woocommerce-grouped-product-list-item__label, .woocommerce-grouped-product-list-item__price'); 1103 if ( $labels.length ) { 1104 var $main_price = el.querySelectorAll('.heading-text .woocommerce-Price-amount'); 1105 if ( $main_price.length ) { 1106 var $price_wrap = $main_price[0].closest('.heading-text'), 1107 $price_nest = $price_wrap.querySelector(':first-child'), 1108 font_class = $price_nest.getAttribute('class').split(' '), 1109 cli, labI; 1110 1111 for ( labI = 0; labI < $labels.length; labI++ ) { 1112 for ( cli = 0; cli < font_class.length; cli++ ) { 1113 if ( font_class[cli].indexOf('font') !== -1 && font_class[cli].indexOf('fontsize') === -1 ) { 1114 classie.addClass($labels[labI], font_class[cli]); 1115 } 1116 } 1117 } 1118 1119 } 1120 } 1121 } 1122 product_relative_font_style(el) 1123 1124 function vc_row_full_width_size(){ 1125 if (boxWidth != 0 && classie.hasClass(rowParent, 'vc_row-full-width')) { 1126 var vmenu = document.querySelector('.vmenu .vmenu-container'), 1127 vmenuW = 0; 1128 if (typeof vmenu == 'object' && vmenu != null && wwidth > mediaQuery ) { 1129 vmenuW = vmenu.offsetWidth; 1130 } 1131 rowParent.style.maxWidth = ( boxWidth - vmenuW ) + 'px'; 1132 } 1133 } 1134 vc_row_full_width_size(); 1135 1136 window.addEventListener("resize", function() { 1137 vc_row_full_width_size(); 1138 }); 1139 1140 function word_for_lines(event, $parent_el){ 1141 1142 if ( typeof $parent_el === 'undefined' || $parent_el === null ) { 1143 $parent_el = document.body; 1144 } 1145 1146 var $headings = $parent_el.querySelectorAll('.heading-text'); 1147 1148 for (var head_k = 0; head_k < $headings.length; head_k++) { 1149 var $heading = $headings[head_k], 1150 heading_cont = $heading.innerHTML, 1151 $row = $heading.closest('.row-parent'), 1152 $owl_carousel = $heading.closest('.owl-carousel-wrapper'), 1153 $owl_item = $heading.closest('.owl-item'), 1154 $words = $heading.querySelectorAll('.split-word'), 1155 setWrap; 1156 1157 if ( ! $words.length ) { 1158 if ( $owl_item !== null ) 1159 continue; 1160 } 1161 1162 if ( $owl_carousel === null && typeof event !== 'undefined' && event !== 'resize' && event !== false ) { 1163 continue; 1164 } 1165 1166 if ( $owl_carousel !== null ) { 1167 if ( 1168 ( $owl_item === null ) 1169 || 1170 ( $owl_item !== null && classie.hasClass($owl_item, 'active') && $owl_item.getAttribute('data-index') !== '1' ) 1171 || 1172 ( $owl_item !== null && classie.hasClass($owl_item, 'active') && $owl_item.getAttribute('data-index') === '1' && $owl_item.getAttribute('data-already-reached') === 'true' ) 1173 ) { 1174 continue; 1175 } 1176 } 1177 1178 $heading.innerHTML = heading_cont; 1179 $words = $heading.querySelectorAll('.split-word'); 1180 var lineArray = [], 1181 lineIndex = 0, 1182 lineStart = true, 1183 lineEnd = false, 1184 $text_highlight = $heading.querySelectorAll('.heading-text-highlight'), 1185 $line_wraps = $heading.querySelectorAll('.heading-line-wrap'); 1186 1187 if ( $line_wraps.length && typeof event === 'undefined' ) { 1188 continue; 1189 } 1190 1191 var lettering = function(){ 1192 var $wraps = $parent_el.querySelectorAll('.animate_inner_when_almost_visible.curtain, .animate_inner_when_almost_visible.curtain-words, .animate_inner_when_almost_visible.typewriter, .animate_inner_when_almost_visible.single-curtain, .animate_inner_when_almost_visible.single-slide, .animate_inner_when_almost_visible.single-slide-opposite'); 1193 1194 for (var i = 0; i < $wraps.length; i++) { 1195 var $wrap = $wraps[i], 1196 $lines = $wrap.querySelectorAll('.heading-line-wrap'), 1197 $words = $wrap.querySelectorAll('.split-word:not(.uncode-rotating-span)'), 1198 containerDelay = $wrap.getAttribute('data-delay'), 1199 containerSpeed = $wrap.getAttribute('data-speed'), 1200 containerSpeed_val = typeof containerSpeed !== 'undefined' && containerSpeed !== null ? parseFloat(containerSpeed) : 400, 1201 containerInterval = typeof $wrap.getAttribute('data-interval') !== 'undefined' && $wrap.getAttribute('data-interval') !== null ? $wrap.getAttribute('data-interval') : 0, 1202 delayAttr = (containerDelay != undefined) ? containerDelay : 0; 1203 1204 if ( classie.hasClass($wrap, 'already-animated') ) { 1205 continue; 1206 } 1207 1208 if ( classie.hasClass($wrap, 'curtain') ) { 1209 1210 for (var il = 0; il < $lines.length; il++) { 1211 var $line = $lines[il], 1212 $spans = $line.querySelectorAll('.split-word-inner'); 1213 1214 for (var is = 0; is < $spans.length; is++) { 1215 1216 var $span = $spans[is]; 1217 1218 $span.setAttribute('data-delay', ( parseFloat(delayAttr) + ( ( parseFloat(containerInterval) + 100 ) * il ) ) ); 1219 1220 if (typeof containerSpeed_val !== 'undefined' ) { 1221 $span.setAttribute('data-speed', containerSpeed_val); 1222 } 1223 1224 classie.addClass($span, 'animate_when_parent_almost_visible'); 1225 classie.addClass($span, 'text-bottom-t-top'); 1226 1227 if ( is+1 === $spans.length && il+1 === $lines.length ) { 1228 classie.addClass($span, 'anim-tot-checker'); 1229 } 1230 } 1231 1232 } 1233 1234 } else if ( classie.hasClass($wrap, 'single-curtain') ) { 1235 1236 var $spans = $wrap.querySelectorAll('.split-char'); 1237 1238 for (var is = 0; is < $spans.length; is++) { 1239 var $span = $spans[is]; 1240 1241 $span.setAttribute('data-delay', ( parseFloat(delayAttr) + ( ( parseFloat(containerInterval) + 20 ) * is ) ) ); 1242 1243 if (typeof containerSpeed_val !== 'undefined' ) { 1244 $span.setAttribute('data-speed', containerSpeed_val); 1245 } 1246 1247 classie.addClass($span, 'animate_when_parent_almost_visible'); 1248 classie.addClass($span, 'text-bottom-t-top'); 1249 1250 if ( is+1 == $spans.length ) { 1251 classie.addClass($span, 'anim-tot-checker'); 1252 } 1253 }; 1254 1255 } else if ( classie.hasClass($wrap, 'typewriter') ) { 1256 1257 var $spans = $wrap.querySelectorAll('.split-char'); 1258 1259 for (var is = 0; is < $spans.length; is++) { 1260 var $span = $spans[is]; 1261 1262 $span.setAttribute('data-delay', ( parseFloat(delayAttr) + ( ( parseFloat(containerInterval) + 20 ) * is ) ) ); 1263 1264 if (typeof containerSpeed_val !== 'undefined' ) { 1265 $span.setAttribute('data-speed', containerSpeed_val); 1266 } 1267 1268 classie.addClass($span, 'animate_when_parent_almost_visible'); 1269 classie.addClass($span, 'typewriter'); 1270 1271 if ( is+1 == $spans.length ) { 1272 classie.addClass($span, 'anim-tot-checker'); 1273 } 1274 1275 } 1276 1277 } else if ( classie.hasClass($wrap, 'single-slide') ) { 1278 1279 var $spans = $wrap.querySelectorAll('.split-word-inner'); 1280 1281 for (var is = 0; is < $spans.length; is++) { 1282 var $span = $spans[is]; 1283 1284 $span.setAttribute('data-delay', ( parseFloat(delayAttr) + ( ( parseFloat(containerInterval) + 50 ) * is ) ) ); 1285 1286 if (typeof containerSpeed_val !== 'undefined' ) { 1287 $span.setAttribute('data-speed', containerSpeed_val); 1288 } 1289 1290 classie.addClass($span, 'animate_when_parent_almost_visible'); 1291 if ( classie.hasClass(document.body, 'rtl') ) { 1292 classie.addClass($span, 'text-left-t-right'); 1293 } else { 1294 classie.addClass($span, 'text-right-t-left'); 1295 } 1296 1297 if ( is+1 == $spans.length ) { 1298 classie.addClass($span, 'anim-tot-checker'); 1299 } 1300 } 1301 1302 } else if ( classie.hasClass($wrap, 'single-slide-opposite') ) { 1303 1304 var $spans = $wrap.querySelectorAll('.split-word-inner'); 1305 1306 for (var is = 0; is < $spans.length; is++) { 1307 var $span = $spans[is]; 1308 1309 $span.setAttribute('data-delay', ( parseFloat(delayAttr) + ( ( parseFloat(containerInterval) + 50 ) * is ) ) ); 1310 1311 if (typeof containerSpeed_val !== 'undefined' ) { 1312 $span.setAttribute('data-speed', containerSpeed_val); 1313 } 1314 1315 classie.addClass($span, 'animate_when_parent_almost_visible'); 1316 if ( classie.hasClass(document.body, 'rtl') ) { 1317 classie.addClass($span, 'text-right-t-left'); 1318 } else { 1319 classie.addClass($span, 'text-left-t-right'); 1320 } 1321 1322 if ( is+1 == $spans.length ) { 1323 classie.addClass($span, 'anim-tot-checker'); 1324 } 1325 } 1326 1327 } else if ( classie.hasClass($wrap, 'curtain-words') ) { 1328 1329 var $spans = $wrap.querySelectorAll('.split-word-inner'); 1330 1331 for (var is = 0; is < $spans.length; is++) { 1332 var $span = $spans[is]; 1333 1334 $span.setAttribute('data-delay', ( parseFloat(delayAttr) + ( ( parseFloat(containerInterval) + 50 ) * is ) ) ); 1335 1336 if (typeof containerSpeed_val !== 'undefined' ) { 1337 $span.setAttribute('data-speed', containerSpeed_val); 1338 } 1339 1340 classie.addClass($span, 'animate_when_parent_almost_visible'); 1341 classie.addClass($span, 'text-bottom-t-top'); 1342 1343 if ( is+1 == $spans.length ) { 1344 classie.addClass($span, 'anim-tot-checker'); 1345 } 1346 } 1347 } 1348 1349 } 1350 } 1351 1352 var removeOldLines = function(){ 1353 for (var wrap_k = 0; wrap_k < $line_wraps.length; wrap_k++) { 1354 var $line_wrap = $line_wraps[wrap_k]; 1355 var $parent_wrap = $line_wrap.parentNode; 1356 if ( $parent_wrap !== null ) { 1357 while ( $line_wrap.firstChild ) { 1358 $parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap); 1359 } 1360 $parent_wrap.removeChild($line_wrap); 1361 } 1362 } 1363 window.dispatchEvent(new CustomEvent('removeOldLines')); 1364 } 1365 1366 var createHighlightSpans = function(){ 1367 for (var high_k = 0; high_k < $text_highlight.length; high_k++) { 1368 var $highlight = $text_highlight[high_k], 1369 atts = $highlight.getAttribute('data-atts'), 1370 objAtts, 1371 styleEl = '', 1372 classEl = '', 1373 animation = false, 1374 hexRe = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i, 1375 $h_words = $highlight.querySelectorAll('.split-word:not(.uncode-rotating-span)'); 1376 1377 if ( typeof atts !== 'undefined' && atts != '' ) { 1378 objAtts = JSON.parse(atts); 1379 if ( typeof objAtts.bg != 'undefined' ) { 1380 if ( hexRe.test(objAtts.bg)) { 1381 styleEl += 'background-color:' + objAtts.bg + ';'; 1382 } else { 1383 classEl += ' ' + objAtts.bg; 1384 } 1385 } 1386 if ( typeof objAtts.color != 'undefined' ) { 1387 if ( hexRe.test(objAtts.color)) { 1388 styleEl += 'color:' + objAtts.color + ';'; 1389 } else {
1390 var classChild = objAtts.color; 1391 } 1392 } 1393 if ( typeof objAtts.height != 'undefined' ) { 1394 styleEl += 'height:' + objAtts.height + ';'; 1395 } 1396 if ( typeof objAtts.offset != 'undefined' ) { 1397 styleEl += 'bottom:' + objAtts.offset + ';'; 1398 } 1399 if ( typeof objAtts.opacity != 'undefined' ) { 1400 styleEl += 'opacity:' + objAtts.opacity + ';'; 1401 } 1402 if ( objAtts.animated == 'yes' ) { 1403 animation = true; 1404 } 1405 1406 } 1407 1408 for (var h_words_k = 0; h_words_k < $h_words.length; h_words_k++) { 1409 var $word = $h_words[h_words_k], 1410 $new_el = document.createElement('span'); 1411 1412 if ( typeof classChild !== 'undefined' ) { 1413 classie.addClass($word, objAtts.color); 1414 } 1415 1416 if ( h_words_k === 0 ) { 1417 classie.addClass($word, 'first-highlight'); 1418 } else if ( (h_words_k+1) === $h_words.length ) { 1419 classie.addClass($word, 'last-highlight'); 1420 } 1421 1422 $new_el.className = 'heading-text-highlight-inner' + classEl; 1423 if ( styleEl !== '' ) { 1424 $new_el.setAttribute('style', styleEl); 1425 } 1426 1427 if ( animation ) { 1428 $new_el.setAttribute('data-animated', 'yes'); 1429 } 1430 1431 $word.appendChild($new_el); 1432 1433 }; 1434 1435 var $parent_highlight = $highlight.parentNode; 1436 if ( $parent_highlight != null ) { 1437 while ( $highlight.firstChild ) { 1438 $parent_highlight.insertBefore($highlight.firstChild, $highlight); 1439 } 1440 $parent_highlight.removeChild($highlight); 1441 } 1442 } 1443 1444 } 1445 1446 var createNewLines = function(){ 1447 for (var word_k = 0; word_k < $words.length; word_k++) { 1448 var $word = $words[word_k], 1449 top = $word.offsetTop, 1450 elH = $word.offsetHeight, 1451 $next = typeof $words[(word_k+1)] !== 'undefined' ? $words[(word_k+1)] : null, 1452 nextTop = $next !== null ? $next.offsetTop : null; 1453 1454 if (lineStart) { 1455 lineArray[lineIndex] = [word_k]; 1456 1457 if (nextTop !== null && elH > 0 && nextTop > (top + elH/2)) {//tollerance 1458 lineArray[lineIndex].push(word_k); 1459 lineIndex++; 1460 lineStart = true; 1461 } else { 1462 lineStart = false;
1463 } 1464 } else { 1465 if (nextTop !== null && elH > 0 && nextTop > (top + elH/2)) {//tollerance 1466 lineArray[lineIndex].push(word_k); 1467 lineIndex++; 1468 lineStart = true; 1469 } else if ( nextTop === null ) { 1470 lineArray[lineIndex].push(word_k); 1471 } 1472 } 1473 } 1474 1475 for (var i = 0; i < lineArray.length; i++) { 1476 var start = lineArray[i][0], 1477 end = lineArray[i][1] + 1; 1478 1479 var spanWrap = document.createElement('span'); 1480 spanWrap.className = 'heading-line-wrap'; 1481 1482 if (!end) { 1483 window.wrap(spanWrap, $words[start]); 1484 } else { 1485 for (var _i = start; _i < end; _i++) { 1486 if ( typeof $words[_i] !== 'undefined' && $words[_i] !== null ) { 1487 classie.addClass($words[_i], 'heading-temp'); 1488 $words[_i].style.zIndex = end - _i; 1489 } 1490 } 1491 var $towrap = $heading.querySelectorAll('.heading-temp'); 1492 if ( typeof $towrap[0] !== 'undefined' && $towrap[0] !== null ) { 1493 window.wrapAll(spanWrap, $towrap); 1494 for (var _i = 0; _i < $towrap.length; _i++) { 1495 classie.removeClass($towrap[_i], 'heading-temp'); 1496 } 1497 } 1498 } 1499 1500 if ( (i+1) == lineArray.length ) { 1501 classie.addClass($row, 'loaded-split-word'); 1502 } 1503 1504 classie.addClass($heading, 'heading-lined'); 1505 } 1506 lettering(); 1507 1508 } 1509 1510 removeOldLines(); 1511 createHighlightSpans(); 1512 createNewLines(); 1513 1514 $parent_el.addEventListener("owl-carousel-changed", function() { 1515 removeOldLines(); 1516 createHighlightSpans(); 1517 createNewLines(); 1518 }); 1519 1520 if ( event !== 'resize' ) { 1521 document.body.dispatchEvent(new CustomEvent('uncode_waypoints')); 1522 } 1523 1524 } 1525 } 1526 1527 var $h_markup = document.body.querySelectorAll('.font-obs'), 1528 fontArr = new Array(); 1529 1530 for (var i = 0; i < $h_markup.length; i++) { 1531 var font_to_check = $h_markup[i].getAttribute("data-font"); 1532 1533 if ( font_to_check === null ) { 1534 word_for_lines(false, el); 1535 } else { 1536 var font_weight = $h_markup[i].getAttribute("data-weight"); 1537 var font_style = $h_markup[i].getAttribute("data-style"); 1538 1539 if ( font_weight === null ) { 1540 font_weight = 'normal'; 1541 } 1542 1543 if ( font_style === null ) { 1544 font_style = 'normal'; 1545 } 1546 1547 font_to_check = font_to_check.split(','); 1548 1549 var font_val = font_to_check[0].replace(/['"]+/g, ''), 1550 font_key = '\''+font_val+'_'+font_weight+'_'+font_style+'\''; 1551 1552 if ( fontArr.indexOf( font_val+'_'+font_weight ) === -1 ) { 1553 fontArr[font_key] = {'family':font_val,'weight':font_weight,'style':font_style }; 1554 } 1555 } 1556 } 1557 1558 var counter = 0; 1559 1560 for (var key in fontArr) { 1561 if (fontArr.hasOwnProperty(key)) { 1562 var font = new FontFaceObserver(fontArr[key].family, { weight: fontArr[key].weight, style: fontArr[key].style } ); 1563 1564 font.load(null, 10000).then(function (font) { 1565 counter++; 1566 if ( counter == Object.keys(fontArr).length ) { 1567 already_font = true; 1568 requestTimeout(function(){ 1569 word_for_lines(false, el); 1570 }, 10); 1571 } 1572 }, function (error) { 1573 word_for_lines(false, el); 1574 }); 1575 } 1576 } 1577 1578 el.addEventListener("owl-carousel-initialized", function() { 1579 word_for_lines("owl-carousel-initialized", el); 1580 }); 1581 1582 el.addEventListener("vc-shortcodeView-updated", function() { 1583 word_for_lines(false, el); 1584 }); 1585 1586 window.addEventListener("resize", function() { 1587 if ( wwidth != wrapLinesWw ) { 1588 clearRequestTimeout(setWrap); 1589 setWrap = requestTimeout( function(){ 1590 wrapLinesWw = wwidth; 1591 word_for_lines('resize'); 1592 }, 100 ); 1593 } 1594 }); 1595 1596 scrollFunction(); 1597 1598 var videos = document.querySelectorAll('.wp-video-shortcode'); 1599 for (var i = 0; i < videos.length; i++) { 1600 var video = videos[i]; 1601 if ( typeof video.getAttribute('autoplay') !== 'undefined' && video.getAttribute('autoplay') !== null && ( typeof video.getAttribute('muted') === 'undefined' || video.getAttribute('muted') === null ) ) { 1602 video.oncanplay = function(e) { 1603 video.muted = true; 1604 video.play(); 1605 }; 1606 break; 1607 } 1608 } 1609 1610 // Single Product reviews counter on Page Builder module 1611 var singleProductReviewsCounter = function(){ 1612 var $reviews = document.getElementById("reviews"), 1613 $comments = $reviews != undefined ? $reviews.querySelector(".commentlist") : undefined; 1614 if ( $reviews != undefined && $comments != undefined ) { 1615 var dataReviews = $reviews.getAttribute('data-reviewed'), 1616 comments = $comments.getAttribute('data-comment-amout'), 1617 count_review_class = comments > 0 ? '' : ' hidden'; 1618 if ( typeof dataReviews == 'undefined' || dataReviews == null || dataReviews == '' ) { 1619 $reviews.setAttribute('data-reviewed', 'reviewed'); 1620 var $tabPane = getClosest($reviews, 'tab-pane'), 1621 $panel = getClosest($reviews, 'wpb_accordion_section'); 1622 if ( $tabPane != undefined) { 1623 var revID = $tabPane.getAttribute('id'), 1624 $spanTxt = document.querySelector('[data-tab-id=' + revID + '] > a > span'); 1625 1626 if ( typeof revID !== 'undefined' && revID !== '' && $spanTxt != null ) { 1627 var $spanCount = $spanTxt.querySelector('span.review-count'); 1628 if ( $spanCount != null ) { 1629 $spanCount.innerHTML = comments; 1630 } else { 1631 var textReviews = $spanTxt.innerHTML; 1632 $spanTxt.innerHTML = textReviews + ' <span class="review-count' + count_review_class + '">' + comments + '</span>'; 1633 } 1634 } 1635 } 1636 if ( $panel != undefined ) { 1637 var $spanTxt = $panel.querySelector('.panel-title > a > span'); 1638 1639 if ( $spanTxt != null ) { 1640 var $spanTxt_0 = $spanTxt; 1641 if ( $spanTxt[0] != undefined ) { 1642 $spanTxt_0 = $spanTxt[0]; 1643 } 1644 var $spanCount = $spanTxt.querySelector('span.review-count'); 1645 if ( $spanCount != null ) { 1646 $spanCount.innerHTML = comments; 1647 } else { 1648 var textReviews = $spanTxt.innerHTML; 1649 $spanTxt.innerHTML = textReviews + ' <span class="review-count' + count_review_class + '">' + comments + '</span>'; 1650 } 1651 } 1652 } 1653 } 1654 } 1655 }; 1656 singleProductReviewsCounter(); 1657 window.addEventListener( "vc_panel_title_edited", singleProductReviewsCounter ); 1658 1659 //Check for empty additional info tabs 1660 var checkEmptyAdditionalInfo = function(){ 1661 var $emptyAdditional = document.getElementById("no_additional_info"), 1662 $emptyPane, 1663 empty_pane_ID, 1664 $tabsParent, 1665 $emptyTab; 1666 if ( $emptyAdditional != undefined ) { 1667 $emptyPane = getClosest($emptyAdditional, 'tab-pane'); 1668 $tabsParent = getClosest($emptyAdditional, 'uncode-tabs'); 1669 if ( $emptyPane == undefined ) 1670 return false;
1671 empty_pane_ID = $emptyPane.getAttribute('id'); 1672 1673 $emptyTab = $tabsParent.querySelector('li[data-tab-id="' + empty_pane_ID + '"]'); 1674 $emptyTab.parentNode.removeChild($emptyTab); 1675 $emptyPane.parentNode.removeChild($emptyPane); 1676 } 1677 }; 1678 checkEmptyAdditionalInfo(); 1679 1680 var waitForSrcSetMedia = function(){ 1681 var $thumbs = el.querySelectorAll('.srcset-lazy-animations'); 1682 1683 for ( var th_i = 0; th_i < $thumbs.length; th_i++ ) { 1684 var $thumb = $thumbs[th_i], 1685 $media = $thumb.querySelectorAll('.srcset-auto'); 1686 1687 if ( $media.length ) { 1688 var $media_inside = $media[0].querySelectorAll('.srcset-sizes-done'); 1689 if ( classie.hasClass($media[0], 'srcset-sizes-done') || $media_inside.length ) { 1690 classie.removeClass($thumb, 'srcset-lazy-animations'); 1691 } 1692 } else { 1693 classie.removeClass($thumb, 'srcset-lazy-animations'); 1694 } 1695 } 1696 }; 1697 waitForSrcSetMedia(); 1698 1699 }, 1700 1701 setRowHeight = function(container, forced, resized) { 1702 var currentTallest = 0, 1703 percentHeight = 0, 1704 minHeight = 0, 1705 el, 1706 child, 1707 hasSubCols = false; 1708 if (container.length == undefined) { 1709 container = [container]; 1710 } 1711 // Loop for each container element to match their heights 1712 for (var i = 0; i < container.length; i++) { 1713 var el = container[i], 1714 $row = el, 1715 totalHeight = 0, 1716 colsArray = new Array(), 1717 calculatePadding = 0, 1718 $rowParent = $row.parentNode, 1719 isHeader = false, 1720 isFirst = false; 1721 $row.oversized = false; 1722 percentHeight = el.getAttribute("data-height-ratio"); 1723 minHeight = el.getAttribute("data-minheight"); 1724 // child = (el.firstElementChild || el.firstChild); 1725 child = (el.lastElementChild || el.lastChild); 1726 var childHeight = outerHeight(child); 1727 /** window height without header **/ 1728 if (!!percentHeight || !!minHeight || forced || (isIE && classie.hasClass(el, 'unequal')) ) { 1729 child.style.height = ''; 1730 if (!!percentHeight) { 1731 if (percentHeight == 'full') { 1732 currentTallest = parseInt(wheight); 1733 } else { 1734 currentTallest = parseInt((wheight * percentHeight) / 100); 1735 } 1736 } else { 1737 currentTallest = el.clientHeight; 1738 } 1739 1740 if (!!minHeight) { 1741 if (currentTallest < minHeight || currentTallest == undefined) currentTallest = parseInt(minHeight); 1742 } 1743 1744 if (getClosest(el, 'header-uncode-block') != null) { 1745 el.setAttribute('data-row-header', 'true'); 1746 isHeader = true; 1747 } else { 1748 if (pageHeader == null) { 1749 var prevRow = $rowParent.previousSibling; 1750 if (prevRow != null && prevRow.innerText == 'UNCODE.initHeader();') { 1751 isFirst = true; 1752 } 1753 } 1754 } 1755 1756 menuMobileTransparent = document.querySelector('.menu-absolute.menu-transparent'); 1757 if (classie.hasClass(el, 'row-slider')) { 1758 percentHeight = el.getAttribute("data-height-ratio"); 1759 minHeight = el.getAttribute("data-minheight"); 1760 if (percentHeight == 'full') { 1761 currentTallest = parseInt(wheight); 1762 } else { 1763 currentTallest = parseInt((wheight * percentHeight) / 100); 1764 } 1765 1766 var computedStyleRow = getComputedStyle(el), 1767 computedStyleRowParent = getComputedStyle($rowParent); 1768 calculatePadding -= (parseFloat(computedStyleRow.paddingTop) + parseFloat(computedStyleRowParent.paddingTop)); 1769 calculatePadding -= (parseFloat(computedStyleRow.paddingBottom) + parseFloat(computedStyleRowParent.paddingBottom)); 1770 1771 if (isHeader || isFirst) { 1772 if ( ( isMobileTransparent && menuMobileTransparent !== null ) || wwidth > mediaQuery) { 1773 currentTallest -= menuHeight - transmenuHeight; 1774 } else { 1775 currentTallest -= menuHeight; 1776 } 1777 currentTallest += calculatePadding; 1778 } else { 1779 if ( ( isMobileTransparent && menuMobileTransparent !== null ) || wwidth > mediaQuery) { 1780 currentTallest += calculatePadding; 1781 } else { 1782 currentTallest = 'auto'; 1783 } 1784 } 1785 1786 getDivChildren(el, '.owl-carousel', function(owl, i) { 1787 owl.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1788 if (isIE) { 1789 getDivChildren(owl, '.owl-stage', function(owlIn, i) { 1790 owlIn.style.height = (currentTallest == 'auto' ? '100%' : currentTallest + 'px'); 1791 }); 1792 } 1793 }); 1794 if ( UNCODE.isFullPageSnap || classie.hasClass(masthead, 'menu-transparent') ) 1795 continue; 1796 else { 1797 if ( classie.hasClass(document.body, 'uncode-fp-menu-hide') ) { 1798 $rowParent.parentNode.style.paddingTop = menuHeight + 'px'; 1799 } 1800 } 1801 } else { 1802 if (isHeader || isFirst || UNCODE.isFullPage ) { 1803 if ( !( UNCODE.isFullPage && !classie.hasClass(masthead, 'menu-transparent') && classie.hasClass(document.body, 'uncode-fp-menu-hide') && !isHeader && !isFirst ) ) {
1804 if (isMobileTransparent || wwidth > mediaQuery) currentTallest -= menuHeight - transmenuHeight; 1805 else currentTallest -= menuHeight - secmenuHeight; 1806 } 1807 if ( UNCODE.isFullPage && classie.hasClass(document.body, 'uncode-scroll-safe-padding') && classie.hasClass(masthead, 'menu-transparent') && !classie.hasClass(document.body, 'uncode-fp-menu-hide') ) { 1808 var safeMenuHeight = parseFloat(document.body.getAttribute("data-additional-padding")) + parseFloat(menuHeight); 1809 if ( (" " + child.parentNode.className + " ").replace(/[\n\t]/g, " ").indexOf("-top-padding ") < 0 || classie.hasClass(child.parentNode, 'single-top-padding') ) { 1810 classie.addClass(child.parentNode, 'fp-safe-padding-top'); 1811 child.parentNode.style.paddingTop = safeMenuHeight + 'px'; 1812 } 1813 if ( (" " + child.parentNode.className + " ").replace(/[\n\t]/g, " ").indexOf("-bottom-padding ") < 0 || classie.hasClass(child.parentNode, 'single-bottom-padding') ) { 1814 classie.addClass(child.parentNode, 'fp-safe-padding-bottom'); 1815 child.parentNode.style.paddingBottom = safeMenuHeight + 'px'; 1816 } 1817 } 1818 if ( !classie.hasClass(masthead, 'menu-transparent') && classie.hasClass(document.body, 'uncode-fp-menu-hide') && ( isFirst || isHeader ) ) 1819 $rowParent.parentNode.style.paddingTop = menuHeight + 'px'; 1820 1821 var computedStyleRow = getComputedStyle(el), 1822 computedStyleRowParent = getComputedStyle($rowParent); 1823 calculatePadding -= (parseFloat(computedStyleRow.paddingTop) + parseFloat(computedStyleRowParent.paddingTop)); 1824 calculatePadding -= (parseFloat(computedStyleRow.paddingBottom) + parseFloat(computedStyleRowParent.paddingBottom)); 1825 1826 currentTallest += calculatePadding; 1827 1828 } else { 1829 1830 var computedStyleRow = getComputedStyle(el), 1831 computedStyleRowParent = getComputedStyle($rowParent); 1832 calculatePadding -= (parseFloat(computedStyleRow.paddingTop) + parseFloat(computedStyleRowParent.paddingTop)); 1833 calculatePadding -= (parseFloat(computedStyleRow.paddingBottom) + parseFloat(computedStyleRowParent.paddingBottom)); 1834 1835 if (wwidth > mediaQuery) currentTallest += calculatePadding; 1836 else currentTallest = 'auto'; 1837 1838 } 1839 } 1840 if ( UNCODE.isFullPage ) { 1841 currentTallest -= UNCODE.adminBarHeight; 1842 } 1843 if (!!minHeight) { 1844 if (currentTallest < minHeight || currentTallest == 'auto') currentTallest = parseInt(minHeight); 1845 } 1846 1847 if ( UNCODE.isFrontEndEditor && child !== null ) { 1848 var innerWrapper = child.querySelectorAll('.owl-carousel-wrapper.vc_uncode_slider'); 1849 if ( innerWrapper.length ) { 1850 getDivChildren(child, '.owl-carousel-wrapper.vc_uncode_slider', function(wrapper, i) { 1851 if ( wrapper !== null ) { 1852 wrapper.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1853 } else { 1854 child.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1855 } 1856 }); 1857 } else { 1858 child.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1859 } 1860 } else { 1861 //here 1862 child.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1863 } 1864 1865 if ( wwidth < mediaQuery && classie.hasClass(child, 'auto-height-device') ) { 1866 child.style.height = 'auto'; 1867 } 1868 1869 } else { 1870 currentTallest = 0; 1871 if ( UNCODE.isFrontEndEditor && child !== null ) { 1872 1873 child.style.height = ''; 1874 1875 getDivChildren(el, '.owl-carousel', function(owl, i) { 1876 owl.style.height = ''; 1877 if (isIE) { 1878 getDivChildren(owl, '.owl-stage', function(owlIn, i) { 1879 owlIn.style.height = ''; 1880 }); 1881 } 1882 }); 1883 } 1884 } 1885 1886 if (wwidth > mediaQuery) { 1887 1888 getDivChildren(el, '.column_parent', function(col, i, total) { 1889 var $col = col, 1890 $colHeight = 0, 1891 $colDiff = 0, 1892 $colPercDiff = 100; 1893 $col.oversized = false; 1894 $col.forceHeight = currentTallest; 1895 currentTallest = child.clientHeight; 1896 if ((isHeader || isFirst) && currentTallest != 'auto') currentTallest -= transmenuHeight; 1897 var getFirstCol = null, 1898 getMargin = 0, 1899 getSubMargin = 0; 1900 getDivChildren(col, '.row-child', function(obj, i, total) { 1901 var $colChild = obj, 1902 $colParent = $colChild.parentNode, 1903 computedStyleCol = getComputedStyle($colParent); 1904 parseFloat(computedStyleCol.marginTop); 1905 getSubMargin += parseFloat(computedStyleCol.marginTop); 1906 }); 1907 currentTallest += getSubMargin; 1908 getDivChildren(col, '.row-child', function(obj, i, total) { 1909 var $colChild = obj, 1910 $colInner, 1911 $colParent = $colChild.parentNode, 1912 $uncont = $colParent.parentNode; 1913 for (var it = 0; it < $colChild.childNodes.length; it++) { 1914 if ( ! classie.hasClass($colChild.childNodes[it], 'uncode-divider-wrap') ) { 1915 $colInner = $colChild.childNodes[it]; 1916 break; 1917 } 1918 } 1919 if (i == 0 && total > 1) getFirstCol = $colInner; 1920 $colChild.oversized = false;
1921 percentHeight = $colChild.getAttribute("data-height"); 1922 minHeight = $colChild.getAttribute("data-minheight"); 1923 if (percentHeight != null || minHeight != null) { 1924 if ( ! classie.hasClass($colInner, 'uncode-divider-wrap') ) 1925 $colInner.style.height = ''; 1926 $colParent.style.height = 'auto'; 1927 $uncont.style.height = '100%'; 1928 $colChild.removeAttribute("style"); 1929 var newHeight = (percentHeight != null) ? Math.ceil((currentTallest) * (percentHeight / 100)) : parseInt(minHeight); 1930 var computedStyleCol = getComputedStyle($colParent); 1931 getMargin = parseFloat(computedStyleCol.marginTop); 1932 newHeight -= (getMargin); 1933 $colPercDiff -= (percentHeight != null) ? percentHeight : 0; 1934 if (currentTallest > newHeight) { 1935 var getColHeight = outerHeight($colChild); 1936 if (getColHeight > newHeight) { 1937 $colHeight += getColHeight; 1938 $colDiff += getColHeight; 1939 $colChild.oversized = true; 1940 $col.oversized = true; 1941 $row.oversized = true; 1942 } else { 1943 $colHeight += newHeight; 1944 if ( ! classie.hasClass($colInner, 'uncode-divider-wrap') ) { 1945 $colInner.style.height = newHeight + 'px'; 1946 } 1947 } 1948 } 1949 } else { 1950 $colHeight += outerHeight($colChild); 1951 } 1952 }); 1953 if (getFirstCol != null) { 1954 getFirstCol.style.height = (parseFloat(getFirstCol.style.height) - getMargin) + 'px'; 1955 } 1956 colsArray.push({ 1957 colHeight: $colHeight, 1958 colDiv: $col 1959 }); 1960 $col.colDiff = $colDiff; 1961 $col.colPercDiff = $colPercDiff; 1962 1963 }); 1964 1965 if ($row.oversized) { 1966 child.style.height = ''; 1967 colsArray.sort(function(a, b) { 1968 if (a.colHeight < b.colHeight) return 1; 1969 if (a.colHeight > b.colHeight) return -1; 1970 return 0; 1971 }); 1972 var $totalHeight = 0; 1973 colsArray.forEach(function(col) { 1974 var $col = col.colDiv, 1975 $colHeight = col.colHeight; 1976 getDivChildren($col, '.row-child', function(obj, i, total) { 1977 var $colChild = obj, 1978 $colInner = $colChild.children[0], 1979 percentHeight = parseFloat($colChild.getAttribute("data-height")), 1980 $colParent = $colChild.parentNode, 1981 $uncont = $colParent.parentNode, 1982 newHeight; 1983 1984 $colHeight = $col.forceHeight - $col.colDiff; 1985 if (percentHeight != null) { 1986 if ($colHeight > 0) { 1987 if ($col.oversized) { 1988 if (!$colChild.oversized) { 1989 newHeight = Math.ceil(($colHeight) * (percentHeight / $col.colPercDiff)); 1990 if (i == total - 1 && total > 1) { 1991 $uncont.style.height = 'auto'; 1992 $colChild.style.display = 'none'; 1993 newHeight = outerHeight($col.parentNode) - outerHeight($uncont); 1994 $uncont.style.height = '100%'; 1995 $colChild.style.display = 'table'; 1996 } 1997 if (newHeight == 0) newHeight = Math.ceil(($col.forceHeight) * (percentHeight / 100)); 1998 $colInner.style.height = newHeight + 'px'; 1999 } 2000 } else { 2001 if ($totalHeight == 0) newHeight = Math.ceil(($colHeight) * (percentHeight / $col.colPercDiff)); 2002 else { 2003 newHeight = Math.ceil(($totalHeight) * (percentHeight / $col.colPercDiff)); 2004 } 2005 if (i == total - 1 && total > 1) { 2006 $uncont.style.height = 'auto'; 2007 $colChild.style.display = 'none'; 2008 newHeight = outerHeight($col.parentNode) - outerHeight($uncont); 2009 $uncont.style.height = '100%'; 2010 $colChild.style.display = 'table'; 2011 } 2012 $colInner.style.height = newHeight + 'px'; 2013 } 2014 } else { 2015 if ($colChild.oversized) { 2016 if ($totalHeight == 0) newHeight = Math.ceil(($colHeight) * (percentHeight / $col.colPercDiff)); 2017 else { 2018 if ($col.colPercDiff == 0) $col.colPercDiff = 100; 2019 newHeight = Math.ceil(($totalHeight) * (percentHeight / $col.colPercDiff)); 2020 } 2021 if (i == total - 1 && total > 1) { 2022 $uncont.style.height = 'auto'; 2023 $colChild.style.display = 'none'; 2024 newHeight = outerHeight($col.parentNode) - outerHeight($uncont); 2025 $uncont.style.height = '100%'; 2026 $colChild.style.display = 'table'; 2027 } 2028 //and here 2029 $colInner.style.height = newHeight + 'px'; 2030 } 2031 } 2032 } 2033 }); 2034 var uncell = $col.getElementsByClassName('uncell'); 2035 if (uncell[0] != undefined && $totalHeight == 0) $totalHeight = outerHeight(uncell[0]); 2036 }); 2037 } 2038 if (isFF) { 2039 getDivChildren(el, '.uncoltable', function(col, i, total) { 2040 if (col.style.minHeight != '') { 2041 col.style.height = ''; 2042 } 2043 }); 2044 } 2045 if (resized) { 2046 getDivChildren(el, '.row-child > .row-inner', function(obj, k, total) { 2047 if (obj.style.height == '') { 2048 if (wwidth > mediaQueryMobile) { 2049 var getStyle = (window.getComputedStyle((obj.parentNode), null)), 2050 getInnerHeight = (parseInt(obj.parentNode.clientHeight) - parseInt(getStyle.paddingTop) - parseInt(getStyle.paddingBottom)); 2051 obj.style.height = getInnerHeight + 'px'; 2052 //obj.style.marginBottom = '-1px'; 2053 } 2054 } 2055 }); 2056 getDivChildren(el, '.row-parent > .row-inner', function(obj, k, total) { 2057 if (obj.style.height != '') { 2058 var getStyle = (window.getComputedStyle((obj.parentNode), null)), 2059 getInnerHeight = (parseInt(obj.parentNode.clientHeight) - parseInt(getStyle.paddingTop) - parseInt(getStyle.paddingBottom)), 2060 getTempHeight = parseInt(obj.style.height); 2061 if (getInnerHeight > getTempHeight && ( obj.parentNode.parentNode == null || ! classie.hasClass(obj.parentNode.parentNode, 'pin-trigger') ) ) { 2062 obj.style.height = getInnerHeight + 'px'; 2063 //obj.style.marginBottom = '-1px'; 2064 } 2065 } 2066 }); 2067 } 2068 } else { 2069 if (isFF) { 2070 getDivChildren(el, '.uncoltable', function(col, i, total) { 2071 if (col.style.minHeight != '') { 2072 col.style.height = ''; 2073 col.style.height = outerHeight(col.parentNode) + 'px'; 2074 } 2075 }); 2076 } 2077 if (isIE && (wwidth > mediaQueryMobile)) { 2078 if (child.style.height == 'auto') { 2079 child.style.height = outerHeight(child) + 'px'; 2080 } 2081 } 2082 } 2083 if (isFF) { 2084 var sliderColumnFix = document.querySelector('.uncode-slider .row-inner > .column_child:only-child'); 2085 if (sliderColumnFix != null) { 2086 if (wwidth > mediaQuery) { 2087 sliderColumnFix.style.setProperty("height", ""); 2088 } else { 2089 sliderColumnFix.style.setProperty("height", ""); 2090 sliderColumnFix.style.setProperty("height", outerHeight(sliderColumnFix.parentNode) + "px", "important"); 2091 } 2092 } 2093 } 2094 container[i].dispatchEvent(new CustomEvent('setResized')); 2095 }; 2096 if ( resized || UNCODE.isFrontEndEditor ) { 2097 window.scroll(0, scrollRowHeight_fix); 2098 } 2099 }, 2100 headerHeight = function(container) {
2101 menuMobileTransparent = document.querySelector('.menu-absolute.menu-transparent'); 2102 forEachElement(container, function(el, i) { 2103 var getHeight = el.getAttribute("data-height"), 2104 newHeight = ((wheight * getHeight) / 100); 2105 if (getHeight != 'fixed' && newHeight != 0) { 2106 if ( ( isMobileTransparent && menuMobileTransparent !== null ) || wwidth > mediaQuery) newHeight -= menuHeight - transmenuHeight; 2107 else newHeight -= menuHeight - secmenuHeight; 2108 el.style.height = newHeight + 'px'; 2109 } 2110 }); 2111 if (masthead != undefined) { 2112 menuStickyMobile = UNCODE.isMobile ? document.querySelectorAll('.menu-sticky-mobile') : null; 2113 masthead.parentNode.style.height = menuHeight + 'px'; 2114 var $overlay = masthead.parentNode.parentNode.querySelector('div.overlay-menu'), 2115 $navbarmain; 2116 2117 if ( typeof $overlay == 'object' && $overlay != null ) { 2118 if ( menuStickyMobile !== null && menuStickyMobile.length ) { 2119 UNCODE.menuStickyMobileOverlay = true; 2120 $overlay.style.top = menuHeight + 'px'; 2121 } else { 2122 UNCODE.menuStickyMobileOverlay = false; 2123 $overlay.style.top = '0'; 2124 if ( isMobileTransparent && menuMobileTransparent !== null ) { 2125 $navbarmain = $overlay.querySelector('div.navbar-main'); 2126 $navbarmain.style.paddingTop = menuHeight + 'px'; 2127 } 2128 } 2129 } 2130 if (header != undefined && header.length) { 2131 if (classie.hasClass(masthead, 'menu-transparent')) { 2132 if ( ( isMobileTransparent && menuMobileTransparent !== null ) || wwidth > mediaQuery) { 2133 masthead.parentNode.style.height = '0px'; 2134 if (classie.hasClass(masthead, 'menu-add-padding')) { 2135 for (var j = 0; j < header.length; j++) { 2136 var headerel = header[j]; 2137 var headerBlock = getClosest(headerel, 'header-uncode-block'); 2138 if (headerBlock != null) { 2139 var parentRow = headerBlock.querySelector('.vc_row'), 2140 innerRows; 2141 if ( parentRow !== null ) { 2142 innerRows = parentRow.querySelectorAll('.column_parent > .uncol > .uncoltable > .uncell > .uncont, .uncode-slider .column_child > .uncol > .uncoltable > .uncell > .uncont'); 2143 } 2144 if ( innerRows != undefined && innerRows !== null ) { 2145 for (var k = 0; k < innerRows.length; k++) { 2146 if (innerRows[k] != undefined) { 2147 if (wwidth > mediaQuery) innerRows[k].style.paddingTop = transmenuHeight + 'px'; 2148 else innerRows[k].style.paddingTop = (transmenuHeight - mastheadMobilePaddingTop) + 'px'; 2149 } 2150 } 2151 } 2152 } else { 2153 getDivChildren(headerel, '.header-content', function(headerContent, i) { 2154 if (wwidth > mediaQuery) headerContent.style.paddingTop = transmenuHeight + 'px'; 2155 else headerContent.style.paddingTop = (transmenuHeight - mastheadMobilePaddingTop) + 'px'; 2156 }); 2157 } 2158 } 2159 } 2160 } 2161 } 2162 } 2163 } 2164 }, 2165 initVideoComponent = function(container, classTarget) { 2166 if ( UNCODE.isFrontEndEditor ) 2167 return; 2168 getDivChildren(container, classTarget, function(el, i) { 2169 var width = outerWidth(el), 2170 pWidth, // player width, to be defined 2171 height = outerHeight(el), 2172 pHeight, // player height, tbd 2173 $tubularPlayer = (el.getElementsByTagName('iframe').length == 1) ? el.getElementsByTagName('iframe') : el.getElementsByTagName('video'), 2174 ratio = (el.getAttribute("data-ratio") != null) ? Number(el.getAttribute("data-ratio")) : typeof $tubularPlayer[0] !== 'undefined' ? $tubularPlayer[0].getAttribute("data-ratio") : '1.8', 2175 heightOffset = 80, 2176 widthOffset = heightOffset * ratio; 2177 // when screen aspect ratio differs from video, video must center and underlay one dimension 2178 if ($tubularPlayer[0] != undefined) { 2179 if (width / ratio < height) { // if new video height < window height (gap underneath) 2180 pWidth = Math.ceil((height + heightOffset) * ratio); // get new player width 2181 $tubularPlayer[0].style.width = pWidth + widthOffset + 'px'; 2182 $tubularPlayer[0].style.height = height + heightOffset + 'px'; 2183 $tubularPlayer[0].style.left = ((width - pWidth) / 2) - (widthOffset / 2) + 'px'; 2184 $tubularPlayer[0].style.top = '-' + (heightOffset / 2) + 'px'; 2185 $tubularPlayer[0].style.position = 'absolute'; 2186 } else { // new video width < window width (gap to right)
2187 pHeight = Math.ceil(width / ratio); // get new player height 2188 $tubularPlayer[0].style.width = width + widthOffset + 'px'; 2189 $tubularPlayer[0].style.height = pHeight + heightOffset + 'px'; 2190 $tubularPlayer[0].style.left = '-' + (widthOffset / 2) + 'px'; 2191 $tubularPlayer[0].style.top = ((height - pHeight) / 2) - (heightOffset / 2) + 'px'; 2192 $tubularPlayer[0].style.position = 'absolute'; 2193 } 2194 } 2195 }); 2196 }, 2197 init_overlay = function() { 2198 if ( UNCODE.isFrontEndEditor ) 2199 return; 2200 var triggerButton, 2201 globalBtnn, 2202 sequential = false, 2203 ddCloseBtn = false, 2204 closeButtons = new Array(); 2205 function toggleOverlay(btn) { 2206 if ( classie.hasClass(triggerButton, 'menu-button-offcanvas') || classie.hasClass(triggerButton, 'opening') || classie.hasClass(triggerButton, 'closing') ) { 2207 return true; 2208 } 2209 Array.prototype.forEach.call(document.querySelectorAll('div.overlay'), function(overlay) { 2210 if (btn.getAttribute('data-area') == overlay.getAttribute('data-area')) { 2211 var container = document.querySelector('div.' + btn.getAttribute('data-container')), 2212 menuCont = overlay.querySelector('.menu-container'), 2213 masthead = document.getElementById("masthead"), 2214 inputField = overlay.querySelector('.search-field'); 2215 if (classie.has(overlay, 'open')) { 2216 globalBtnn = false; 2217 window.dispatchEvent(menuClose); 2218 overlayOpened = false; 2219 classie.remove(overlay, 'open'); 2220 classie.remove(document.body, 'navbar-hover'); 2221 classie.remove(document.body, 'open-megamenu'); 2222 classie.add(overlay, 'close'); 2223 classie.remove(overlay, 'open-items'); 2224 classie.remove(document.body, 'menu-overlay-open'); 2225 classie.add(document.body, 'menu-dd-search-closing'); 2226 requestTimeout(function(){ 2227 if ( classie.has( masthead, 'style-dark-stop' ) ) { 2228 classie.remove( masthead, 'style-dark-stop' ); 2229 classie.remove( masthead, 'style-light-override' ); 2230 classie.add( masthead, 'style-dark-override' ); 2231 } else if ( classie.has( masthead, 'style-light-stop' ) ) { 2232 classie.remove( masthead, 'style-light-stop' ); 2233 classie.remove( masthead, 'style-dark-override' ); 2234 classie.add( masthead, 'style-light-override' ); 2235 } 2236 // if ( classie.has( masthead, 'is_stuck-stop' ) ) { 2237 // classie.remove( masthead, 'is_stuck-stop' ); 2238 // classie.add( masthead, 'is_stuck' ); 2239 // } 2240 classie.remove(document.documentElement, 'overlay-open'); 2241 classie.remove(document.body, 'menu-dd-search-open'); 2242 classie.remove(document.body, 'menu-dd-search-closing'); 2243 ddCloseBtn = false; 2244 }, 500); 2245 var onEndTransitionFn = function(ev) { 2246 if (transitionEvent) { 2247 if (ev.propertyName !== 'visibility') return; 2248 this.removeEventListener(transitionEvent, onEndTransitionFn); 2249 } 2250 classie.remove(overlay, 'close'); 2251 if ( sequential !== false ) { 2252 toggleOverlay(sequential); 2253 sequential = false; 2254 } 2255 }; 2256 if (transitionEvent) { 2257 overlay.addEventListener(transitionEvent, onEndTransitionFn); 2258 } else { 2259 onEndTransitionFn(); 2260 } 2261 } else if (!classie.has(overlay, 'close') && !classie.hasClass(btn, 'overlay-close')) { 2262 globalBtnn = btn; 2263 window.dispatchEvent(menuOpen); 2264 overlayOpened = true; 2265 classie.add(overlay, 'open'); 2266 if ( ( classie.hasClass(document.body, 'menu-dd-search') && wwidth > mediaQuery ) || classie.hasClass(document.body, 'menu-dd-search-mobile') ) { 2267 classie.add(document.body, 'navbar-hover'); 2268 ddCloseBtn = btn; 2269 } 2270 if ( ( classie.hasClass(document.body, 'menu-dd-search') && wwidth > mediaQuery ) ) { 2271 classie.add(document.body, 'menu-dd-search-open'); 2272 ddCloseBtn = btn; 2273 } 2274 classie.add(container, 'overlay-open'); 2275 if ( wwidth > mediaQuery && overlay.getAttribute('data-area') != 'search' ) { 2276 classie.add(document.documentElement, 'overlay-open'); 2277 classie.add(document.documentElement, 'menu-overlay-open'); 2278 } 2279 if ( classie.has( menuCont, 'style-light' ) ) { 2280 if ( classie.has( masthead, 'style-dark-override' ) && ! classie.has( masthead, 'style-light-override' ) ) { 2281 classie.remove( masthead, 'style-dark-override' ); 2282 classie.add( masthead, 'style-dark-stop' ); 2283 classie.add( masthead, 'style-light-override' ); 2284 } 2285 } else if ( classie.has( menuCont, 'style-dark' ) ) { 2286 if ( classie.has( masthead, 'style-light-override' ) && ! classie.has( masthead, 'style-dark-override' ) ) { 2287 classie.remove( masthead, 'style-light-override' ); 2288 classie.add( masthead, 'style-light-stop' ); 2289 classie.add( masthead, 'style-dark-override' ); 2290 } 2291 } 2292 // if ( classie.has( masthead, 'is_stuck' ) ) { 2293 // classie.remove( masthead, 'is_stuck' ); 2294 // classie.add( masthead, 'is_stuck-stop' ); 2295 // } 2296 if (jQuery('body.menu-overlay').length == 0 && inputField != null) { 2297 setTimeout(function() { 2298 inputField.focus(); 2299 }, 1000); 2300 } 2301 setTimeout(function() { 2302 if (classie.has(overlay, 'overlay-sequential')) classie.add(overlay, 'open-items'); 2303 }, 800); 2304 } 2305 } 2306 }); 2307 2308 if (classie.hasClass(btn, 'search-icon') || classie.hasClass(btn, 'menu-close-search') || classie.hasClass(btn, 'mobile-search-icon')) return; 2309 2310 if (classie.hasClass(triggerButton, 'close')) { 2311 UNCODE.menuOpened = false;
2312 classie.removeClass(triggerButton, 'close'); 2313 classie.addClass(triggerButton, 'closing'); 2314 Array.prototype.forEach.call(closeButtons, function(closeButton) { 2315 if (!classie.hasClass(closeButton, 'menu-close-search')) { 2316 classie.removeClass(closeButton, 'close'); 2317 classie.addClass(closeButton, 'closing'); 2318 } 2319 }); 2320 setTimeout(function() { 2321 classie.removeClass(triggerButton, 'closing'); 2322 // triggerButton.style.opacity = 1; 2323 Array.prototype.forEach.call(closeButtons, function(closeButton) { 2324 if (!classie.hasClass(closeButton, 'menu-close-search')) { 2325 classie.removeClass(closeButton, 'closing'); 2326 // closeButton.style.opacity = 0; 2327 } 2328 }); 2329 }, 1000); 2330 } else { 2331 UNCODE.menuOpened = true; 2332 // triggerButton.style.opacity = 0; 2333 var getBtnRect = !classie.hasClass(triggerButton, 'search-icon') ? triggerButton.getBoundingClientRect() : null; 2334 classie.addClass(triggerButton, 'opening'); 2335 Array.prototype.forEach.call(closeButtons, function(closeButton) { 2336 if (!classie.hasClass(closeButton, 'menu-close-search')) { 2337 // classie.addClass(triggerButton, 'close'); 2338 // if (getBtnRect != null) closeButton.setAttribute('style', 'top:' + getBtnRect.top + 'px; left:'+ getBtnRect.left + 'px !important'); 2339 classie.addClass(closeButton, 'close'); 2340 classie.addClass(closeButton, 'opening'); 2341 // closeButton.style.opacity = 1; 2342 } 2343 }); 2344 setTimeout(function() { 2345 classie.removeClass(triggerButton, 'opening'); 2346 Array.prototype.forEach.call(closeButtons, function(closeButton) { 2347 if (!classie.hasClass(closeButton, 'menu-close-search')) { 2348 classie.removeClass(closeButton, 'opening'); 2349 } 2350 }); 2351 }, 1000); 2352 window.addEventListener("resize", function() { 2353 positionCloseBtn(triggerButton, closeButtons); 2354 }); 2355 } 2356 } 2357 function positionCloseBtn(triggerButton, closeButtons){ 2358 var getBtnRect = !classie.hasClass(triggerButton, 'search-icon') ? triggerButton.getBoundingClientRect() : null; 2359 // Array.prototype.forEach.call(closeButtons, function(closeButton) { 2360 // if (!classie.hasClass(closeButton, 'menu-close-search')) { 2361 // if (getBtnRect != null) closeButton.setAttribute('style', 'top:' + getBtnRect.top + 'px; left:'+ getBtnRect.left + 'px !important'); 2362 // closeButton.style.opacity = 1; 2363 // } 2364 // }); 2365 } 2366 (function bindEscape() { 2367 document.onkeydown = function(evt) { 2368 evt = evt || window.event; 2369 var isEscape = false;
2370 if ("key" in evt) { 2371 isEscape = (evt.key == "Escape" || evt.key == "Esc"); 2372 } else { 2373 isEscape = (evt.keyCode == 27); 2374 } 2375 if (isEscape && overlayOpened) { 2376 Array.prototype.forEach.call(closeButtons, function(closeButton) { 2377 if (classie.hasClass(closeButton, 'overlay-close') && classie.hasClass(closeButton, 'menu-button-overlay')) { 2378 closeButton.click(); 2379 } 2380 }); 2381 } 2382 }; 2383 })(); 2384 Array.prototype.forEach.call(document.querySelectorAll('.trigger-overlay'), function(triggerBttn) { 2385 if ( UNCODE.menuOpened || ( (classie.hasClass(document.body, 'vmenu') || classie.hasClass(triggerBttn, 'menu-button-offcanvas')) && UNCODE.wwidth >= 960 ) ) return; 2386 triggerBttn.addEventListener('click', function(e) { 2387 triggerButton = e.currentTarget; 2388 // if (wwidth < mediaQuery && classie.hasClass(triggerButton, 'search-icon')) { 2389 if ( wwidth < mediaQuery && triggerButton.getAttribute('data-area') != 'search' ) { 2390 return true; 2391 } else { 2392 e.stopPropagation(); 2393 // if (wwidth > mediaQuery) toggleOverlay(triggerButton); 2394 // else { 2395 // if (classie.addClass(triggerButton, 'search-icon')) return true; 2396 // } 2397 if ( triggerButton.getAttribute('data-area') == 'search' ) { 2398 if ( globalBtnn !== undefined && globalBtnn !== false && globalBtnn !== triggerButton ) { 2399 sequential = triggerButton; 2400 globalBtnn.dispatchEvent(new Event("click")); 2401 } else { 2402 window.dispatchEvent(new CustomEvent('menuMobileTrigged')); 2403 toggleOverlay(triggerButton); 2404 } 2405 } else { 2406 window.dispatchEvent(new CustomEvent('menuMobileTrigged')); 2407 toggleOverlay(triggerButton); 2408 } 2409 e.preventDefault(); 2410 return false; 2411 } 2412 }, false); 2413 }); 2414 Array.prototype.forEach.call(document.querySelectorAll('.overlay-close, .menu-button-overlay'), function(closeBttn) { 2415 closeButtons.push(closeBttn); 2416 if ( classie.hasClass(closeBttn, 'menu-close-search') ) { 2417 closeBttn.addEventListener('click', function(e) { 2418 // if (wwidth > mediaQuery) toggleOverlay(closeBttn); 2419 toggleOverlay(closeBttn); 2420 e.preventDefault(); 2421 return false; 2422 }, false); 2423 } 2424 }); 2425 document.body.addEventListener('click', function(e) { 2426 if ( ddCloseBtn !== false ) { 2427 var close_overlay = getClosest( e.target, 'overlay-search'); 2428 if ( close_overlay === null ) { 2429 toggleOverlay(ddCloseBtn); 2430 } 2431 } 2432 }); 2433 document.addEventListener('keydown', function(e) { 2434 e = e || window.event; 2435 if ( ddCloseBtn !== false && ( e.key === "Escape" || e.key === "Esc" ) ) { 2436 toggleOverlay(ddCloseBtn); 2437 } 2438 }); 2439 }, 2440 /** All scrolling functions - Begin */ 2441 /** Shrink menu **/ 2442 shrinkMenu = function(bodyTop) { 2443 if ( UNCODE.isFrontEndEditor ) 2444 return; 2445 var logoShrink, 2446 offset = 100; 2447 for (var i = 0; i < logoel.length; i++) { 2448 if (((secmenuHeight == 0) ? bodyTop > menuHeight : bodyTop > secmenuHeight + offset) && !classie.hasClass(logoel[i], 'shrinked') && (wwidth > mediaQuery)) { 2449 classie.addClass(logoel[i], 'shrinked'); 2450 if (logoMinScale != undefined) { 2451 logoShrink = logolink.children; 2452 Array.prototype.forEach.call(logoShrink, function(singleLogo) { 2453 singleLogo.style.height = logoMinScale + 'px'; 2454 singleLogo.style.lineHeight = logoMinScale + 'px'; 2455 if (classie.hasClass(singleLogo, 'text-logo')) singleLogo.style.fontSize = logoMinScale + 'px'; 2456 }); 2457 } 2458 setTimeout(function() { 2459 calculateMenuHeight(false); 2460 //window.dispatchEvent(new Event('resize')); 2461 }, 300); 2462 } else if ((((secmenuHeight == 0) ? bodyTop == 0 : bodyTop <= secmenuHeight + offset) || (wwidth < mediaQuery)) && classie.hasClass(logoel[i], 'shrinked')) { 2463 classie.removeClass(logoel[i], 'shrinked'); 2464 if (logoMinScale != undefined) { 2465 logoShrink = logolink.children; 2466 Array.prototype.forEach.call(logoShrink, function(singleLogo) { 2467 singleLogo.style.height = singleLogo.getAttribute('data-maxheight') + 'px'; 2468 singleLogo.style.lineHeight = singleLogo.getAttribute('data-maxheight') + 'px'; 2469 if (classie.hasClass(singleLogo, 'text-logo')) singleLogo.style.fontSize = singleLogo.getAttribute('data-maxheight') + 'px'; 2470 }); 2471 } 2472 setTimeout(function() { 2473 calculateMenuHeight(false); 2474 //window.dispatchEvent(new Event('resize')); 2475 }, 300); 2476 } 2477 } 2478 }, 2479 /** Switch colors menu **/ 2480 switchColorsMenu = function(bodyTop, style) { 2481 for (var i = 0; i < transmenuel.length; i++) { 2482 if (masthead.style.opacity !== 1) masthead.style.opacity = 1;
2483 if ((secmenuHeight == 0) ? bodyTop > menuHeight / 2 : bodyTop > secmenuHeight) { 2484 if (classie.hasClass(masthead, 'style-dark-original')) { 2485 logo.className = logo.className.replace("style-light", "style-dark"); 2486 } 2487 if (classie.hasClass(masthead, 'style-light-original')) { 2488 logo.className = logo.className.replace("style-dark", "style-light"); 2489 } 2490 if (style != undefined) { 2491 if (style == 'dark') { 2492 classie.removeClass(transmenuel[i], 'style-light-override'); 2493 } 2494 if (style == 'light') { 2495 classie.removeClass(transmenuel[i], 'style-dark-override'); 2496 } 2497 classie.addClass(transmenuel[i], 'style-' + style + '-override'); 2498 } 2499 } else { 2500 if (style != undefined) { 2501 if (style == 'dark') { 2502 classie.removeClass(transmenuel[i], 'style-light-override'); 2503 } 2504 if (style == 'light') { 2505 classie.removeClass(transmenuel[i], 'style-dark-override'); 2506 } 2507 classie.addClass(transmenuel[i], 'style-' + style + '-override'); 2508 } 2509 } 2510 } 2511 if (pageHeader != undefined) { 2512 if (style != undefined) { 2513 if (classie.hasClass(pageHeader, 'header-style-dark')) { 2514 classie.removeClass(pageHeader, 'header-style-dark'); 2515 } 2516 if (classie.hasClass(pageHeader, 'header-style-light')) { 2517 classie.removeClass(pageHeader, 'header-style-light'); 2518 } 2519 classie.addClass(pageHeader, 'header-style-' + style); 2520 } 2521 } 2522 }, 2523 /** VisibleRows **/ 2524 visibleRowCol = function(bodyTop) { 2525 if ( typeof visibleRows == 'object') { 2526 for (var i = 0; i < visibleRows.length; i++) { 2527 var section = visibleRows[i], 2528 sectionHeight = outerHeight(section), 2529 offSetTop = bodyTop + ( section != null ? section.getBoundingClientRect().top : 0 ), 2530 offSetPosition = wheight + bodyTop - offSetTop; 2531 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2532 classie.addClass($kenburnsInner[0], 'uncode-scroll-visible'); 2533 visibleRows[i].dispatchEvent(new CustomEvent('enter-row')); 2534 } else { 2535 classie.removeClass($kenburnsInner[0], 'uncode-scroll-visible'); 2536 visibleRows[i].dispatchEvent(new CustomEvent('exit-row')); 2537 } 2538 } 2539 } 2540 }, 2541 /** KenBurns **/ 2542 kenburnsHeader = function(bodyTop) { 2543 var value; 2544 if ( typeof kenburnsHeaders == 'object' && kenburnsHeaders.length ) { 2545 for (var i = 0; i < kenburnsHeaders.length; i++) { 2546 var section = kenburnsHeaders[i].parentNode, 2547 sectionHeight = outerHeight(section), 2548 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 2549 offSetPosition = wheight + bodyTop - offSetTop, 2550 $kenburnsInner = kenburnsHeaders[i].querySelectorAll('.header-bg'); 2551 if (classie.hasClass(kenburnsHeaders[i], 'header-carousel-wrapper')) { 2552 $kenburnsInner = kenburnsHeaders[i].querySelectorAll('.t-background-cover'); 2553 } 2554 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2555 for (var i = 0; i < $kenburnsInner.length; i++) { 2556 classie.addClass($kenburnsInner[i], 'uncode-kburns'); 2557 $kenburnsInner[i].dispatchEvent(new CustomEvent('enter-kburns')); 2558 } 2559 } else { 2560 for (var i = 0; i < $kenburnsInner.length; i++) { 2561 classie.removeClass($kenburnsInner[i], 'uncode-kburns'); 2562 $kenburnsInner[i].dispatchEvent(new CustomEvent('exit-kburns')); 2563 } 2564 } 2565 } 2566 } 2567 }, 2568 kenburnsRowCol = function(bodyTop) { 2569 var value; 2570 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2571 kenburnsRows = document.querySelectorAll('.with-kburns > .row-background > .background-wrapper, .with-kburns > .fp-tableCell > .row-background > .background-wrapper, .with-kburns > .fp-tableCell > .fp-scrollable > .fp-scroller > .row-background > .background-wrapper'); 2572 } 2573 if ( typeof kenburnsRows == 'object' && kenburnsRows.length ) { 2574 for (var i = 0; i < kenburnsRows.length; i++) { 2575 var section = kenburnsRows[i].parentNode, 2576 sectionHeight = outerHeight(section), 2577 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 2578 offSetPosition = wheight + bodyTop - offSetTop, 2579 $kenburnsInner = kenburnsRows[i].querySelectorAll('.background-inner, .header-bg'); 2580 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2581 classie.addClass($kenburnsInner[0], 'uncode-kburns'); 2582 $kenburnsInner[0].dispatchEvent(new CustomEvent('enter-kburns')); 2583 } else { 2584 classie.removeClass($kenburnsInner[0], 'uncode-kburns'); 2585 $kenburnsInner[0].dispatchEvent(new CustomEvent('exit-kburns')); 2586 } 2587 } 2588 } 2589 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2590 kenburnsCols = document.querySelectorAll('.with-kburns > .column-background > .background-wrapper'); 2591 } 2592 if ( typeof kenburnsCols == 'object' && kenburnsCols.length ) { 2593 for (var j = 0; j < kenburnsCols.length; j++) { 2594 var elm = kenburnsCols[j], 2595 $kenburnsInner = elm.querySelectorAll('.background-inner'); 2596 if (checkVisible(elm)) { 2597 classie.addClass($kenburnsInner[0], 'uncode-kburns'); 2598 $kenburnsInner[0].dispatchEvent(new CustomEvent('enter-kburns')); 2599 } else { 2600 classie.removeClass($kenburnsInner[0], 'uncode-kburns'); 2601 $kenburnsInner[0].dispatchEvent(new CustomEvent('exit-kburns')); 2602 } 2603 } 2604 } 2605 }, 2606 /** Zoom Out BackWash **/ 2607 backwashHeader = function(bodyTop) { 2608 var value; 2609 var onEndAnimationFn = function(ev){ 2610 if (animationEvent) { 2611 if (ev.animationName !== 'backwash') { 2612 return; 2613 } 2614 this.removeEventListener(animationEvent, onEndAnimationFn); 2615 } 2616 classie.addClass(ev.target, 'uncode-zoomout-already'); 2617 } 2618 if ( typeof backwashHeaders == 'object' && backwashHeaders.length ) { 2619 for (var i = 0; i < backwashHeaders.length; i++) { 2620 var section = backwashHeaders[i].parentNode, 2621 sectionHeight = outerHeight(section), 2622 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 2623 offSetPosition = wheight + bodyTop - offSetTop, 2624 $backwashInner = backwashHeaders[i].querySelectorAll('.header-bg'); 2625 2626 if ( classie.hasClass($backwashInner[0], 'uncode-video-container') ) { 2627 continue; 2628 } 2629 2630 if (classie.hasClass(backwashHeaders[i], 'header-carousel-wrapper')) { 2631 $backwashInner = backwashHeaders[i].querySelectorAll('.t-background-cover'); 2632 } 2633 2634 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2635 for (var i = 0; i < $backwashInner.length; i++) { 2636 classie.addClass($backwashInner[i], 'uncode-zoomout'); 2637 $backwashInner[i].dispatchEvent(new CustomEvent('enter-zoomout')); 2638 } 2639 } else { 2640 for (var i = 0; i < $backwashInner.length; i++) { 2641 classie.removeClass($backwashInner[i], 'uncode-zoomout'); 2642 $backwashInner[i].dispatchEvent(new CustomEvent('exit-zoomout')); 2643 } 2644 } 2645 for (var i = 0; i < $backwashInner.length; i++) { 2646 $backwashInner[i].addEventListener(animationEvent, onEndAnimationFn); 2647 } 2648 } 2649 } 2650 }, 2651 backwashRowCol = function(bodyTop) { 2652 var value; 2653 var onEndAnimationFn = function(ev){ 2654 if (animationEvent) { 2655 if (ev.animationName !== 'backwash') { 2656 return; 2657 } 2658 this.removeEventListener(animationEvent, onEndAnimationFn); 2659 } 2660 classie.addClass(ev.target, 'uncode-zoomout-already'); 2661 } 2662 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2663 backwashRows = document.querySelectorAll('.with-zoomout > .row-background > .background-wrapper, .with-zoomout > .fp-tableCell > .row-background > .background-wrapper, .with-zoomout > .fp-tableCell > .fp-scrollable > .fp-scroller > .row-background > .background-wrapper'); 2664 } 2665 if ( typeof backwashRows == 'object' && backwashRows.length ) { 2666 for (var i = 0; i < backwashRows.length; i++) { 2667 var section = backwashRows[i].parentNode, 2668 sectionHeight = outerHeight(section), 2669 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 2670 offSetPosition = wheight + bodyTop - offSetTop, 2671 $backwashInner = backwashRows[i].querySelectorAll('.background-inner'); 2672 2673 if ( classie.hasClass($backwashInner[0], 'uncode-video-container') ) { 2674 continue; 2675 } 2676 2677 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight) ) { 2678 classie.addClass($backwashInner[0], 'uncode-zoomout'); 2679 $backwashInner[0].dispatchEvent(new CustomEvent('enter-zoomout')); 2680 } else { 2681 classie.removeClass($backwashInner[0], 'uncode-zoomout'); 2682 $backwashInner[0].dispatchEvent(new CustomEvent('exit-zoomout')); 2683 } 2684 $backwashInner[0].addEventListener(animationEvent, onEndAnimationFn); 2685 } 2686 2687 } 2688 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2689 backwashCols = document.querySelectorAll('.with-zoomout > .column-background > .background-wrapper'); 2690 } 2691 if ( typeof backwashCols == 'object' && backwashCols.length ) { 2692 for (var j = 0; j < backwashCols.length; j++) { 2693 var elm = backwashCols[j], 2694 $backwashInner = elm.querySelectorAll('.background-inner'); 2695 if (checkVisible(elm)) { 2696 classie.addClass($backwashInner[0], 'uncode-zoomout'); 2697 $backwashInner[0].dispatchEvent(new CustomEvent('enter-zoomout')); 2698 } else { 2699 classie.removeClass($backwashInner[0], 'uncode-zoomout'); 2700 $backwashInner[0].dispatchEvent(new CustomEvent('exit-zoomout')); 2701 } 2702 $backwashInner[0].addEventListener(animationEvent, onEndAnimationFn); 2703 } 2704 } 2705 }, 2706 /** Parallax Rows **/
2707 parallaxRowCol = function(bodyTop) { 2708 var value; 2709 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2710 parallaxRows = document.querySelectorAll('.with-parallax > .row-background > .background-wrapper, .with-parallax > .fp-tableCell > .row-background > .background-wrapper, .with-parallax > .fp-tableCell > .fp-scrollable > .fp-scroller > .row-background > .background-wrapper'); 2711 } 2712 if (typeof parallaxRows == 'object') { 2713 for (var i = 0; i < parallaxRows.length; i++) { 2714 var section = parallaxRows[i].parentNode, 2715 thisHeight = outerHeight(parallaxRows[i]), 2716 sectionHeight = outerHeight(section), 2717 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 2718 offSetPosition = wheight + bodyTop - offSetTop; 2719 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2720 value = ((offSetPosition - wheight) * speedDivider); 2721 if (Math.abs(value) < (thisHeight - sectionHeight)) {
2722 translateElement(parallaxRows[i], Math.floor(value)); 2723 } else { 2724 translateElement(parallaxRows[i], Math.floor(thisHeight - sectionHeight)); 2725 } 2726 } 2727 } 2728 } 2729 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2730 parallaxCols = document.querySelectorAll('.with-parallax > .column-background > .background-wrapper'); 2731 } 2732 if (typeof parallaxCols == 'object') { 2733 for (var j = 0; j < parallaxCols.length; j++) { 2734 var section = parallaxCols[j].parentNode, 2735 thisHeight = outerHeight(parallaxCols[j]), 2736 sectionHeight = outerHeight(section), 2737 offSetTop = bodyTop + (section != null ? section.getBoundingClientRect().top : 0), 2738 offSetPosition = wheight + bodyTop - offSetTop; 2739 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2740 value = ((offSetPosition - wheight) * speedDivider); 2741 value *= .8; 2742 if (Math.abs(value) < (thisHeight - sectionHeight)) { 2743 translateElement(parallaxCols[j], Math.floor(value)); 2744 } else { 2745 translateElement(parallaxCols[j], Math.floor(thisHeight - sectionHeight)); 2746 } 2747 } 2748 } 2749 } 2750 }, 2751 /** Parallax Headers **/ 2752 parallaxHeader = function(bodyTop) { 2753 var value; 2754 if (typeof parallaxHeaders == 'object') { 2755 for (var i = 0; i < parallaxHeaders.length; i++) { 2756 var section = parallaxHeaders[i].parentNode, 2757 thisSibling = section.nextSibling, 2758 thisHeight, 2759 sectionHeight, 2760 offSetTop, 2761 offSetPosition; 2762 if (classie.hasClass(parallaxHeaders[i], 'header-carousel-wrapper')) { 2763 getDivChildren(parallaxHeaders[i], '.t-entry-visual-cont', function(item, l, total) { 2764 thisHeight = outerHeight(item); 2765 sectionHeight = outerHeight(section); 2766 offSetTop = bodyTop + section.getBoundingClientRect().top; 2767 offSetPosition = wheight + bodyTop - offSetTop; 2768 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2769 value = ((offSetPosition - wheight) * speedDivider); 2770 if (Math.abs(value) < (thisHeight - sectionHeight)) { 2771 translateElement(item, Math.floor(value)); 2772 } 2773 } 2774 }); 2775 } else { 2776 thisHeight = outerHeight(parallaxHeaders[i]); 2777 sectionHeight = outerHeight(section); 2778 offSetTop = bodyTop + section.getBoundingClientRect().top; 2779 offSetPosition = wheight + bodyTop - offSetTop; 2780 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2781 value = ((offSetPosition - wheight) * speedDivider); 2782 if (Math.abs(value) < (thisHeight - sectionHeight)) { 2783 translateElement(parallaxHeaders[i], Math.floor(value)); 2784 } 2785 } 2786 } 2787 } 2788 } 2789 }, 2790 /** Header opacity **/ 2791 headerOpacity = function(bodyTop) { 2792 if ( UNCODE.isFrontEndEditor ) { 2793 return; 2794 } 2795 if (headerWithOpacity && headerWithOpacity.length) { 2796 var thisHeight = outerHeight(headerWithOpacity[0]); 2797 if (bodyTop > thisHeight / 8) { 2798 if (pageHeader != undefined) classie.addClass(pageHeader, 'header-scrolled'); 2799 } else { 2800 if (pageHeader != undefined) classie.removeClass(pageHeader, 'header-scrolled'); 2801 } 2802 } 2803 }, 2804 /** Show hide scroll top arrow **/ 2805 showHideScrollup = function(bodyTop) { 2806 if ( bodyTop != 0 ) { 2807 if (bodyTop > wheight || ((bodyTop + wheight) >= docheight) && docheight > 0) { 2808 classie.addClass(document.body, 'window-scrolled'); 2809 classie.removeClass(document.body, 'hide-scrollup'); 2810 if (footerScroller && footerScroller[0] != undefined) { 2811 footerScroller[0].style.display = ''; 2812 } 2813 } else { 2814 if (classie.hasClass(document.body, 'window-scrolled')) classie.addClass(document.body, 'hide-scrollup'); 2815 classie.removeClass(document.body, 'window-scrolled'); 2816 } 2817 } 2818 }, 2819 /** Fix menu **/ 2820 fixMenu = function(){ 2821 if ( UNCODE.isFrontEndEditor ) 2822 return; 2823 menuwrapper = document.querySelectorAll(".menu-wrapper"); 2824 if ( ! classie.hasClass(document.body, 'vmenu') && UNCODE.isFullPage && !UNCODE.isFullPageSnap && classie.hasClass(document.body, 'uncode-fp-menu-hide') ) { 2825 menuwrapper = document.querySelector(".menu-wrapper"); 2826 pageHeader = document.getElementById("page-header"); 2827 menuwrapper.style.position = 'fixed'; 2828 menuwrapper.style.zIndex = '5'; 2829 } 2830 }, 2831 /** Hide Menu **/ 2832 hideMenu = function(bodyTop) { 2833 if ( UNCODE.isFrontEndEditor ) 2834 return; 2835 if (UNCODE.menuOpened || bodyTop < 0) return; 2836 if (classie.hasClass(document.body, 'vmenu')) { 2837 if (wwidth < mediaQuery) menuhide = document.querySelector('#masthead .menu-hide-vertical'); 2838 else menuhide = null; 2839 } 2840 if (classie.hasClass(document.body, 'hmenu-center')) { 2841 if (wwidth > mediaQuery) menuhide = document.querySelector('#masthead .menu-hide'); 2842 else menuhide = document.querySelector('.menu-container-mobile.menu-hide'); 2843 }
2844 menuMobileTransparent = document.querySelector('.menu-absolute.menu-transparent'); 2845 if (typeof menuhide == 'object' && menuhide != null && mainmenu[0] != undefined) { 2846 var translate, 2847 scrollingDown = true; 2848 /** fix for hmenu-center **/ 2849 var sticky_element = (typeof mainmenu.item === 'undefined' ? ((wwidth > mediaQuery) ? mainmenu[0] : mainmenu[1]) : mainmenu[0]); 2850 if (lastScrollValue == bodyTop) return; 2851 2852 if (lastScrollValue > bodyTop) scrollingDown = false; 2853 else scrollingDown = true; 2854 lastScrollValue = bodyTop; 2855 2856 if (!scrollingDown) { 2857 if (!UNCODE.scrolling) { 2858 if ((secmenuHeight == 0) ? bodyTop == 0 : bodyTop < secmenuHeight) { 2859 classie.removeClass(sticky_element.parentNode, 'is_stuck'); 2860 if (classie.hasClass(masthead, 'menu-transparent')) { 2861 if (( ( isMobileTransparent && menuMobileTransparent !== null ) || wwidth > mediaQuery) && !classie.hasClass(masthead.parentNode, 'no-header')) masthead.parentNode.style.height = '0px'; 2862 } 2863 if (wwidth < mediaQuery && secmenuHeight === 0) sticky_element.style.position = 'fixed'; 2864 else sticky_element.style.position = ''; 2865 hideMenuReset(sticky_element); 2866 clearTimeout(hidingTimer); 2867 } 2868 2869 if (classie.hasClass(menuhide, 'menu-hided')) { 2870 classie.removeClass(menuhide, 'menu-hided'); 2871 hidingTimer = setTimeout(function() { 2872 classie.addClass(sticky_element.parentNode, 'is_stuck'); 2873 hideMenuReset(sticky_element); 2874 }, 400); 2875 } 2876 } 2877 } else { 2878 if (menusticky.length == 0 && bodyTop < wheight / 3) { 2879 if (sticky_element.style.position == 'fixed') sticky_element.style.position = ''; 2880 } 2881 if (bodyTop > wheight / 2) { 2882 clearTimeout(hidingTimer); 2883 if (!classie.hasClass(menuhide, 'menu-hided')) { 2884 classie.addClass(menuhide, 'menu-hided'); 2885 classie.addClass(sticky_element.parentNode, 'is_stuck'); 2886 if (sticky_element.style.position != 'fixed') { 2887 sticky_element.style.visibility = 'hidden'; 2888 sticky_element.style.position = 'fixed'; 2889 sticky_element.style.top = '0px'; 2890 } 2891 translateElement(menuhide, -UNCODE.menuMobileHeight - 1); 2892 } 2893 } 2894 } 2895 } 2896 }, 2897 hideMenuReset = function(sticky_element) { 2898 var topOffset = 0; 2899 if (sticky_element.style.visibility == 'hidden') sticky_element.style.visibility = ''; 2900 if (bodyBorder > 0) topOffset += bodyBorder; 2901 if (adminBar != null && window.getComputedStyle(adminBar,null).getPropertyValue("position") != 'fixed') adminBarHeight = 0; 2902 if (adminBarHeight > 0) topOffset += adminBarHeight; 2903 //sticky_element.style.top = topOffset + 'px'; 2904 if (!classie.hasClass(document.body, 'boxed-width') && boxWidth > 0) sticky_element.style.width = boxWidth + 'px'; 2905 translateElement(menuhide, 0); 2906 }, 2907 /** Stick Menu **/ 2908 stickMenu = function(bodyTop) { 2909 if (header && mainmenu[0] != undefined) { 2910 menuMobileTransparent = document.querySelector('.menu-absolute.menu-transparent'); 2911 if (classie.hasClass(mainmenu[0], 'vmenu-container') && wwidth > mediaQuery) return; 2912 /** fix for hmenu-center **/ 2913 var sticky_element = (typeof mainmenu.item === 'undefined' ? (( ( isMobileTransparent && menuMobileTransparent !== null ) || wwidth > mediaQuery) ? mainmenu[0] : mainmenu[1]) : mainmenu[0]); 2914 if ((secmenuHeight == 0 && ( ( isMobileTransparent && menuMobileTransparent !== null ) || wwidth > mediaQuery)) ? bodyTop > (0 + adminBarHeight) : bodyTop > (secmenuHeight + adminBarHeight)) { 2915 if (!classie.hasClass(sticky_element.parentNode, 'is_stuck')) { 2916 classie.addClass(sticky_element.parentNode, 'is_stuck'); 2917 sticky_element.style.position = 'fixed'; 2918 var getAnchorTop = bodyBorder; 2919 if (adminBar != null && window.getComputedStyle(adminBar,null).getPropertyValue("position") != 'fixed') adminBarHeight = 0; 2920 if (adminBarHeight > 0) getAnchorTop += adminBarHeight; 2921 sticky_element.style.top = getAnchorTop + 'px'; 2922 if (!classie.hasClass(document.body, 'boxed-width') && boxWidth > 0) sticky_element.style.width = boxWidth + 'px'; 2923 } 2924 } else { 2925 clearTimeout(hidingTimer); 2926 classie.removeClass(sticky_element.parentNode, 'is_stuck'); 2927 sticky_element.style.position = 'fixed';
2928 if ( ( isMobileTransparent && menuMobileTransparent !== null ) || wwidth > mediaQuery) sticky_element.style.position = ''; 2929 if (classie.hasClass(document.body, 'hmenu-center')) sticky_element.style.position = 'absolute'; 2930 sticky_element.style.top = ''; 2931 } 2932 } 2933 }, 2934 translateElement = function(element, valueY) { 2935 var translate = 'translate3d(0, ' + valueY + 'px' + ', 0)'; 2936 element.style['-webkit-transform'] = translate; 2937 element.style['-moz-transform'] = translate; 2938 element.style['-ms-transform'] = translate; 2939 element.style['-o-transform'] = translate; 2940 element.style['transform'] = translate; 2941 }, 2942 setScrollPosition, 2943 scrollFunction = function() { 2944 if ( ! UNCODE.isFullPage ) { 2945 menusticky = UNCODE.isMobile ? document.querySelectorAll('.menu-sticky-mobile') : document.querySelectorAll('.menu-sticky, .menu-sticky-vertical'); 2946 if (menusticky != undefined && menusticky.length) stickMenu(bodyTop); 2947 kenburnsHeader(bodyTop); 2948 kenburnsRowCol(bodyTop); 2949 backwashHeader(bodyTop); 2950 backwashRowCol(bodyTop); 2951 if (logoel != undefined && logoel.length && !isMobile) shrinkMenu(bodyTop); 2952 hideMenu(bodyTop); 2953 if (isMobileParallaxAllowed || !isMobile) { 2954 if (header && menusticky != undefined && menusticky.length) 2955 switchColorsMenu(bodyTop); 2956 parallaxRowCol(bodyTop); 2957 parallaxHeader(bodyTop); 2958 headerOpacity(bodyTop); 2959 visibleRowCol(bodyTop); 2960 } 2961 clearRequestTimeout(setScrollPosition); 2962 setScrollPosition = requestTimeout( function(){ 2963 scrollRowHeight_fix = window.pageYOffset; 2964 }, 100 ); 2965 } 2966 }, 2967 /** Custom Cursor **/ 2968 initCursor = function(){ 2969 var clientX, clientY; 2970 2971 var $customCursor = document.getElementById('uncode-custom-cursor'), 2972 $customPilot = document.getElementById('uncode-custom-cursor-pilot'), 2973 cursorType = 'auto', 2974 loadedCursor = false; 2975 2976 document.addEventListener("mousemove", function(e) { 2977 clientX = e.clientX; 2978 clientY = e.clientY; 2979 2980 if ( loadedCursor !== true ) { 2981 loadedCursor = true; 2982 classie.addClass($customCursor, 'loaded-cursor'); 2983 if ( $customPilot !== null ) { 2984 classie.addClass($customPilot, 'loaded-cursor'); 2985 } 2986 } 2987 }); 2988 2989 function render() { 2990 if ( $customCursor != null ) { 2991 $customCursor.style.transform = 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0)'; 2992 if ( $customPilot !== null ) { 2993 $customPilot.style.transform = 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0)'; 2994 } 2995 requestAnimationFrame(render); 2996 } 2997 }; 2998 requestAnimationFrame(render); 2999 }, 3000 3001 /** Shape Dividers **/ 3002 shapeDivider = function() { 3003 var $shape = '.uncode-divider-wrap'; 3004 3005 forEachElement($shape, function($el, i) { 3006 var elH = parseInt( $el.getAttribute('data-height') ), 3007 elHunit = $el.getAttribute('data-unit'), 3008 newEl, 3009 $parent = $el.parentNode, 3010 parentH, 3011 $svg = $el.getElementsByTagName('svg')[0]; 3012 3013 if ( elHunit == 'px' ) { 3014 3015 switch (true) { 3016 case (wwidth < 1500 && wwidth >= 1180): 3017 newEl = elH*0.8; 3018 break; 3019 3020 case (wwidth < 1180 && wwidth >= 960): 3021 newEl = elH*0.65; 3022 break; 3023 3024 case (wwidth < 960 && wwidth >= 570): 3025 newEl = elH*0.5; 3026 break; 3027 3028 case (wwidth < 570): 3029 newEl = elH*0.25; 3030 break; 3031 3032 default: 3033 newEl = elH; 3034 } 3035 3036 $el.style.height = newEl + elHunit; 3037 } 3038 3039 3040 if ( classie.hasClass($el, 'uncode-divider-preserve-ratio') && ( window.navigator.userAgent.indexOf('MSIE ') !== -1 || window.navigator.userAgent.indexOf('Trident/') !== -1 ) ) { 3041 3042 $svg.setAttribute('preserveAspectRatio','none'); 3043 3044 var sizes = $svg.getAttribute('viewBox').split(' '), 3045 svgW = sizes[2], 3046 svgH = sizes[3], 3047 newSvgW; 3048 3049 newSvgW = newEl * ( svgW / svgH ); 3050 3051 $svg.style.width = newSvgW + 'px'; 3052 3053 } 3054 }); 3055 }; 3056 if (!noScroll && document.body == null) { 3057 window.addEventListener('scroll', function(e) { 3058 if ( ! UNCODE.isFullPage ) { 3059 bodyTop = document.documentElement.scrollTop || document.body.scrollTop; 3060 scrollFunction(); 3061 showHideScrollup(bodyTop); 3062 } 3063 }, false); 3064 } 3065 window.addEventListener('uncode-quick-view-loaded', function() { 3066 document.getElementById('unmodal-content').addEventListener('scroll', function(e) { 3067 bodyTop = document.getElementById('unmodal-content').scrollTop; 3068 scrollFunction(); 3069 showHideScrollup(bodyTop); 3070 }, false); 3071 }, false); 3072 /** All scrolling functions - End */ 3073 /** help functions */ 3074 function getClosest(el, tag) { 3075 do { 3076 if (el.className != undefined && el.className.indexOf(tag) > -1) return el; 3077 } while (el = el.parentNode); 3078 // not found :( 3079 return null; 3080 } 3081 3082 function outerHeight(el, includeMargin) { 3083 if (el != null) { 3084 var height = el.offsetHeight; 3085 if (includeMargin) { 3086 var style = el.currentStyle || getComputedStyle(el); 3087 height += parseInt(style.marginTop) + parseInt(style.marginBottom); 3088 } 3089 return height; 3090 } 3091 } 3092 3093 function outerWidth(el, includeMargin) { 3094 var width = el.offsetWidth; 3095 if (includeMargin) { 3096 var style = el.currentStyle || getComputedStyle(el); 3097 width += parseInt(style.marginLeft) + parseInt(style.marginRight); 3098 } 3099 return width; 3100 } 3101 // Replicate jQuery .each method 3102 function forEachElement(selector, fn) { 3103 var elements = document.querySelectorAll(selector); 3104 for (var i = 0; i < elements.length; i++) fn(elements[i], i); 3105 } 3106 3107 function getDivChildren(containerId, selector, fn) { 3108 if (containerId !== null) { 3109 var elements = containerId.querySelectorAll(selector); 3110 for (var i = 0; i < elements.length; i++) fn(elements[i], i, elements.length); 3111 } 3112 } 3113 3114 function hideFooterScroll() { 3115 if (classie.hasClass(document.body, 'hide-scrollup')) footerScroller[0].style.display = "none"; 3116 } 3117 window.addEventListener("load", function(event) {
3118 if (SiteParameters.dynamic_srcset_active === '1') { 3119 UNCODE.adaptive_srcset_bg(); 3120 UNCODE.adaptive_srcset(false); 3121 } 3122 classie.addClass(document.body, 'uncode-loaded'); 3123 }); 3124 window.addEventListener("dynamic_srcset_load", function(event) { 3125 if (SiteParameters.dynamic_srcset_active === '1') { 3126 UNCODE.refresh_dynamic_srcset_size(false); 3127 } 3128 }); 3129 document.addEventListener("DOMContentLoaded", function(event) { 3130 UNCODE.adaptive(); 3131 boxWrapper = document.querySelectorAll('.box-wrapper'); 3132 docheight = boxWrapper[0] != undefined ? boxWrapper[0].offsetHeight : 0; 3133 // if (!classie.hasClass(document.body, 'vmenu') && !classie.hasClass(document.body, 'menu-offcanvas')) init_overlay(); 3134 init_overlay(); 3135 kenburnsRows = document.querySelectorAll('.with-kburns > .row-background > .background-wrapper, .with-kburns > .fp-tableCell > .row-background > .background-wrapper, .with-kburns > .fp-tableCell > .fp-scrollable > .fp-scroller > .row-background > .background-wrapper'); 3136 kenburnsCols = document.querySelectorAll('.with-kburns > .column-background > .background-wrapper'); 3137 backwashRows = document.querySelectorAll('.with-zoomout > .row-background > .background-wrapper, .with-zoomout > .fp-tableCell > .row-background > .background-wrapper, .with-zoomout > .fp-tableCell > .fp-scrollable > .fp-scroller > .row-background > .background-wrapper'); 3138 backwashCols = document.querySelectorAll('.with-zoomout > .column-background > .background-wrapper'); 3139 if (!UNCODE.isMobile || isMobileParallaxAllowed) { 3140 parallaxRows = document.querySelectorAll('.with-parallax > .row-background > .background-wrapper, .with-parallax > .fp-tableCell > .row-background > .background-wrapper, .with-parallax > .fp-tableCell > .fp-scrollable > .fp-scroller > .row-background > .background-wrapper'); 3141 parallaxCols = document.querySelectorAll('.with-parallax > .column-background > .background-wrapper'); 3142 } 3143 footerScroller = document.querySelectorAll('.footer-scroll-top'); 3144 if (footerScroller && footerScroller[0] != undefined) { 3145 if (transitionEvent) { 3146 footerScroller[0].addEventListener(transitionEvent, hideFooterScroll); 3147 } 3148 } 3149 Array.prototype.forEach.call(document.querySelectorAll('.row-inner'), function(el) { 3150 el.style.height = ''; 3151 el.style.marginBottom = ''; 3152 }); 3153 setRowHeight(document.querySelectorAll('.page-wrapper .row-parent, footer .row-parent')); 3154 initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)'); 3155 }); 3156 /** On resize events **/ 3157 window.addEventListener("vc-resize", function() { 3158 scrollRowHeight_fix = window.pageYOffset; 3159 Array.prototype.forEach.call(document.querySelectorAll('.row-inner'), function(el) { 3160 el.style.height = ''; 3161 el.style.marginBottom = ''; 3162 }); 3163 setRowHeight(document.querySelectorAll('.page-wrapper .row-parent, footer .row-parent'), false, true); 3164 }); 3165 var setIsScrolling; 3166 window.addEventListener("scroll", function() { 3167 UNCODE.setIsScrolling = true; 3168 clearRequestTimeout(setIsScrolling); 3169 3170 setIsScrolling = requestTimeout(function() { 3171 UNCODE.setIsScrolling = false; 3172 }, 66); 3173 }); 3174 window.addEventListener("resize", function() { 3175 scrollRowHeight_fix = window.pageYOffset; 3176 docheight = (boxWrapper != undefined && boxWrapper[0] != undefined) ? boxWrapper[0].offsetHeight : 0; 3177 var oldWidth = wwidth; 3178 UNCODE.wwidth = wwidth = window.innerWidth || document.documentElement.clientWidth; 3179 UNCODE.wheight = wheight = (window.innerHeight || document.documentElement.clientHeight) - (bodyBorder * 2); 3180 if ( isSplitMenu && typeof resizeTimer_ === 'undefined' ) centerSplitMenu(); 3181 if (isMobile && (oldWidth == wwidth)) return false; 3182 calculateMenuHeight(false); 3183 initBox(); 3184 window.dispatchEvent(boxEvent); 3185 scrollFunction(); 3186 shapeDivider(); 3187 showHideScrollup(bodyTop); 3188 clearTimeout(resizeTimer_); 3189 resizeTimer_ = setTimeout(function() { 3190 if (isSplitMenu) centerSplitMenu(); 3191 }, 10); 3192 resizeThrottle( 3193 function() { 3194 if (SiteParameters.dynamic_srcset_active === '1') { 3195 UNCODE.refresh_dynamic_srcset_size(false); 3196 } 3197 UNCODE.isMobile = UNCODE.wwidth <= UNCODE.mediaQuery; 3198 menuOpacity(); 3199 headerHeight('.header-wrapper'); 3200 }, 100 3201 ); 3202 if ( UNCODE.setIsScrolling !== true ) { 3203 clearTimeout(resizeTimer); 3204 resizeTimer = setTimeout(function() { 3205 if ( UNCODE.setIsScrolling !== true ) { 3206 UNCODE.wheight = wheight = (window.innerHeight || document.documentElement.clientHeight) - (bodyBorder * 2); 3207 Array.prototype.forEach.call(document.querySelectorAll('.row-inner'), function(el) { 3208 el.style.height = ''; 3209 el.style.marginBottom = ''; 3210 }); 3211 setRowHeight(document.querySelectorAll('.page-wrapper .row-parent, footer .row-parent'), false, true); 3212 } 3213 if (!isMobile) { 3214 initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)'); 3215 } 3216 }, 500); 3217 } 3218 }); 3219 3220 var resizeThrottle = (function () { 3221 var timer = 0; 3222 return function (callback, ms) { 3223 clearTimeout(timer); 3224 timer = setTimeout(callback, ms); 3225 }; 3226 })(); 3227 3228 /** 3229 * On DOM ready 3230 */ 3231 window.addEventListener("load", function(){ 3232 if (!UNCODE.isMobile) { 3233 setTimeout(function() { 3234 // window.dispatchEvent(UNCODE.boxEvent); 3235 if (typeof Waypoint !== 'undefined') { 3236 Waypoint.refreshAll(); 3237 } 3238 }, 2000); 3239 } 3240 //repeat it for mobile since it changes layout on carousel after DOM loading 3241 if (UNCODE.isMobile && !isMobileParallaxAllowed) { 3242 kenburnsHeader(bodyTop); 3243 kenburnsRowCol(bodyTop); 3244 } 3245 backwashHeader(bodyTop); 3246 backwashRowCol(bodyTop); 3247 scrollFunction(); 3248 showHideScrollup(bodyTop); 3249 3250 // if (document.createEvent) { // W3C 3251 // var ev = document.createEvent('Event'); 3252 // ev.initEvent('resize', true, true); 3253 // window.dispatchEvent(ev); 3254 // } else { // IE 3255 // document.fireEvent('onresize'); 3256 // } 3257 3258 scrollRowHeight_fix = window.pageYOffset; 3259 docheight = (boxWrapper != undefined && boxWrapper[0] != undefined) ? boxWrapper[0].offsetHeight : 0; 3260 var oldWidth = wwidth; 3261 UNCODE.wwidth = wwidth = window.innerWidth || document.documentElement.clientWidth; 3262 UNCODE.wheight = wheight = (window.innerHeight || document.documentElement.clientHeight) - (bodyBorder * 2); 3263 if ( isSplitMenu && typeof resizeTimer_ === 'undefined' ) { 3264 centerSplitMenu(); 3265 } 3266 3267 }, false); 3268 3269 function localStorageAvailable() { 3270 try { 3271 var storage = window['localStorage'], 3272 x = '__storage_test__'; 3273 storage.setItem(x, x); 3274 storage.removeItem(x); 3275 return true; 3276 } catch(e) { 3277 return false;
3278 } 3279 } 3280 3281 /** 3282 * Print Dialog check 3283 */ 3284 window.addEventListener("beforeprint", function(event) { 3285 UNCODE.printDialogOpen = true; 3286 }); 3287 window.addEventListener("afterprint", function(event) { 3288 UNCODE.printDialogOpen = false; 3289 window.dispatchEvent(new Event('resize')); 3290 }); 3291 3292 var UNCODE = { 3293 bodyTop: bodyTop, 3294 boxEvent: boxEvent, 3295 bodyBorder: bodyBorder, 3296 initBox: initBox, 3297 adminBarHeight: 0, 3298 menuHeight: 0, 3299 menuMobileHeight: 0, 3300 menuOpacity: menuOpacity, 3301 fixMenuHeight: fixMenuHeight, 3302 verticalRightMenu: verticalRightMenu, 3303 initHeader: initHeader, 3304 initRow: initRow, 3305 initCursor: initCursor, 3306 setRowHeight: setRowHeight, 3307 switchColorsMenu: switchColorsMenu, 3308 isMobile: isMobile, 3309 scrolling: false, 3310 menuHiding: false, 3311 menuOpened: false, 3312 menuMobileTriggerEvent: menuMobileTriggerEvent, 3313 mediaQuery: mediaQuery, 3314 mediaQueryMobile: mediaQueryMobile, 3315 initVideoComponent: initVideoComponent, 3316 hideMenu: hideMenu, 3317 wwidth: wwidth, 3318 wheight: wheight, 3319 printDialogOpen: printDialogOpen, 3320 webp_lossy_supported: SiteParameters.force_webp ? true : localStorageAvailable() && localStorage.getItem('webp_lossy_supported') === 'true' ? true : false, 3321 webp_lossless_supported: SiteParameters.force_webp ? true : localStorageAvailable() && localStorage.getItem('webp_lossless_supported') === 'true' ? true : false, 3322 }; 3323 // transport 3324 if (typeof define === 'function' && define.amd) { 3325 // AMD 3326 define(UNCODE); 3327 } else { 3328 // browser global 3329 window.UNCODE = UNCODE; 3330 } 3331 3332 UNCODE.check_webp_support = function(feature, callback) { 3333 // https://developers.google.com/speed/webp/faq#in_your_own_javascript 3334 var kTestImages = { 3335 lossy: "UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", 3336 lossless: "UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==", 3337 alpha: "UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==", 3338 // animation: "UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA" 3339 }; 3340 var img = new Image(); 3341 img.onload = function () { 3342 var result = (img.width > 0) && (img.height > 0); 3343 callback(feature, result); 3344 }; 3345 img.onerror = function () { 3346 callback(feature, false); 3347 }; 3348 img.src = "data:image/webp;base64," + kTestImages[feature]; 3349 } 3350 3351 UNCODE.check_webp_support('lossy', function (feature, isSupported) { 3352 if (isSupported) { 3353 UNCODE.webp_lossy_supported = true; 3354 if (localStorageAvailable()) { 3355 localStorage.setItem('webp_lossy_supported', true); 3356 } 3357 } 3358 }); 3359 3360 UNCODE.check_webp_support('lossless', function (feature, isSupported) { 3361 if (isSupported) { 3362 UNCODE.webp_lossless_supported = true; 3363 if (localStorageAvailable()) { 3364 localStorage.setItem('webp_lossless_supported', true); 3365 } 3366 } 3367 }); 3368 3369 UNCODE.adaptive = function() { 3370 if (SiteParameters.dynamic_srcset_active === '1') { 3371 return; 3372 } 3373 3374 var images = new Array(), 3375 getImages = document.querySelectorAll('.adaptive-async:not(.adaptive-fetching)'); 3376 for (var i = 0; i < getImages.length; i++) { 3377 var imageObj = {}, 3378 el = getImages[i]; 3379 if (classie.hasClass(el, 'woocommerce-product-gallery__image-first__img')) { 3380 continue; 3381 } 3382 classie.addClass(el, 'adaptive-fetching'); 3383 imageObj.unique = el.getAttribute('data-uniqueid'); 3384 imageObj.url = el.getAttribute('data-guid'); 3385 imageObj.path = el.getAttribute('data-path'); 3386 imageObj.singlew = el.getAttribute('data-singlew'); 3387 imageObj.singleh = el.getAttribute('data-singleh'); 3388 imageObj.origwidth = el.getAttribute('data-width'); 3389 imageObj.origheight = el.getAttribute('data-height'); 3390 imageObj.crop = el.getAttribute('data-crop'); 3391 imageObj.fixed = el.getAttribute('data-fixed') == undefined ? null : el.getAttribute('data-fixed'); 3392 imageObj.screen = window.uncodeScreen; 3393 imageObj.images = window.uncodeImages; 3394 images.push(imageObj); 3395 } 3396 3397 var post_data = { 3398 images: JSON.stringify(images), 3399 action: 'get_adaptive_async', 3400 ai_breakpoints: SiteParameters.ai_breakpoints, 3401 resize_quality: SiteParameters.resize_quality, 3402 register_metadata: SiteParameters.register_metadata, 3403 nonce_adaptive_images: SiteParameters.nonce_adaptive_images 3404 }; 3405 3406 if (images.length > 0) { 3407 var xhr = new XMLHttpRequest(); 3408 xhr.open('POST', SiteParameters.ajax_url, true); 3409 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); 3410 xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 3411 3412 xhr.onreadystatechange = function() { 3413 if (xhr.readyState == XMLHttpRequest.DONE) { 3414 if (xhr.status == 200 && xhr.responseText) { 3415 var jsonResponse = JSON.parse(xhr.responseText); 3416 3417 if (jsonResponse.success && jsonResponse.data.images) { 3418 var images = jsonResponse.data.images; 3419 3420 for (var i = 0; i < images.length; i++) { 3421 var val = images[i]; 3422 var processedImageID = val.id; 3423 var processedImageUniqueID = val.unique; 3424 var processedImageisNew = val.new_crop === true ? true : false;
3425 var getImage = document.querySelectorAll('[data-uniqueid="'+processedImageUniqueID+'"]'); 3426 3427 for (var j = 0; j < getImage.length; j++) { 3428 var attrScr = getImage[j].getAttribute('src'), 3429 replaceImg = new Image(); 3430 replaceImg.source = attrScr; 3431 replaceImg.el = getImage[j]; 3432 3433 classie.removeClass(getImage[j], 'adaptive-async'); 3434 classie.removeClass(getImage[j], 'adaptive-fetching'); 3435 3436 replaceImg.onload = function () { 3437 3438 var _this = this, 3439 parentNode = (_this.el).parentNode, 3440 placeH; 3441 3442 //Workaround for lazy-load flickering on Firefox 3443 if ( typeof parentNode.prepend == 'undefined') { 3444 if (_this.source !== null) { 3445 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3446 (_this.el).lazySrc = _this.src; 3447 3448 if (classie.hasClass((_this.el), 'lazyloaded') || classie.hasClass((_this.el), 'lazyloading')) { 3449 (_this.el).src = _this.src; 3450 (_this.el).removeAttribute('data-lazy-src'); 3451 } 3452 } else { 3453 (_this.el).src = _this.src; 3454 } 3455 } else { 3456 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3457 (_this.el).dataset.bg = _this.src; 3458 3459 if (classie.hasClass((_this.el), 'lazyloaded') || classie.hasClass((_this.el), 'lazyloading')) { 3460 (_this.el).style.backgroundImage = 'url("'+_this.src+'")'; 3461 (_this.el).removeAttribute('data-bg'); 3462 } 3463 } else { 3464 (_this.el).style.backgroundImage = 'url("'+_this.src+'")'; 3465 } 3466 } 3467 3468 classie.addClass(_this.el, 'async-done'); 3469 _this.el.dispatchEvent(new CustomEvent("async-done")); 3470 } else { 3471 if (_this.source !== null) { 3472 placeH = document.createElement("IMG"); 3473 placeH.setAttribute('class', 'placeH'); 3474 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3475 placeH.dataset.lazySrc = _this.src; 3476 3477 if (classie.hasClass(placeH, 'lazyloaded') || classie.hasClass(placeH, 'lazyloading')) { 3478 placeH.src = _this.src; 3479 placeH.removeAttribute('data-lazy-src'); 3480 } 3481 } else { 3482 placeH.src = _this.src; 3483 } 3484 placeH.style.position = 'absolute'; 3485 placeH.style.opacity = '0'; 3486 } else { 3487 placeH = document.createElement("DIV"); 3488 placeH.setAttribute('style', _this.el.getAttribute('style')); 3489 placeH.setAttribute('class', 'placeH ' + _this.el.getAttribute('class')); 3490 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3491 placeH.dataset.bg = _this.src; 3492 3493 if (classie.hasClass(placeH, 'lazyloaded') || classie.hasClass(placeH, 'lazyloading')) { 3494 placeH.style.backgroundImage = 'url("'+_this.src+'")'; 3495 placeH.removeAttribute('data-bg'); 3496 } 3497 } else { 3498 placeH.style.backgroundImage = 'url("'+_this.src+'")'; 3499 } 3500 placeH.style.backgroundSize = 'cover'; 3501 placeH.style.backgroundPosition = 'center'; 3502 placeH.style.position = 'absolute'; 3503 placeH.style.top = '0'; 3504 placeH.style.width = '100%'; 3505 placeH.style.height = '100%'; 3506 } 3507 3508 if ( !classie.hasClass( _this.el, 'box-wrapper') ) { 3509 parentNode.prepend(placeH); 3510 } 3511 3512 requestTimeout(function(){ 3513 if (_this.source !== null) { 3514 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3515 (_this.el).dataset.lazySrc = _this.src; 3516 3517 if (classie.hasClass(_this.el, 'lazyloaded') || classie.hasClass(_this.el, 'lazyloading')) { 3518 (_this.el).src = _this.src; 3519 (_this.el).removeAttribute('data-lazy-src'); 3520 } 3521 } else { 3522 (_this.el).src = _this.src; 3523 } 3524 } else { 3525 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3526 (_this.el).dataset.bg = _this.src; 3527 3528 if (classie.hasClass(_this.el, 'lazyloaded') || classie.hasClass(_this.el, 'lazyloading')) { 3529 (_this.el).style.backgroundImage = 'url("'+_this.src+'")'; 3530 (_this.el).removeAttribute('data-bg'); 3531 } 3532 } else { 3533 (_this.el).style.backgroundImage = 'url("'+_this.src+'")'; 3534 } 3535 } 3536 if ( !classie.hasClass( _this.el, 'box-wrapper') ) { 3537 parentNode.removeChild(placeH); 3538 } 3539 classie.addClass(_this.el, 'async-done'); 3540 _this.el.dispatchEvent(new CustomEvent("async-done")); 3541 }, 250); 3542 } 3543 } 3544 replaceImg.src = val.url; 3545 } 3546 3547 if (processedImageisNew && SiteParameters.optimize_shortpixel_image == true) { 3548 UNCODE.process_shortpixel_image(processedImageID); 3549 } 3550 } 3551 3552 } else { 3553 if (SiteParameters.enable_debug == true) { 3554 // This console log is disabled by default 3555 // So nothing is printed in a typical installation 3556 // 3557 // It can be enabled for debugging purposes setting 3558 // the 'uncode_enable_debug_on_js_scripts' filter to true 3559 console.log('There was an error: bad response'); 3560 } 3561 } 3562 3563 } else if (xhr.status == 400) { 3564 if (SiteParameters.enable_debug == true) { 3565 // This console log is disabled by default 3566 // So nothing is printed in a typical installation 3567 // 3568 // It can be enabled for debugging purposes setting 3569 // the 'uncode_enable_debug_on_js_scripts' filter to true 3570 console.log('There was an error 400'); 3571 } 3572 } else { 3573 if (SiteParameters.enable_debug == true) { 3574 // This console log is disabled by default 3575 // So nothing is printed in a typical installation 3576 // 3577 // It can be enabled for debugging purposes setting 3578 // the 'uncode_enable_debug_on_js_scripts' filter to true 3579 console.log('Something else other than 200 was returned'); 3580 } 3581 } 3582 } 3583 } 3584 3585 // Serialize our data 3586 var queryString = "", 3587 arrayLength = Object.keys(post_data).length, 3588 arrayCounter = 0; 3589 3590 for (var key in post_data) { 3591 queryString += key + "=" + post_data[key]; 3592 3593 if (arrayCounter < arrayLength - 1) { 3594 queryString += "&"; 3595 } 3596 3597 arrayCounter++; 3598 } 3599 3600 xhr.send(queryString); 3601 } 3602 }; 3603 3604 UNCODE.adaptive_srcset_replace_bg = function(currentRow) { 3605 if (currentRow === null) { 3606 return; 3607 } 3608
3609 var mobileBreakpoint = SiteParameters.dynamic_srcset_bg_mobile_breakpoint ? parseInt(SiteParameters.dynamic_srcset_bg_mobile_breakpoint, 10) : 570; 3610 var images = currentRow.querySelectorAll('.srcset-bg-async'); 3611 3612 for (var i = 0; i < images.length; i++) { 3613 var el = images[i]; 3614 var bg_url = el.dataset.backgroundImage; 3615 var mobile_bg_url = el.dataset.mobileBackgroundImage; 3616 3617 if (SiteParameters.activate_webp && el.dataset.backgroundImageWebp) { 3618 if ((el.dataset.mime === 'png' && UNCODE.webp_lossless_supported) || (el.dataset.mime === 'jpeg' && UNCODE.webp_lossy_supported)) { 3619 bg_url = el.dataset.backgroundImageWebp; 3620 el.dataset.backgroundImage = bg_url; 3621 el.removeAttribute('data-background-image-webp'); 3622 } 3623 } 3624 3625 if (SiteParameters.activate_webp && el.dataset.mobileBackgroundImageWebp && mobile_bg_url) { 3626 if ((el.dataset.mime === 'png' && UNCODE.webp_lossless_supported) || (el.dataset.mime === 'jpeg' && UNCODE.webp_lossy_supported)) { 3627 mobile_bg_url = el.dataset.mobileBackgroundImageWebp; 3628 el.dataset.mobileBackgroundImage = mobile_bg_url; 3629 el.removeAttribute('data-mobile-background-image-webp'); 3630 } 3631 } 3632 3633 if (screenInfo.width <= mobileBreakpoint && mobile_bg_url) { 3634 el.style.backgroundImage = 'url("' + mobile_bg_url + '")'; 3635 } else { 3636 el.style.backgroundImage = 'url("' + bg_url + '")'; 3637 } 3638 3639 classie.addClass(el, 'srcset-bg-async'); 3640 } 3641 } 3642 3643 UNCODE.adaptive_srcset_bg = function() { 3644 var mobileSize = SiteParameters.dynamic_srcset_bg_mobile_size ? parseInt(SiteParameters.dynamic_srcset_bg_mobile_size, 10) : false; 3645 3646 if (!(mobileSize > 0)) { 3647 return; 3648 } 3649 3650 var images = new Array(); 3651 var getImages = document.querySelectorAll('.srcset-bg-generate-img:not(.adaptive-fetching)'); 3652 3653 for (var i = 0; i < getImages.length; i++) { 3654 var imageObj = {}; 3655 var el = getImages[i]; 3656 3657 classie.addClass(el, 'srcset-bg-fetching'); 3658 imageObj.unique = el.getAttribute('data-uniqueid'); 3659 imageObj.url = el.getAttribute('data-guid'); 3660 imageObj.path = el.getAttribute('data-path'); 3661 imageObj.origwidth = el.getAttribute('data-width'); 3662 imageObj.origheight = el.getAttribute('data-height'); 3663 3664 images.push(imageObj); 3665 } 3666 3667 if (images.length > 0) { 3668 var post_data = { 3669 images: JSON.stringify(images), 3670 action: 'regenerate_srcset_bg_async', 3671 resize_quality: SiteParameters.resize_quality, 3672 mobile_size: mobileSize, 3673 nonce_srcset_async: SiteParameters.nonce_srcset_async 3674 }; 3675 3676 var xhr = new XMLHttpRequest(); 3677 xhr.open('POST', SiteParameters.ajax_url, true); 3678 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); 3679 xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 3680 3681 xhr.onreadystatechange = function() { 3682 if (xhr.readyState == XMLHttpRequest.DONE) { 3683 if (xhr.status == 200 && xhr.responseText) { 3684 var jsonResponse = JSON.parse(xhr.responseText); 3685 3686 if (jsonResponse.success && jsonResponse.data.images) { 3687 var processedImages = jsonResponse.data.images; 3688 3689 for (var i = 0; i < processedImages.length; i++) { 3690 var processedImageID = processedImages[i].id; 3691 var processedImageUniqueID = processedImages[i].unique; 3692 var processedImageisNew = processedImages[i].new_crop === true ? true : false; 3693 var getImage = document.querySelectorAll('[data-uniqueid="'+processedImageUniqueID+'"]'); 3694 3695 for (var j = 0; j < getImage.length; j++) { 3696 classie.removeClass(getImage[j], 'srcset-bg-fetching'); 3697 classie.addClass(getImage[j], 'srcset-bg-async-done'); 3698 getImage[j].dispatchEvent(new CustomEvent("async-done")); 3699 } 3700 3701 if (processedImageisNew && SiteParameters.optimize_shortpixel_image == true) { 3702 UNCODE.process_shortpixel_image(processedImageID); 3703 } 3704 } 3705 } else { 3706 if (SiteParameters.enable_debug == true) { 3707 // This console log is disabled by default 3708 // So nothing is printed in a typical installation 3709 // 3710 // It can be enabled for debugging purposes setting 3711 // the 'uncode_enable_debug_on_js_scripts' filter to true 3712 if (jsonResponse.success == false && jsonResponse.data.message) { 3713 console.log('There was an error: ' + jsonResponse.data.message); 3714 } else { 3715 console.log('There was an error: bad response'); 3716 } 3717 } 3718 } 3719 3720 } else if (xhr.status == 400) { 3721 if (SiteParameters.enable_debug == true) { 3722 // This console log is disabled by default 3723 // So nothing is printed in a typical installation 3724 // 3725 // It can be enabled for debugging purposes setting 3726 // the 'uncode_enable_debug_on_js_scripts' filter to true 3727 console.log('There was an error 400'); 3728 } 3729 } else { 3730 if (SiteParameters.enable_debug == true) { 3731 // This console log is disabled by default 3732 // So nothing is printed in a typical installation 3733 // 3734 // It can be enabled for debugging purposes setting 3735 // the 'uncode_enable_debug_on_js_scripts' filter to true 3736 console.log('Something else other than 200 was returned'); 3737 } 3738 } 3739 } 3740 } 3741 3742 // Serialize our data 3743 var queryString = "", 3744 arrayLength = Object.keys(post_data).length, 3745 arrayCounter = 0; 3746 3747 for (var key in post_data) { 3748 queryString += key + "=" + post_data[key]; 3749 3750 if (arrayCounter < arrayLength - 1) { 3751 queryString += "&"; 3752 } 3753 3754 arrayCounter++; 3755 } 3756 3757 xhr.send(queryString); 3758 } 3759 } 3760
3761 UNCODE.refresh_dynamic_srcset_size = function(container) { 3762 var parentSelector = container && container.length > 0 ? container[0] : document; 3763 // If 'container' is false, we assume that we are resizing generic images 3764 var images = container ? parentSelector.querySelectorAll('.srcset-auto') : parentSelector.querySelectorAll('.srcset-auto:not(.srcset-on-layout)'); 3765 3766 for (var i = 0; i < images.length; i++) { 3767 // Update srcset/sizes attributes 3768 UNCODE.set_dynamic_srcset_size(images[i]); 3769 } 3770 } 3771 3772 UNCODE.set_dynamic_srcset_size = function(el) { 3773 if (el.nodeName === 'PICTURE') { 3774 var picture_imgs = el.getElementsByTagName('img'); 3775 var picture_sources = el.getElementsByTagName('source'); 3776 if (picture_imgs.length > 0) { 3777 var picture_img = picture_imgs[0]; 3778 } 3779 if (picture_sources.length > 0 && picture_imgs.length > 0) { 3780 var picture_source = picture_sources[0]; 3781 var parent_width = el.clientWidth; 3782 var parent_height = el.clientHeight; 3783 var picture_img_width = parseInt(picture_img.getAttribute('width'), 10); 3784 var picture_img_height = parseInt(picture_img.getAttribute('height'), 10); 3785 var final_width = (picture_img_width * parent_height) / picture_img_height; 3786 picture_source.sizes = final_width + 'px'; 3787 classie.addClass(picture_source, 'srcset-sizes-done'); 3788 if (picture_source.dataset.srcset) { 3789 if (SiteParameters.activate_webp && picture_source.dataset.srcsetWebp && ((el.dataset.mime === 'png' && UNCODE.webp_lossless_supported) || (el.dataset.mime === 'jpeg' && UNCODE.webp_lossy_supported))) { 3790 picture_source.srcset = picture_source.dataset.srcsetWebp; 3791 picture_source.removeAttribute('data-srcset-webp'); 3792 } else { 3793 picture_source.srcset = picture_source.dataset.srcset; 3794 } 3795 picture_source.removeAttribute('data-srcset'); 3796 var $waitingThumb = getClosest( picture_source, 'srcset-lazy-animations'); 3797 if ( $waitingThumb != null ) { 3798 picture_img.onload = function(){ 3799 classie.removeClass( $waitingThumb, 'srcset-lazy-animations'); 3800 }; 3801 } 3802 } 3803 } 3804 if (picture_sources.length > 0 || picture_imgs.length > 0) { 3805 el.dispatchEvent(new CustomEvent("srcset-done")); 3806 } 3807 } else { 3808 if (typeof el.parentNode !== 'undefined') { 3809 if ( classie.hasClass(el.parentNode, 't-entry-drop') ) { 3810 var parent_width = el.parentNode.getAttribute('data-w'); 3811 if ( typeof parent_width !== 'undefined' && parent_width !== null ) {
3812 parent_width = UNCODE.wwidth / 12 * parseFloat( parent_width ); 3813 } 3814 } else { 3815 var parent_width = el.parentNode.parentElement.clientWidth; 3816 } 3817 el.sizes = parent_width + 'px'; 3818 classie.addClass(el, 'srcset-sizes-done'); 3819 if (el.dataset.srcset) { 3820 if (SiteParameters.activate_webp && el.dataset.srcsetWebp && ((el.dataset.mime === 'png' && UNCODE.webp_lossless_supported) || (el.dataset.mime === 'jpeg' && UNCODE.webp_lossy_supported))) { 3821 el.srcset = el.dataset.srcsetWebp; 3822 el.removeAttribute('data-srcset-webp'); 3823 } else { 3824 el.srcset = el.dataset.srcset; 3825 } 3826 el.removeAttribute('data-srcset'); 3827 var $waitingThumb = getClosest( el, 'srcset-lazy-animations'); 3828 if ( $waitingThumb != null ) { 3829 el.onload = function(){ 3830 classie.removeClass( $waitingThumb, 'srcset-lazy-animations'); 3831 }; 3832 } 3833 } 3834 el.dispatchEvent(new CustomEvent("srcset-done")); 3835 } 3836 } 3837 }; 3838 3839 UNCODE.adaptive_srcset = function(container) { 3840 var images = new Array(); 3841 var parentSelector = container ? container[0] : document; 3842 // If 'container' is false, we assume that this is a call on window load 3843 var isLoadingResize = container ? false : true; 3844 var getImages = parentSelector.querySelectorAll('.srcset-async:not(.srcset-fetching)'); 3845 var limit = SiteParameters.dynamic_srcset_bunch_limit ? parseInt(SiteParameters.dynamic_srcset_bunch_limit, 10) : 1; 3846 3847 for (var i = 0; i < getImages.length; i++) { 3848 var imageObj = {}; 3849 var el = getImages[i]; 3850 var missing_breakpoints = el.getAttribute('data-no-bp'); 3851 3852 if (isLoadingResize) { 3853 // Update srcset/sizes attributes 3854 // But skip images that are processed on other events 3855 // (isotope.onLayout for example) to avoid double calls 3856 if (!classie.hasClass(el, 'srcset-on-layout')) { 3857 UNCODE.set_dynamic_srcset_size(el); 3858 } 3859 } 3860 3861 if (missing_breakpoints) { 3862 classie.addClass(el, 'srcset-fetching'); 3863 imageObj.unique = el.getAttribute('data-uniqueid'); 3864 imageObj.url = el.getAttribute('data-guid'); 3865 imageObj.path = el.getAttribute('data-path'); 3866 imageObj.singlew = el.getAttribute('data-singlew'); 3867 imageObj.singleh = el.getAttribute('data-singleh'); 3868 imageObj.origwidth = el.getAttribute('data-width'); 3869 imageObj.origheight = el.getAttribute('data-height'); 3870 imageObj.crop = el.getAttribute('data-crop'); 3871 imageObj.fixed = el.getAttribute('data-fixed') == undefined ? null : el.getAttribute('data-fixed'); 3872 imageObj.missingbp = missing_breakpoints; 3873 3874 images.push(imageObj); 3875 } else { 3876 classie.removeClass(el, 'srcset-async'); 3877 } 3878 } 3879 3880 while (images.length > 0) { 3881 if (images.length >= limit) { 3882 var bunch_images = new Array(); 3883 for (var i = limit - 1; i >= 0; i--) { 3884 bunch_images.push(images[i]); 3885 images.splice(i, 1); 3886 } 3887 UNCODE.adaptive_srcset_async(parentSelector, bunch_images); 3888 } else { 3889 UNCODE.adaptive_srcset_async(parentSelector, images); 3890 break; 3891 } 3892 } 3893 }; 3894 3895 UNCODE.adaptive_srcset_async = function(parentSelector, images) { 3896 var post_data = { 3897 images: JSON.stringify(images), 3898 action: 'regenerate_srcset_async', 3899 resize_quality: SiteParameters.resize_quality, 3900 nonce_srcset_async: SiteParameters.nonce_srcset_async 3901 }; 3902 3903 var xhr = new XMLHttpRequest(); 3904 xhr.open('POST', SiteParameters.ajax_url, true); 3905 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); 3906 xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 3907 3908 xhr.onreadystatechange = function() { 3909 if (xhr.readyState == XMLHttpRequest.DONE) { 3910 if (xhr.status == 200 && xhr.responseText) { 3911 var jsonResponse = JSON.parse(xhr.responseText); 3912 3913 if (jsonResponse.success && jsonResponse.data.images) { 3914 var processedImages = jsonResponse.data.images; 3915 3916 for (var i = 0; i < processedImages.length; i++) { 3917 var processedImageID = processedImages[i].id; 3918 var processedImageUniqueID = processedImages[i].unique; 3919 var processedImageisNew = processedImages[i].new_crop === true ? true : false; 3920 var getImage = parentSelector.querySelectorAll('[data-uniqueid="'+processedImageUniqueID+'"]'); 3921 3922 for (var j = 0; j < getImage.length; j++) { 3923 classie.removeClass(getImage[j], 'srcset-async'); 3924 classie.removeClass(getImage[j], 'srcset-fetching'); 3925 classie.addClass(getImage[j], 'srcset-async-done'); 3926 getImage[j].dispatchEvent(new CustomEvent("async-done")); 3927 } 3928 3929 if (processedImageisNew && SiteParameters.optimize_shortpixel_image == true) { 3930 UNCODE.process_shortpixel_image(processedImageID); 3931 } 3932 } 3933 } else { 3934 if (SiteParameters.enable_debug == true) { 3935 // This console log is disabled by default 3936 // So nothing is printed in a typical installation 3937 // 3938 // It can be enabled for debugging purposes setting 3939 // the 'uncode_enable_debug_on_js_scripts' filter to true 3940 if (jsonResponse.success == false && jsonResponse.data.message) { 3941 console.log('There was an error: ' + jsonResponse.data.message); 3942 } else { 3943 console.log('There was an error: bad response'); 3944 } 3945 } 3946 } 3947 3948 } else if (xhr.status == 400) { 3949 if (SiteParameters.enable_debug == true) { 3950 // This console log is disabled by default 3951 // So nothing is printed in a typical installation 3952 // 3953 // It can be enabled for debugging purposes setting 3954 // the 'uncode_enable_debug_on_js_scripts' filter to true 3955 console.log('There was an error 400'); 3956 } 3957 } else { 3958 if (SiteParameters.enable_debug == true) { 3959 // This console log is disabled by default 3960 // So nothing is printed in a typical installation 3961 // 3962 // It can be enabled for debugging purposes setting 3963 // the 'uncode_enable_debug_on_js_scripts' filter to true 3964 console.log('Something else other than 200 was returned'); 3965 } 3966 } 3967 } 3968 } 3969 3970 // Serialize our data 3971 var queryString = "", 3972 arrayLength = Object.keys(post_data).length, 3973 arrayCounter = 0; 3974 3975 for (var key in post_data) { 3976 queryString += key + "=" + post_data[key]; 3977
3978 if (arrayCounter < arrayLength - 1) { 3979 queryString += "&"; 3980 } 3981 3982 arrayCounter++; 3983 } 3984 3985 xhr.send(queryString); 3986 }; 3987 3988})(window); 3989 3990(function(global){var startY=0;var enabled=false;var supportsPassiveOption=false;try{var opts=Object.defineProperty({},"passive",{get:function(){supportsPassiveOption=true}});window.addEventListener("test",null,opts)}catch(e){}var handleTouchmove=function(evt){var el=evt.target;while(el!==document.body&&el!==document){var style=window.getComputedStyle(el);if(!style){break}if(el.nodeName==="INPUT"&&el.getAttribute("type")==="range"){return}var scrolling=style.getPropertyValue("-webkit-overflow-scrolling");var overflowY=style.getPropertyValue("overflow-y");var height=parseInt(style.getPropertyValue("height"),10);var isScrollable=scrolling==="touch"&&(overflowY==="auto"||overflowY==="scroll");var canScroll=el.scrollHeight>el.offsetHeight;if(isScrollable&&canScroll){var curY=evt.touches?evt.touches[0].screenY:evt.screenY;var isAtTop=startY<=curY&&el.scrollTop===0;var isAtBottom=startY>=curY&&el.scrollHeight-el.scrollTop===height;if(isAtTop||isAtBottom){evt.preventDefault()}return}el=el.parentNode}evt.preventDefault()};var handleTouchstart=function(evt){startY=evt.touches?evt.touches[0].screenY:evt.screenY};var enable=function(){window.addEventListener("touchstart",handleTouchstart,supportsPassiveOption?{passive:false}:false);window.addEventListener("touchmove",handleTouchmove,supportsPassiveOption?{passive:false}:false);enabled=true};var disable=function(){window.removeEventListener("touchstart",handleTouchstart,false);window.removeEventListener("touchmove",handleTouchmove,false);enabled=false};var isEnabled=function(){return enabled};var testDiv=document.createElement("div");document.documentElement.appendChild(testDiv);testDiv.style.WebkitOverflowScrolling="touch";var scrollSupport="getComputedStyle"in window&&window.getComputedStyle(testDiv)["-webkit-overflow-scrolling"]==="touch";document.documentElement.removeChild(testDiv);if(scrollSupport){enable()}var iNoBounce={enable:enable,disable:disable,isEnabled:isEnabled};if(typeof module!=="undefined"&&module.exports){module.exports=iNoBounce}if(typeof global.define==="function"){(function(define){define("iNoBounce",[],function(){return iNoBounce})})(global.define)}else{global.iNoBounce=iNoBounce}})(this); 3991iNoBounce.disable(); 3992 3993/* Font Face Observer v2.1.0 - © Bram Stein. License: BSD-3-Clause */(function(){'use strict';var f,g=[];function l(a){g.push(a);1==g.length&&f()}function m(){for(;g.length;)g[0](),g.shift()}f=function(){setTimeout(m)};function n(a){this.a=p;this.b=void 0;this.f=[];var b=this;try{a(function(a){q(b,a)},function(a){r(b,a)})}catch(c){r(b,c)}}var p=2;function t(a){return new n(function(b,c){c(a)})}function u(a){return new n(function(b){b(a)})}function q(a,b){if(a.a==p){if(b==a)throw new TypeError;var c=!1;try{var d=b&&b.then;if(null!=b&&"object"==typeof b&&"function"==typeof d){d.call(b,function(b){c||q(a,b);c=!0},function(b){c||r(a,b);c=!0});return}}catch(e){c||r(a,e);return}a.a=0;a.b=b;v(a)}} 3994function r(a,b){if(a.a==p){if(b==a)throw new TypeError;a.a=1;a.b=b;v(a)}}function v(a){l(function(){if(a.a!=p)for(;a.f.length;){var b=a.f.shift(),c=b[0],d=b[1],e=b[2],b=b[3];try{0==a.a?"function"==typeof c?e(c.call(void 0,a.b)):e(a.b):1==a.a&&("function"==typeof d?e(d.call(void 0,a.b)):b(a.b))}catch(h){b(h)}}})}n.prototype.g=function(a){return this.c(void 0,a)};n.prototype.c=function(a,b){var c=this;return new n(function(d,e){c.f.push([a,b,d,e]);v(c)})}; 3995function w(a){return new n(function(b,c){function d(c){return function(d){h[c]=d;e+=1;e==a.length&&b(h)}}var e=0,h=[];0==a.length&&b(h);for(var k=0;k<a.length;k+=1)u(a[k]).c(d(k),c)})}function x(a){return new n(function(b,c){for(var d=0;d<a.length;d+=1)u(a[d]).c(b,c)})};window.Promise||(window.Promise=n,window.Promise.resolve=u,window.Promise.reject=t,window.Promise.race=x,window.Promise.all=w,window.Promise.prototype.then=n.prototype.c,window.Promise.prototype["catch"]=n.prototype.g);}()); 3996 3997(function(){function l(a,b){document.addEventListener?a.addEventListener("scroll",b,!1):a.attachEvent("scroll",b)}function m(a){document.body?a():document.addEventListener?document.addEventListener("DOMContentLoaded",function c(){document.removeEventListener("DOMContentLoaded",c);a()}):document.attachEvent("onreadystatechange",function k(){if("interactive"==document.readyState||"complete"==document.readyState)document.detachEvent("onreadystatechange",k),a()})};function t(a){this.a=document.createElement("div");this.a.setAttribute("aria-hidden","true");this.a.appendChild(document.createTextNode(a));this.b=document.createElement("span");this.c=document.createElement("span");this.h=document.createElement("span");this.f=document.createElement("span");this.g=-1;this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;"; 3998this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;";this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;";this.b.appendChild(this.h);this.c.appendChild(this.f);this.a.appendChild(this.b);this.a.appendChild(this.c)} 3999function u(a,b){a.a.style.cssText="max-width:none;min-width:20px;min-height:20px;
3999display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:"+b+";"}function z(a){var b=a.a.offsetWidth,c=b+100;a.f.style.width=c+"px";a.c.scrollLeft=c;a.b.scrollLeft=a.b.scrollWidth+100;return a.g!==b?(a.g=b,!0):!1}function A(a,b){function c(){var a=k;z(a)&&a.a.parentNode&&b(a.g)}var k=a;l(a.b,c);l(a.c,c);z(a)};function B(a,b){var c=b||{};this.family=a;this.style=c.style||"normal";this.weight=c.weight||"normal";this.stretch=c.stretch||"normal"}var C=null,D=null,E=null,F=null;function G(){if(null===D)if(J()&&/Apple/.test(window.navigator.vendor)){var a=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(window.navigator.userAgent);D=!!a&&603>parseInt(a[1],10)}else D=!1;return D}function J(){null===F&&(F=!!document.fonts);return F} 4000function K(){if(null===E){var a=document.createElement("div");try{a.style.font="condensed 100px sans-serif"}catch(b){}E=""!==a.style.font}return E}function L(a,b){return[a.style,a.weight,K()?a.stretch:"","100px",b].join(" ")} 4001B.prototype.load=function(a,b){var c=this,k=a||"BESbswy",r=0,n=b||3E3,H=(new Date).getTime();return new Promise(function(a,b){if(J()&&!G()){var M=new Promise(function(a,b){function e(){(new Date).getTime()-H>=n?b(Error(""+n+"ms timeout exceeded")):document.fonts.load(L(c,'"'+c.family+'"'),k).then(function(c){1<=c.length?a():setTimeout(e,25)},b)}e()}),N=new Promise(function(a,c){r=setTimeout(function(){c(Error(""+n+"ms timeout exceeded"))},n)});Promise.race([N,M]).then(function(){clearTimeout(r);a(c)}, 4002b)}else m(function(){function v(){var b;if(b=-1!=f&&-1!=g||-1!=f&&-1!=h||-1!=g&&-1!=h)(b=f!=g&&f!=h&&g!=h)||(null===C&&(b=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),C=!!b&&(536>parseInt(b[1],10)||536===parseInt(b[1],10)&&11>=parseInt(b[2],10))),b=C&&(f==w&&g==w&&h==w||f==x&&g==x&&h==x||f==y&&g==y&&h==y)),b=!b;b&&(d.parentNode&&d.parentNode.removeChild(d),clearTimeout(r),a(c))}function I(){if((new Date).getTime()-H>=n)d.parentNode&&d.parentNode.removeChild(d),b(Error(""+ 4003n+"ms timeout exceeded"));else{var a=document.hidden;if(!0===a||void 0===a)f=e.a.offsetWidth,g=p.a.offsetWidth,h=q.a.offsetWidth,v();r=setTimeout(I,50)}}var e=new t(k),p=new t(k),q=new t(k),f=-1,g=-1,h=-1,w=-1,x=-1,y=-1,d=document.createElement("div");d.dir="ltr";u(e,L(c,"sans-serif"));u(p,L(c,"serif"));u(q,L(c,"monospace"));d.appendChild(e.a);d.appendChild(p.a);d.appendChild(q.a);document.body.appendChild(d);w=e.a.offsetWidth;x=p.a.offsetWidth;y=q.a.offsetWidth;I();A(e,function(a){f=a;v()});u(e, 4004L(c,'"'+c.family+'",sans-serif'));A(p,function(a){g=a;v()});u(p,L(c,'"'+c.family+'",serif'));A(q,function(a){h=a;v()});u(q,L(c,'"'+c.family+'",monospace'))})})};"object"===typeof module?module.exports=B:(window.FontFaceObserver=B,window.FontFaceObserver.prototype.load=B.prototype.load);}());
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.