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