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