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