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