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