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