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