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