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