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