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