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