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') && document.getElementById("logo-container-mobile") != null && document.getElementById("main-logo") != null ) { 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 || ( classie.hasClass(document.documentElement, 'firefox') && classie.hasClass(document.documentElement, 'android') ) ) { 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-right-t-left'); 1417 } else { 1418 classie.addClass($span, 'text-left-t-right'); 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 for (var wrap_k = 0; wrap_k < $line_wraps.length; wrap_k++) { 1453 var $line_wrap = $line_wraps[wrap_k]; 1454 var $parent_wrap = $line_wrap.parentNode; 1455 if ( $parent_wrap !== null ) { 1456 while ( $line_wrap.firstChild ) { 1457 $parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap); 1458 } 1459 $parent_wrap.removeChild($line_wrap); 1460 } 1461 } 1462 } 1463 1464 var createHighlightSpans = function(){ 1465 for (var high_k = 0; high_k < $text_highlight.length; high_k++) { 1466 var $highlight = $text_highlight[high_k], 1467 atts = $highlight.getAttribute('data-atts'), 1468 objAtts, 1469 styleEl = '', 1470 classEl = '', 1471 animation = false, 1472 hexRe = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i, 1473 $h_words = $highlight.querySelectorAll('.split-word'); 1474 1475 if ( typeof atts !== 'undefined' && atts != '' ) { 1476 objAtts = JSON.parse(atts); 1477 if ( typeof objAtts.bg != 'undefined' ) { 1478 if ( hexRe.test(objAtts.bg)) { 1479 styleEl += 'background-color:' + objAtts.bg + ';'; 1480 } else { 1481 classEl += ' ' + objAtts.bg; 1482 } 1483 } 1484 if ( typeof objAtts.color != 'undefined' ) { 1485 if ( hexRe.test(objAtts.color)) { 1486 styleEl += 'color:' + objAtts.color + ';'; 1487 } else {
1488 var classChild = objAtts.color; 1489 } 1490 } 1491 if ( typeof objAtts.height != 'undefined' ) { 1492 styleEl += 'height:' + objAtts.height + ';'; 1493 } 1494 if ( typeof objAtts.offset != 'undefined' ) { 1495 styleEl += 'bottom:' + objAtts.offset + ';'; 1496 } 1497 if ( typeof objAtts.opacity != 'undefined' ) { 1498 styleEl += 'opacity:' + objAtts.opacity + ';'; 1499 } 1500 if ( objAtts.animated == 'yes' ) { 1501 animation = true; 1502 } 1503 1504 } 1505 1506 for (var h_words_k = 0; h_words_k < $h_words.length; h_words_k++) { 1507 var $word = $h_words[h_words_k], 1508 $new_el = document.createElement('span'); 1509 1510 if ( typeof classChild !== 'undefined' ) { 1511 classie.addClass($word, objAtts.color); 1512 } 1513 1514 if ( h_words_k === 0 ) { 1515 classie.addClass($word, 'first-highlight'); 1516 } else if ( (h_words_k+1) === $h_words.length ) { 1517 classie.addClass($word, 'last-highlight'); 1518 } 1519 1520 $new_el.className = 'heading-text-highlight-inner' + classEl; 1521 if ( styleEl !== '' ) { 1522 $new_el.setAttribute('style', styleEl); 1523 } 1524 1525 if ( animation ) { 1526 $new_el.setAttribute('data-animated', 'yes'); 1527 } 1528 1529 $word.appendChild($new_el); 1530 1531 }; 1532 1533 var $parent_highlight = $highlight.parentNode; 1534 if ( $parent_highlight != null ) { 1535 while ( $highlight.firstChild ) { 1536 $parent_highlight.insertBefore($highlight.firstChild, $highlight); 1537 } 1538 $parent_highlight.removeChild($highlight); 1539 } 1540 } 1541 1542 } 1543 1544 var createNewLines = function(){ 1545 for (var word_k = 0; word_k < $words.length; word_k++) { 1546 var $word = $words[word_k], 1547 top = $word.offsetTop, 1548 elH = $word.offsetHeight, 1549 $next = typeof $words[(word_k+1)] !== 'undefined' ? $words[(word_k+1)] : null, 1550 nextTop = $next !== null ? $next.offsetTop : null; 1551 1552 if (lineStart) { 1553 lineArray[lineIndex] = [word_k]; 1554 1555 if (nextTop !== null && nextTop > (top + elH/2)) { 1556 lineArray[lineIndex].push(word_k); 1557 lineIndex++; 1558 lineStart = true; 1559 } else { 1560 lineStart = false;
1561 } 1562 } else { 1563 if (nextTop !== null && nextTop > (top + elH/2)) {//tollerance 1564 lineArray[lineIndex].push(word_k); 1565 lineIndex++; 1566 lineStart = true; 1567 } else if ( nextTop === null ) { 1568 lineArray[lineIndex].push(word_k); 1569 } 1570 } 1571 } 1572 1573 for (var i = 0; i < lineArray.length; i++) { 1574 var start = lineArray[i][0], 1575 end = lineArray[i][1] + 1; 1576 1577 var spanWrap = document.createElement('span'); 1578 spanWrap.className = 'heading-line-wrap'; 1579 1580 if (!end) { 1581 window.wrap(spanWrap, $words[start]); 1582 } else { 1583 for (var _i = start; _i < end; _i++) { 1584 if ( typeof $words[_i] !== 'undefined' && $words[_i] !== null ) { 1585 classie.addClass($words[_i], 'heading-temp'); 1586 $words[_i].style.zIndex = end - _i; 1587 } 1588 } 1589 var $towrap = $heading.querySelectorAll('.heading-temp'); 1590 if ( typeof $towrap[0] !== 'undefined' && $towrap[0] !== null ) { 1591 window.wrapAll(spanWrap, $towrap); 1592 for (var _i = 0; _i < $towrap.length; _i++) { 1593 classie.removeClass($towrap[_i], 'heading-temp'); 1594 } 1595 } 1596 } 1597 1598 if ( (i+1) == lineArray.length ) { 1599 classie.addClass($row, 'loaded-split-word'); 1600 } 1601 1602 classie.addClass($heading, 'heading-lined'); 1603 } 1604 lettering(); 1605 1606 } 1607 1608 removeOldLines(); 1609 createHighlightSpans(); 1610 createNewLines(); 1611 1612 $parent_el.addEventListener("owl-carousel-changed", function() { 1613 removeOldLines(); 1614 createHighlightSpans(); 1615 createNewLines(); 1616 }); 1617 1618 if ( event !== 'resize' ) { 1619 document.body.dispatchEvent(new CustomEvent('uncode_waypoints')); 1620 } 1621 1622 } 1623 } 1624 1625 var $h_markup = document.body.querySelectorAll('.font-obs'), 1626 fontArr = new Array(); 1627 1628 for (var i = 0; i < $h_markup.length; i++) { 1629 var font_to_check = $h_markup[i].getAttribute("data-font"); 1630 1631 if ( font_to_check === null ) { 1632 word_for_lines(false, el); 1633 } else { 1634 var font_weight = $h_markup[i].getAttribute("data-weight"); 1635 var font_style = $h_markup[i].getAttribute("data-style"); 1636 1637 if ( font_weight === null ) { 1638 font_weight = 'normal'; 1639 } 1640 1641 if ( font_style === null ) { 1642 font_style = 'normal'; 1643 } 1644 1645 font_to_check = font_to_check.split(','); 1646 1647 var font_val = font_to_check[0].replace(/['"]+/g, ''), 1648 font_key = '\''+font_val+'_'+font_weight+'_'+font_style+'\''; 1649 1650 if ( fontArr.indexOf( font_val+'_'+font_weight ) === -1 ) { 1651 fontArr[font_key] = {'family':font_val,'weight':font_weight,'style':font_style }; 1652 } 1653 } 1654 } 1655 1656 var counter = 0; 1657 1658 for (var key in fontArr) { 1659 if (fontArr.hasOwnProperty(key)) { 1660 var font = new FontFaceObserver(fontArr[key].family, { weight: fontArr[key].weight, style: fontArr[key].style } ); 1661 1662 font.load(null, 10000).then(function (font) { 1663 counter++; 1664 if ( counter == Object.keys(fontArr).length ) { 1665 already_font = true; 1666 requestTimeout(function(){ 1667 word_for_lines(false, el); 1668 }, 10); 1669 } 1670 }, function (error) { 1671 word_for_lines(false, el); 1672 }); 1673 } 1674 } 1675 1676 el.addEventListener("owl-carousel-initialized", function() { 1677 word_for_lines("owl-carousel-initialized", el); 1678 }); 1679 1680 el.addEventListener("vc-shortcodeView-updated", function() { 1681 word_for_lines(false, el); 1682 }); 1683 1684 window.addEventListener("resize", function() { 1685 if ( wwidth != wrapLinesWw ) { 1686 clearRequestTimeout(setWrap); 1687 setWrap = requestTimeout( function(){ 1688 wrapLinesWw = wwidth; 1689 word_for_lines('resize'); 1690 }, 100 ); 1691 } 1692 }); 1693 1694 scrollFunction(); 1695 1696 var videos = document.querySelectorAll('.wp-video-shortcode'); 1697 for (var i = 0; i < videos.length; i++) { 1698 var video = videos[i]; 1699 if ( typeof video.getAttribute('autoplay') !== 'undefined' && video.getAttribute('autoplay') !== null && ( typeof video.getAttribute('muted') === 'undefined' || video.getAttribute('muted') === null ) ) { 1700 video.oncanplay = function(e) { 1701 video.muted = true; 1702 video.play(); 1703 }; 1704 break; 1705 } 1706 } 1707 1708 // Single Product reviews counter on Page Builder module 1709 var singleProductReviewsCounter = function(){ 1710 var $reviews = document.getElementById("reviews"), 1711 $comments = $reviews != undefined ? $reviews.querySelector(".commentlist") : undefined; 1712 if ( $reviews != undefined && $comments != undefined ) { 1713 var dataReviews = $reviews.getAttribute('data-reviewed'), 1714 comments = $comments.getAttribute('data-comment-amout'), 1715 count_review_class = comments > 0 ? '' : ' hidden'; 1716 if ( typeof dataReviews == 'undefined' || dataReviews == null || dataReviews == '' ) { 1717 $reviews.setAttribute('data-reviewed', 'reviewed'); 1718 var $tabPane = getClosest($reviews, 'tab-pane'), 1719 $panel = getClosest($reviews, 'wpb_accordion_section'); 1720 if ( $tabPane != undefined) { 1721 var revID = $tabPane.getAttribute('id'), 1722 $spanTxt = document.querySelector('[data-tab-id=' + revID + '] > a > span'); 1723 1724 if ( typeof revID !== 'undefined' && revID !== '' && $spanTxt != null ) { 1725 var $spanCount = $spanTxt.querySelector('span.review-count'); 1726 if ( $spanCount != null ) { 1727 $spanCount.innerHTML = comments; 1728 } else { 1729 var textReviews = $spanTxt.innerHTML; 1730 $spanTxt.innerHTML = textReviews + ' <span class="review-count' + count_review_class + '">' + comments + '</span>'; 1731 } 1732 } 1733 } 1734 if ( $panel != undefined ) { 1735 var $spanTxt = $panel.querySelector('.panel-title > a > span'); 1736 1737 if ( $spanTxt != null ) { 1738 var $spanTxt_0 = $spanTxt; 1739 if ( $spanTxt[0] != undefined ) { 1740 $spanTxt_0 = $spanTxt[0]; 1741 } 1742 var $spanCount = $spanTxt.querySelector('span.review-count'); 1743 if ( $spanCount != null ) { 1744 $spanCount.innerHTML = comments; 1745 } else { 1746 var textReviews = $spanTxt.innerHTML; 1747 $spanTxt.innerHTML = textReviews + ' <span class="review-count' + count_review_class + '">' + comments + '</span>'; 1748 } 1749 } 1750 } 1751 } 1752 } 1753 }; 1754 singleProductReviewsCounter(); 1755 window.addEventListener( "vc_panel_title_edited", singleProductReviewsCounter ); 1756 1757 //Check for empty additional info tabs 1758 var checkEmptyAdditionalInfo = function(){ 1759 var $emptyAdditional = document.getElementById("no_additional_info"), 1760 $emptyPane, 1761 empty_pane_ID, 1762 $tabsParent, 1763 $emptyTab; 1764 if ( $emptyAdditional != undefined ) { 1765 $emptyPane = getClosest($emptyAdditional, 'tab-pane'); 1766 $tabsParent = getClosest($emptyAdditional, 'uncode-tabs'); 1767 if ( $emptyPane == undefined ) 1768 return false;
1769 empty_pane_ID = $emptyPane.getAttribute('id'); 1770 1771 $emptyTab = $tabsParent.querySelector('li[data-tab-id="' + empty_pane_ID + '"]'); 1772 $emptyTab.parentNode.removeChild($emptyTab); 1773 $emptyPane.parentNode.removeChild($emptyPane); 1774 } 1775 }; 1776 checkEmptyAdditionalInfo(); 1777 1778 }, 1779 setRowHeight = function(container, forced, resized) { 1780 var currentTallest = 0, 1781 percentHeight = 0, 1782 minHeight = 0, 1783 el, 1784 child, 1785 hasSubCols = false; 1786 if (container.length == undefined) { 1787 container = [container]; 1788 } 1789 // Loop for each container element to match their heights 1790 for (var i = 0; i < container.length; i++) { 1791 var el = container[i], 1792 $row = el, 1793 totalHeight = 0, 1794 colsArray = new Array(), 1795 calculatePadding = 0, 1796 $rowParent = $row.parentNode, 1797 isHeader = false, 1798 isFirst = false; 1799 $row.oversized = false; 1800 percentHeight = el.getAttribute("data-height-ratio"); 1801 minHeight = el.getAttribute("data-minheight"); 1802 child = (el.firstElementChild || el.firstChild); 1803 var childHeight = outerHeight(child); 1804 /** window height without header **/ 1805 if (!!percentHeight || !!minHeight || forced || (isIE && classie.hasClass(el, 'unequal')) ) { 1806 child.style.height = ''; 1807 if (!!percentHeight) { 1808 if (percentHeight == 'full') { 1809 currentTallest = parseInt(wheight); 1810 } else { 1811 currentTallest = parseInt((wheight * percentHeight) / 100); 1812 } 1813 } else { 1814 currentTallest = el.clientHeight; 1815 } 1816 1817 if (!!minHeight) { 1818 if (currentTallest < minHeight || currentTallest == undefined) currentTallest = parseInt(minHeight); 1819 } 1820 1821 if (getClosest(el, 'header-uncode-block') != null) { 1822 el.setAttribute('data-row-header', 'true'); 1823 isHeader = true; 1824 } else { 1825 if (pageHeader == null) { 1826 var prevRow = $rowParent.previousSibling; 1827 if (prevRow != null && prevRow.innerText == 'UNCODE.initHeader();') { 1828 isFirst = true; 1829 } 1830 } 1831 } 1832 1833 if (classie.hasClass(el, 'row-slider')) { 1834 percentHeight = el.getAttribute("data-height-ratio"); 1835 minHeight = el.getAttribute("data-minheight"); 1836 if (percentHeight == 'full') { 1837 currentTallest = parseInt(wheight); 1838 } else { 1839 currentTallest = parseInt((wheight * percentHeight) / 100); 1840 } 1841 1842 var computedStyleRow = getComputedStyle(el), 1843 computedStyleRowParent = getComputedStyle($rowParent); 1844 calculatePadding -= (parseFloat(computedStyleRow.paddingTop) + parseFloat(computedStyleRowParent.paddingTop)); 1845 calculatePadding -= (parseFloat(computedStyleRow.paddingBottom) + parseFloat(computedStyleRowParent.paddingBottom)); 1846 1847 if (isHeader || isFirst) { 1848 if (isMobileTransparent || wwidth > mediaQuery) currentTallest -= menuHeight - transmenuHeight; 1849 else currentTallest -= menuHeight - secmenuHeight; 1850 currentTallest += calculatePadding; 1851 } else { 1852 if (isMobileTransparent || wwidth > mediaQuery) currentTallest += calculatePadding; 1853 else currentTallest = 'auto'; 1854 } 1855 1856 getDivChildren(el, '.owl-carousel', function(owl, i) { 1857 owl.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1858 if (isIE) { 1859 getDivChildren(owl, '.owl-stage', function(owlIn, i) { 1860 owlIn.style.height = (currentTallest == 'auto' ? '100%' : currentTallest + 'px'); 1861 }); 1862 } 1863 }); 1864 if ( UNCODE.isFullPageSnap || classie.hasClass(masthead, 'menu-transparent') ) 1865 continue; 1866 else { 1867 if ( classie.hasClass(document.body, 'uncode-fp-menu-hide') ) { 1868 $rowParent.parentNode.style.paddingTop = menuHeight + 'px'; 1869 } 1870 } 1871 } else { 1872 if (isHeader || isFirst || UNCODE.isFullPage ) { 1873 if ( !( UNCODE.isFullPage && !classie.hasClass(masthead, 'menu-transparent') && classie.hasClass(document.body, 'uncode-fp-menu-hide') && !isHeader && !isFirst ) ) { 1874 if (isMobileTransparent || wwidth > mediaQuery) currentTallest -= menuHeight - transmenuHeight; 1875 else currentTallest -= menuHeight - secmenuHeight; 1876 } 1877 if ( UNCODE.isFullPage && classie.hasClass(document.body, 'uncode-scroll-safe-padding') && classie.hasClass(masthead, 'menu-transparent') && !classie.hasClass(document.body, 'uncode-fp-menu-hide') ) { 1878 var safeMenuHeight = parseFloat(document.body.getAttribute("data-additional-padding")) + parseFloat(menuHeight); 1879 if ( (" " + child.parentNode.className + " ").replace(/[\n\t]/g, " ").indexOf("-top-padding ") < 0 || classie.hasClass(child.parentNode, 'single-top-padding') ) { 1880 classie.addClass(child.parentNode, 'fp-safe-padding-top'); 1881 child.parentNode.style.paddingTop = safeMenuHeight + 'px'; 1882 } 1883 if ( (" " + child.parentNode.className + " ").replace(/[\n\t]/g, " ").indexOf("-bottom-padding ") < 0 || classie.hasClass(child.parentNode, 'single-bottom-padding') ) { 1884 classie.addClass(child.parentNode, 'fp-safe-padding-bottom'); 1885 child.parentNode.style.paddingBottom = safeMenuHeight + 'px'; 1886 } 1887 } 1888 if ( !classie.hasClass(masthead, 'menu-transparent') && classie.hasClass(document.body, 'uncode-fp-menu-hide') && ( isFirst || isHeader ) ) 1889 $rowParent.parentNode.style.paddingTop = menuHeight + 'px'; 1890 1891 var computedStyleRow = getComputedStyle(el), 1892 computedStyleRowParent = getComputedStyle($rowParent); 1893 calculatePadding -= (parseFloat(computedStyleRow.paddingTop) + parseFloat(computedStyleRowParent.paddingTop)); 1894 calculatePadding -= (parseFloat(computedStyleRow.paddingBottom) + parseFloat(computedStyleRowParent.paddingBottom)); 1895 1896 currentTallest += calculatePadding; 1897 1898 } else { 1899 1900 var computedStyleRow = getComputedStyle(el), 1901 computedStyleRowParent = getComputedStyle($rowParent); 1902 calculatePadding -= (parseFloat(computedStyleRow.paddingTop) + parseFloat(computedStyleRowParent.paddingTop)); 1903 calculatePadding -= (parseFloat(computedStyleRow.paddingBottom) + parseFloat(computedStyleRowParent.paddingBottom)); 1904 1905 if (wwidth > mediaQuery) currentTallest += calculatePadding; 1906 else currentTallest = 'auto'; 1907 1908 } 1909 } 1910 if ( UNCODE.isFullPage ) { 1911 currentTallest -= UNCODE.adminBarHeight; 1912 } 1913 if (!!minHeight) { 1914 if (currentTallest < minHeight || currentTallest == 'auto') currentTallest = parseInt(minHeight); 1915 } 1916 1917 if ( UNCODE.isFrontEndEditor && child !== null ) { 1918 var innerWrapper = child.querySelectorAll('.owl-carousel-wrapper.vc_uncode_slider'); 1919 if ( innerWrapper.length ) { 1920 getDivChildren(child, '.owl-carousel-wrapper.vc_uncode_slider', function(wrapper, i) { 1921 if ( wrapper !== null ) { 1922 wrapper.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1923 } else { 1924 child.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1925 } 1926 }); 1927 } else { 1928 child.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1929 } 1930 } else { 1931 child.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1932 } 1933 1934 if ( wwidth < mediaQuery && classie.hasClass(child, 'auto-height-device') ) { 1935 child.style.height = 'auto'; 1936 } 1937 1938 } else { 1939 currentTallest = 0; 1940 if ( UNCODE.isFrontEndEditor && child !== null ) { 1941 1942 child.style.height = ''; 1943 1944 getDivChildren(el, '.owl-carousel', function(owl, i) { 1945 owl.style.height = ''; 1946 if (isIE) { 1947 getDivChildren(owl, '.owl-stage', function(owlIn, i) { 1948 owlIn.style.height = ''; 1949 }); 1950 } 1951 }); 1952 } 1953 } 1954 1955 if (wwidth > mediaQuery) { 1956 1957 getDivChildren(el, '.column_parent', function(col, i, total) { 1958 var $col = col, 1959 $colHeight = 0, 1960 $colDiff = 0, 1961 $colPercDiff = 100; 1962 $col.oversized = false;
1963 $col.forceHeight = currentTallest; 1964 currentTallest = child.clientHeight; 1965 if ((isHeader || isFirst) && currentTallest != 'auto') currentTallest -= transmenuHeight; 1966 var getFirstCol = null, 1967 getMargin = 0, 1968 getSubMargin = 0; 1969 getDivChildren(col, '.row-child', function(obj, i, total) { 1970 var $colChild = obj, 1971 $colParent = $colChild.parentNode, 1972 computedStyleCol = getComputedStyle($colParent); 1973 parseFloat(computedStyleCol.marginTop); 1974 getSubMargin += parseFloat(computedStyleCol.marginTop); 1975 }); 1976 currentTallest += getSubMargin; 1977 getDivChildren(col, '.row-child', function(obj, i, total) { 1978 var $colChild = obj, 1979 $colInner, 1980 $colParent = $colChild.parentNode, 1981 $uncont = $colParent.parentNode; 1982 for (var it = 0; it < $colChild.childNodes.length; it++) { 1983 if ( ! classie.hasClass($colChild.childNodes[it], 'uncode-divider-wrap') ) { 1984 $colInner = $colChild.childNodes[it]; 1985 break; 1986 } 1987 } 1988 if (i == 0 && total > 1) getFirstCol = $colInner; 1989 $colChild.oversized = false; 1990 percentHeight = $colChild.getAttribute("data-height"); 1991 minHeight = $colChild.getAttribute("data-minheight"); 1992 if (percentHeight != null || minHeight != null) { 1993 if ( ! classie.hasClass($colInner, 'uncode-divider-wrap') ) 1994 $colInner.style.height = ''; 1995 $colParent.style.height = 'auto'; 1996 $uncont.style.height = '100%'; 1997 $colChild.removeAttribute("style"); 1998 var newHeight = (percentHeight != null) ? Math.ceil((currentTallest) * (percentHeight / 100)) : parseInt(minHeight); 1999 var computedStyleCol = getComputedStyle($colParent); 2000 getMargin = parseFloat(computedStyleCol.marginTop); 2001 newHeight -= (getMargin); 2002 $colPercDiff -= (percentHeight != null) ? percentHeight : 0; 2003 if (currentTallest > newHeight) { 2004 var getColHeight = outerHeight($colChild); 2005 if (getColHeight > newHeight) { 2006 $colHeight += getColHeight; 2007 $colDiff += getColHeight; 2008 $colChild.oversized = true; 2009 $col.oversized = true; 2010 $row.oversized = true; 2011 } else { 2012 $colHeight += newHeight; 2013 if ( ! classie.hasClass($colInner, 'uncode-divider-wrap') ) 2014 $colInner.style.height = newHeight + 'px'; 2015 } 2016 } 2017 } else { 2018 $colHeight += outerHeight($colChild); 2019 } 2020 }); 2021 if (getFirstCol != null) { 2022 getFirstCol.style.height = (parseFloat(getFirstCol.style.height) - getMargin) + 'px'; 2023 } 2024 colsArray.push({ 2025 colHeight: $colHeight, 2026 colDiv: $col 2027 }); 2028 $col.colDiff = $colDiff; 2029 $col.colPercDiff = $colPercDiff; 2030 2031 }); 2032 2033 if ($row.oversized) { 2034 child.style.height = ''; 2035 colsArray.sort(function(a, b) { 2036 if (a.colHeight < b.colHeight) return 1; 2037 if (a.colHeight > b.colHeight) return -1; 2038 return 0; 2039 }); 2040 var $totalHeight = 0; 2041 colsArray.forEach(function(col) { 2042 var $col = col.colDiv, 2043 $colHeight = col.colHeight; 2044 getDivChildren($col, '.row-child', function(obj, i, total) { 2045 var $colChild = obj, 2046 $colInner = $colChild.children[0], 2047 percentHeight = $colChild.getAttribute("data-height"), 2048 $colParent = $colChild.parentNode, 2049 $uncont = $colParent.parentNode, 2050 newHeight; 2051 2052 $colHeight = $col.forceHeight - $col.colDiff; 2053 if (percentHeight != null) { 2054 if ($colHeight > 0) { 2055 if ($col.oversized) { 2056 if (!$colChild.oversized) { 2057 newHeight = Math.ceil(($colHeight) * (percentHeight / $col.colPercDiff)); 2058 if (i == total - 1 && total > 1) { 2059 $uncont.style.height = 'auto'; 2060 $colChild.style.display = 'none'; 2061 newHeight = outerHeight($col.parentNode) - outerHeight($uncont); 2062 $uncont.style.height = '100%'; 2063 $colChild.style.display = 'table'; 2064 }
2065 if (newHeight == 0) newHeight = Math.ceil(($col.forceHeight) * (percentHeight / 100)); 2066 $colInner.style.height = newHeight + 'px'; 2067 } 2068 } else { 2069 if ($totalHeight == 0) newHeight = Math.ceil(($colHeight) * (percentHeight / $col.colPercDiff)); 2070 else { 2071 newHeight = Math.ceil(($totalHeight) * (percentHeight / $col.colPercDiff)); 2072 } 2073 if (i == total - 1 && total > 1) { 2074 $uncont.style.height = 'auto'; 2075 $colChild.style.display = 'none'; 2076 newHeight = outerHeight($col.parentNode) - outerHeight($uncont); 2077 $uncont.style.height = '100%'; 2078 $colChild.style.display = 'table'; 2079 } 2080 $colInner.style.height = newHeight + 'px'; 2081 } 2082 } else { 2083 if ($colChild.oversized) { 2084 if ($totalHeight == 0) newHeight = Math.ceil(($colHeight) * (percentHeight / $col.colPercDiff)); 2085 else { 2086 if ($col.colPercDiff == 0) $col.colPercDiff = 100; 2087 newHeight = Math.ceil(($totalHeight) * (percentHeight / $col.colPercDiff)); 2088 } 2089 if (i == total - 1 && total > 1) { 2090 $uncont.style.height = 'auto'; 2091 $colChild.style.display = 'none'; 2092 newHeight = outerHeight($col.parentNode) - outerHeight($uncont); 2093 $uncont.style.height = '100%'; 2094 $colChild.style.display = 'table'; 2095 } 2096 $colInner.style.height = newHeight + 'px'; 2097 } 2098 } 2099 } 2100 }); 2101 var uncell = $col.getElementsByClassName('uncell'); 2102 if (uncell[0] != undefined && $totalHeight == 0) $totalHeight = outerHeight(uncell[0]); 2103 }); 2104 } 2105 if (isFF) { 2106 getDivChildren(el, '.uncoltable', function(col, i, total) { 2107 if (col.style.minHeight != '') { 2108 col.style.height = ''; 2109 } 2110 }); 2111 } 2112 if (resized) { 2113 getDivChildren(el, '.row-child > .row-inner', function(obj, k, total) { 2114 if (obj.style.height == '') { 2115 if (wwidth > mediaQueryMobile) { 2116 var getStyle = (window.getComputedStyle((obj.parentNode), null)), 2117 getInnerHeight = (parseInt(obj.parentNode.clientHeight) - parseInt(getStyle.paddingTop) - parseInt(getStyle.paddingBottom)); 2118 obj.style.height = getInnerHeight + 'px'; 2119 //obj.style.marginBottom = '-1px'; 2120 } 2121 } 2122 }); 2123 getDivChildren(el, '.row-parent > .row-inner', function(obj, k, total) { 2124 if (obj.style.height != '') { 2125 var getStyle = (window.getComputedStyle((obj.parentNode), null)), 2126 getInnerHeight = (parseInt(obj.parentNode.clientHeight) - parseInt(getStyle.paddingTop) - parseInt(getStyle.paddingBottom)), 2127 getTempHeight = parseInt(obj.style.height); 2128 if (getInnerHeight > getTempHeight) { 2129 obj.style.height = getInnerHeight + 'px'; 2130 //obj.style.marginBottom = '-1px'; 2131 } 2132 } 2133 }); 2134 } 2135 } else { 2136 if (isFF) { 2137 getDivChildren(el, '.uncoltable', function(col, i, total) { 2138 if (col.style.minHeight != '') { 2139 col.style.height = ''; 2140 col.style.height = outerHeight(col.parentNode) + 'px'; 2141 } 2142 }); 2143 } 2144 if (isIE && (wwidth > mediaQueryMobile)) { 2145 if (child.style.height == 'auto') { 2146 child.style.height = outerHeight(child) + 'px'; 2147 } 2148 } 2149 } 2150 if (isFF) { 2151 var sliderColumnFix = document.querySelector('.uncode-slider .row-inner > .column_child:only-child'); 2152 if (sliderColumnFix != null) { 2153 if (wwidth > mediaQuery) { 2154 sliderColumnFix.style.setProperty("height", ""); 2155 } else { 2156 sliderColumnFix.style.setProperty("height", ""); 2157 sliderColumnFix.style.setProperty("height", outerHeight(sliderColumnFix.parentNode) + "px", "important"); 2158 } 2159 } 2160 } 2161 }; 2162 if ( resized || UNCODE.isFrontEndEditor ) { 2163 window.scroll(0, scrollRowHeight_fix); 2164 } 2165 }, 2166 headerHeight = function(container) { 2167 forEachElement(container, function(el, i) { 2168 var getHeight = el.getAttribute("data-height"), 2169 newHeight = ((wheight * getHeight) / 100);
2170 if (getHeight != 'fixed' && newHeight != 0) { 2171 if (isMobileTransparent || wwidth > mediaQuery) newHeight -= menuHeight - transmenuHeight; 2172 else newHeight -= menuHeight - secmenuHeight; 2173 el.style.height = newHeight + 'px'; 2174 } 2175 }); 2176 if (masthead != undefined) { 2177 masthead.parentNode.style.height = menuHeight + 'px'; 2178 if (header != undefined && header.length) { 2179 if (classie.hasClass(masthead, 'menu-transparent')) { 2180 if (isMobileTransparent || wwidth > mediaQuery) { 2181 masthead.parentNode.style.height = '0px'; 2182 if (classie.hasClass(masthead, 'menu-add-padding')) { 2183 for (var j = 0; j < header.length; j++) { 2184 var headerel = header[j]; 2185 var headerBlock = getClosest(headerel, 'header-uncode-block'); 2186 if (headerBlock != null) { 2187 var parentRow = headerBlock.querySelector('.vc_row'), 2188 innerRows = parentRow.querySelectorAll('.column_parent > .uncol > .uncoltable > .uncell > .uncont, .uncode-slider .column_child > .uncol > .uncoltable > .uncell > .uncont'); 2189 for (var k = 0; k < innerRows.length; k++) { 2190 if (innerRows[k] != undefined) { 2191 if (wwidth > mediaQuery) innerRows[k].style.paddingTop = transmenuHeight + 'px'; 2192 else innerRows[k].style.paddingTop = (transmenuHeight - mastheadMobilePaddingTop) + 'px'; 2193 } 2194 } 2195 } else { 2196 getDivChildren(headerel, '.header-content', function(headerContent, i) { 2197 if (wwidth > mediaQuery) headerContent.style.paddingTop = transmenuHeight + 'px'; 2198 else headerContent.style.paddingTop = (transmenuHeight - mastheadMobilePaddingTop) + 'px'; 2199 }); 2200 } 2201 } 2202 } 2203 } 2204 } 2205 } 2206 } 2207 }, 2208 initVideoComponent = function(container, classTarget) { 2209 if ( UNCODE.isFrontEndEditor ) 2210 return; 2211 getDivChildren(container, classTarget, function(el, i) { 2212 var width = outerWidth(el), 2213 pWidth, // player width, to be defined 2214 height = outerHeight(el), 2215 pHeight, // player height, tbd 2216 $tubularPlayer = (el.getElementsByTagName('iframe').length == 1) ? el.getElementsByTagName('iframe') : el.getElementsByTagName('video'), 2217 ratio = (el.getAttribute("data-ratio") != null) ? Number(el.getAttribute("data-ratio")) : typeof $tubularPlayer[0] !== 'undefined' ? $tubularPlayer[0].getAttribute("data-ratio") : '1.8', 2218 heightOffset = 80, 2219 widthOffset = heightOffset * ratio; 2220 // when screen aspect ratio differs from video, video must center and underlay one dimension 2221 if ($tubularPlayer[0] != undefined) { 2222 if (width / ratio < height) { // if new video height < window height (gap underneath) 2223 pWidth = Math.ceil((height + heightOffset) * ratio); // get new player width 2224 $tubularPlayer[0].style.width = pWidth + widthOffset + 'px'; 2225 $tubularPlayer[0].style.height = height + heightOffset + 'px'; 2226 $tubularPlayer[0].style.left = ((width - pWidth) / 2) - (widthOffset / 2) + 'px'; 2227 $tubularPlayer[0].style.top = '-' + (heightOffset / 2) + 'px'; 2228 $tubularPlayer[0].style.position = 'absolute'; 2229 } else { // new video width < window width (gap to right) 2230 pHeight = Math.ceil(width / ratio); // get new player height 2231 $tubularPlayer[0].style.width = width + widthOffset + 'px'; 2232 $tubularPlayer[0].style.height = pHeight + heightOffset + 'px'; 2233 $tubularPlayer[0].style.left = '-' + (widthOffset / 2) + 'px'; 2234 $tubularPlayer[0].style.top = ((height - pHeight) / 2) - (heightOffset / 2) + 'px'; 2235 $tubularPlayer[0].style.position = 'absolute'; 2236 } 2237 } 2238 }); 2239 }, 2240 init_overlay = function() { 2241 if ( UNCODE.isFrontEndEditor ) 2242 return; 2243 var triggerButton, 2244 closeButtons = new Array(); 2245 function toggleOverlay(btn) { 2246 if ( classie.hasClass(triggerButton, 'menu-button-offcanvas') ) { 2247 return true; 2248 } 2249 Array.prototype.forEach.call(document.querySelectorAll('div.overlay'), function(overlay) { 2250 if (btn.getAttribute('data-area') == overlay.getAttribute('data-area')) { 2251 var container = document.querySelector('div.' + btn.getAttribute('data-container')), 2252 inputField = overlay.querySelector('.search-field'); 2253 if (classie.has(overlay, 'open')) { 2254 window.dispatchEvent(menuClose); 2255 overlayOpened = false;
2256 classie.remove(overlay, 'open'); 2257 classie.remove(container, 'overlay-open'); 2258 classie.add(overlay, 'close'); 2259 classie.remove(overlay, 'open-items'); 2260 var onEndTransitionFn = function(ev) { 2261 if (transitionEvent) { 2262 if (ev.propertyName !== 'visibility') return; 2263 this.removeEventListener(transitionEvent, onEndTransitionFn); 2264 } 2265 classie.remove(overlay, 'close'); 2266 }; 2267 if (transitionEvent) { 2268 overlay.addEventListener(transitionEvent, onEndTransitionFn); 2269 } else { 2270 onEndTransitionFn(); 2271 } 2272 } else if (!classie.has(overlay, 'close') && !classie.hasClass(btn, 'overlay-close')) { 2273 window.dispatchEvent(menuOpen); 2274 overlayOpened = true; 2275 classie.add(overlay, 'open'); 2276 classie.add(container, 'overlay-open'); 2277 if (jQuery('body.menu-overlay').length == 0 && inputField != null) { 2278 setTimeout(function() { 2279 inputField.focus(); 2280 }, 1000); 2281 } 2282 setTimeout(function() { 2283 if (classie.has(overlay, 'overlay-sequential')) classie.add(overlay, 'open-items'); 2284 }, 800); 2285 } 2286 } 2287 }); 2288 2289 if (classie.hasClass(btn, 'search-icon') || classie.hasClass(btn, 'menu-close-search') || classie.hasClass(btn, 'mobile-search-icon')) return; 2290 2291 if (classie.hasClass(triggerButton, 'close')) { 2292 UNCODE.menuOpened = false; 2293 classie.removeClass(triggerButton, 'close'); 2294 classie.addClass(triggerButton, 'closing'); 2295 Array.prototype.forEach.call(closeButtons, function(closeButton) { 2296 if (!classie.hasClass(closeButton, 'menu-close-search')) { 2297 classie.removeClass(closeButton, 'close'); 2298 classie.addClass(closeButton, 'closing'); 2299 } 2300 }); 2301 setTimeout(function() { 2302 classie.removeClass(triggerButton, 'closing'); 2303 triggerButton.style.opacity = 1; 2304 Array.prototype.forEach.call(closeButtons, function(closeButton) { 2305 if (!classie.hasClass(closeButton, 'menu-close-search')) { 2306 classie.removeClass(closeButton, 'closing'); 2307 closeButton.style.opacity = 0; 2308 } 2309 }); 2310 }, 800); 2311 } else { 2312 UNCODE.menuOpened = true; 2313 triggerButton.style.opacity = 0; 2314 var getBtnRect = !classie.hasClass(triggerButton, 'search-icon') ? triggerButton.getBoundingClientRect() : null; 2315 Array.prototype.forEach.call(closeButtons, function(closeButton) { 2316 if (!classie.hasClass(closeButton, 'menu-close-search')) { 2317 classie.addClass(triggerButton, 'close'); 2318 if (getBtnRect != null) closeButton.setAttribute('style', 'top:' + getBtnRect.top + 'px; left:'+ getBtnRect.left + 'px !important'); 2319 classie.addClass(closeButton, 'close'); 2320 closeButton.style.opacity = 1; 2321 } 2322 }); 2323 window.addEventListener("resize", function() { 2324 positionCloseBtn(triggerButton, closeButtons); 2325 }); 2326 } 2327 } 2328 function positionCloseBtn(triggerButton, closeButtons){ 2329 var getBtnRect = !classie.hasClass(triggerButton, 'search-icon') ? triggerButton.getBoundingClientRect() : null; 2330 Array.prototype.forEach.call(closeButtons, function(closeButton) { 2331 if (!classie.hasClass(closeButton, 'menu-close-search')) { 2332 if (getBtnRect != null) closeButton.setAttribute('style', 'top:' + getBtnRect.top + 'px; left:'+ getBtnRect.left + 'px !important'); 2333 closeButton.style.opacity = 1; 2334 } 2335 }); 2336 } 2337 (function bindEscape() { 2338 document.onkeydown = function(evt) { 2339 evt = evt || window.event; 2340 var isEscape = false;
2341 if ("key" in evt) { 2342 isEscape = (evt.key == "Escape" || evt.key == "Esc"); 2343 } else { 2344 isEscape = (evt.keyCode == 27); 2345 } 2346 if (isEscape && overlayOpened) { 2347 Array.prototype.forEach.call(closeButtons, function(closeButton) { 2348 if (classie.hasClass(closeButton, 'overlay-close') && classie.hasClass(closeButton, 'menu-button-overlay')) { 2349 closeButton.click(); 2350 } 2351 }); 2352 } 2353 }; 2354 })(); 2355 Array.prototype.forEach.call(document.querySelectorAll('.trigger-overlay'), function(triggerBttn) { 2356 if ( UNCODE.menuOpened || ( classie.hasClass(document.body, 'vmenu') && UNCODE.wwidth >= 960 ) ) return; 2357 triggerBttn.addEventListener('click', function(e) { 2358 triggerButton = e.currentTarget; 2359 // if (wwidth < mediaQuery && classie.hasClass(triggerButton, 'search-icon')) { 2360 if ( wwidth < mediaQuery && triggerButton.getAttribute('data-area') != 'search' ) { 2361 return true; 2362 } else { 2363 e.stopPropagation(); 2364 // if (wwidth > mediaQuery) toggleOverlay(triggerButton); 2365 // else { 2366 // if (classie.addClass(triggerButton, 'search-icon')) return true; 2367 // } 2368 toggleOverlay(triggerButton); 2369 e.preventDefault(); 2370 return false; 2371 } 2372 }, false); 2373 }); 2374 Array.prototype.forEach.call(document.querySelectorAll('.overlay-close'), function(closeBttn) { 2375 closeButtons.push(closeBttn); 2376 closeBttn.addEventListener('click', function(e) { 2377 // if (wwidth > mediaQuery) toggleOverlay(closeBttn); 2378 toggleOverlay(closeBttn); 2379 e.preventDefault(); 2380 return false; 2381 }, false); 2382 }); 2383 }, 2384 /** All scrolling functions - Begin */ 2385 /** Shrink menu **/ 2386 shrinkMenu = function(bodyTop) { 2387 if ( UNCODE.isFrontEndEditor ) 2388 return; 2389 var logoShrink, 2390 offset = 100; 2391 for (var i = 0; i < logoel.length; i++) { 2392 if (((secmenuHeight == 0) ? bodyTop > menuHeight : bodyTop > secmenuHeight + offset) && !classie.hasClass(logoel[i], 'shrinked') && (wwidth > mediaQuery)) { 2393 classie.addClass(logoel[i], 'shrinked'); 2394 if (logoMinScale != undefined) { 2395 logoShrink = logolink.children; 2396 Array.prototype.forEach.call(logoShrink, function(singleLogo) { 2397 singleLogo.style.height = logoMinScale + 'px'; 2398 singleLogo.style.lineHeight = logoMinScale + 'px'; 2399 if (classie.hasClass(singleLogo, 'text-logo')) singleLogo.style.fontSize = logoMinScale + 'px'; 2400 }); 2401 } 2402 setTimeout(function() { 2403 calculateMenuHeight(false); 2404 //window.dispatchEvent(new Event('resize')); 2405 }, 300); 2406 } else if ((((secmenuHeight == 0) ? bodyTop == 0 : bodyTop <= secmenuHeight + offset) || (wwidth < mediaQuery)) && classie.hasClass(logoel[i], 'shrinked')) { 2407 classie.removeClass(logoel[i], 'shrinked'); 2408 if (logoMinScale != undefined) { 2409 logoShrink = logolink.children; 2410 Array.prototype.forEach.call(logoShrink, function(singleLogo) { 2411 singleLogo.style.height = singleLogo.getAttribute('data-maxheight') + 'px'; 2412 singleLogo.style.lineHeight = singleLogo.getAttribute('data-maxheight') + 'px'; 2413 if (classie.hasClass(singleLogo, 'text-logo')) singleLogo.style.fontSize = singleLogo.getAttribute('data-maxheight') + 'px'; 2414 }); 2415 } 2416 setTimeout(function() { 2417 calculateMenuHeight(false); 2418 //window.dispatchEvent(new Event('resize')); 2419 }, 300); 2420 } 2421 } 2422 }, 2423 /** Switch colors menu **/ 2424 switchColorsMenu = function(bodyTop, style) { 2425 for (var i = 0; i < transmenuel.length; i++) { 2426 if (masthead.style.opacity !== 1) masthead.style.opacity = 1; 2427 if ((secmenuHeight == 0) ? bodyTop > menuHeight / 2 : bodyTop > secmenuHeight) { 2428 if (classie.hasClass(masthead, 'style-dark-original')) { 2429 logo.className = logo.className.replace("style-light", "style-dark"); 2430 } 2431 if (classie.hasClass(masthead, 'style-light-original')) { 2432 logo.className = logo.className.replace("style-dark", "style-light"); 2433 } 2434 if (style != undefined) { 2435 if (style == 'dark') { 2436 classie.removeClass(transmenuel[i], 'style-light-override'); 2437 } 2438 if (style == 'light') { 2439 classie.removeClass(transmenuel[i], 'style-dark-override'); 2440 } 2441 classie.addClass(transmenuel[i], 'style-' + style + '-override'); 2442 } 2443 } else { 2444 if (style != undefined) { 2445 if (style == 'dark') { 2446 classie.removeClass(transmenuel[i], 'style-light-override'); 2447 } 2448 if (style == 'light') { 2449 classie.removeClass(transmenuel[i], 'style-dark-override'); 2450 } 2451 classie.addClass(transmenuel[i], 'style-' + style + '-override'); 2452 } 2453 } 2454 } 2455 if (pageHeader != undefined) { 2456 if (style != undefined) { 2457 if (classie.hasClass(pageHeader, 'header-style-dark')) { 2458 classie.removeClass(pageHeader, 'header-style-dark'); 2459 } 2460 if (classie.hasClass(pageHeader, 'header-style-light')) { 2461 classie.removeClass(pageHeader, 'header-style-light'); 2462 } 2463 classie.addClass(pageHeader, 'header-style-' + style); 2464 } 2465 } 2466 }, 2467 /** VisibleRows **/ 2468 visibleRowCol = function(bodyTop) { 2469 if ( typeof visibleRows == 'object') { 2470 for (var i = 0; i < visibleRows.length; i++) { 2471 var section = visibleRows[i], 2472 sectionHeight = outerHeight(section), 2473 offSetTop = bodyTop + ( section != null ? section.getBoundingClientRect().top : 0 ), 2474 offSetPosition = wheight + bodyTop - offSetTop; 2475 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2476 classie.addClass($kenburnsInner[0], 'uncode-scroll-visible'); 2477 visibleRows[i].dispatchEvent(new CustomEvent('enter-row')); 2478 } else { 2479 classie.removeClass($kenburnsInner[0], 'uncode-scroll-visible'); 2480 visibleRows[i].dispatchEvent(new CustomEvent('exit-row')); 2481 } 2482 } 2483 } 2484 }, 2485 /** KenBurns **/ 2486 kenburnsHeader = function(bodyTop) { 2487 var value; 2488 if ( typeof kenburnsHeaders == 'object' && kenburnsHeaders.length ) { 2489 for (var i = 0; i < kenburnsHeaders.length; i++) { 2490 var section = kenburnsHeaders[i].parentNode, 2491 sectionHeight = outerHeight(section), 2492 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 2493 offSetPosition = wheight + bodyTop - offSetTop, 2494 $kenburnsInner = kenburnsHeaders[i].querySelectorAll('.header-bg'); 2495 if (classie.hasClass(kenburnsHeaders[i], 'header-carousel-wrapper')) { 2496 $kenburnsInner = kenburnsHeaders[i].querySelectorAll('.t-background-cover'); 2497 } 2498 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2499 for (var i = 0; i < $kenburnsInner.length; i++) { 2500 classie.addClass($kenburnsInner[i], 'uncode-kburns'); 2501 $kenburnsInner[i].dispatchEvent(new CustomEvent('enter-kburns')); 2502 } 2503 } else { 2504 for (var i = 0; i < $kenburnsInner.length; i++) { 2505 classie.removeClass($kenburnsInner[i], 'uncode-kburns'); 2506 $kenburnsInner[i].dispatchEvent(new CustomEvent('exit-kburns')); 2507 } 2508 } 2509 } 2510 } 2511 }, 2512 kenburnsRowCol = function(bodyTop) { 2513 var value; 2514 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2515 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'); 2516 } 2517 if ( typeof kenburnsRows == 'object' && kenburnsRows.length ) { 2518 for (var i = 0; i < kenburnsRows.length; i++) { 2519 var section = kenburnsRows[i].parentNode, 2520 sectionHeight = outerHeight(section), 2521 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 2522 offSetPosition = wheight + bodyTop - offSetTop, 2523 $kenburnsInner = kenburnsRows[i].querySelectorAll('.background-inner, .header-bg'); 2524 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2525 classie.addClass($kenburnsInner[0], 'uncode-kburns'); 2526 $kenburnsInner[0].dispatchEvent(new CustomEvent('enter-kburns')); 2527 } else { 2528 classie.removeClass($kenburnsInner[0], 'uncode-kburns'); 2529 $kenburnsInner[0].dispatchEvent(new CustomEvent('exit-kburns')); 2530 } 2531 } 2532 } 2533 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2534 kenburnsCols = document.querySelectorAll('.with-kburns > .column-background > .background-wrapper'); 2535 } 2536 if ( typeof kenburnsCols == 'object' && kenburnsCols.length ) { 2537 for (var j = 0; j < kenburnsCols.length; j++) { 2538 var elm = kenburnsCols[j], 2539 $kenburnsInner = elm.querySelectorAll('.background-inner'); 2540 if (checkVisible(elm)) { 2541 classie.addClass($kenburnsInner[0], 'uncode-kburns'); 2542 $kenburnsInner[0].dispatchEvent(new CustomEvent('enter-kburns')); 2543 } else { 2544 classie.removeClass($kenburnsInner[0], 'uncode-kburns'); 2545 $kenburnsInner[0].dispatchEvent(new CustomEvent('exit-kburns')); 2546 } 2547 } 2548 } 2549 }, 2550 /** Zoom Out BackWash **/ 2551 backwashHeader = function(bodyTop) { 2552 var value; 2553 var onEndAnimationFn = function(ev){ 2554 if (animationEvent) { 2555 if (ev.animationName !== 'backwash') { 2556 return; 2557 } 2558 this.removeEventListener(animationEvent, onEndAnimationFn); 2559 } 2560 classie.addClass(ev.target, 'uncode-zoomout-already'); 2561 } 2562 if ( typeof backwashHeaders == 'object' && backwashHeaders.length ) { 2563 for (var i = 0; i < backwashHeaders.length; i++) { 2564 var section = backwashHeaders[i].parentNode, 2565 sectionHeight = outerHeight(section), 2566 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 2567 offSetPosition = wheight + bodyTop - offSetTop, 2568 $backwashInner = backwashHeaders[i].querySelectorAll('.header-bg'); 2569 2570 if ( classie.hasClass($backwashInner[0], 'uncode-video-container') ) { 2571 continue; 2572 } 2573 2574 if (classie.hasClass(backwashHeaders[i], 'header-carousel-wrapper')) { 2575 $backwashInner = backwashHeaders[i].querySelectorAll('.t-background-cover'); 2576 } 2577 2578 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2579 for (var i = 0; i < $backwashInner.length; i++) { 2580 classie.addClass($backwashInner[i], 'uncode-zoomout'); 2581 $backwashInner[i].dispatchEvent(new CustomEvent('enter-zoomout')); 2582 } 2583 } else { 2584 for (var i = 0; i < $backwashInner.length; i++) { 2585 classie.removeClass($backwashInner[i], 'uncode-zoomout'); 2586 $backwashInner[i].dispatchEvent(new CustomEvent('exit-zoomout')); 2587 } 2588 } 2589 for (var i = 0; i < $backwashInner.length; i++) { 2590 $backwashInner[i].addEventListener(animationEvent, onEndAnimationFn); 2591 } 2592 } 2593 } 2594 }, 2595 backwashRowCol = function(bodyTop) { 2596 var value; 2597 var onEndAnimationFn = function(ev){ 2598 if (animationEvent) { 2599 if (ev.animationName !== 'backwash') { 2600 return; 2601 } 2602 this.removeEventListener(animationEvent, onEndAnimationFn); 2603 } 2604 classie.addClass(ev.target, 'uncode-zoomout-already'); 2605 } 2606 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2607 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'); 2608 } 2609 if ( typeof backwashRows == 'object' && backwashRows.length ) { 2610 for (var i = 0; i < backwashRows.length; i++) { 2611 var section = backwashRows[i].parentNode, 2612 sectionHeight = outerHeight(section), 2613 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 2614 offSetPosition = wheight + bodyTop - offSetTop, 2615 $backwashInner = backwashRows[i].querySelectorAll('.background-inner'); 2616 2617 if ( classie.hasClass($backwashInner[0], 'uncode-video-container') ) { 2618 continue; 2619 } 2620 2621 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight) ) { 2622 classie.addClass($backwashInner[0], 'uncode-zoomout'); 2623 $backwashInner[0].dispatchEvent(new CustomEvent('enter-zoomout')); 2624 } else { 2625 classie.removeClass($backwashInner[0], 'uncode-zoomout'); 2626 $backwashInner[0].dispatchEvent(new CustomEvent('exit-zoomout')); 2627 } 2628 $backwashInner[0].addEventListener(animationEvent, onEndAnimationFn); 2629 } 2630 2631 } 2632 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2633 backwashCols = document.querySelectorAll('.with-zoomout > .column-background > .background-wrapper'); 2634 } 2635 if ( typeof backwashCols == 'object' && backwashCols.length ) { 2636 for (var j = 0; j < backwashCols.length; j++) { 2637 var elm = backwashCols[j], 2638 $backwashInner = elm.querySelectorAll('.background-inner'); 2639 if (checkVisible(elm)) { 2640 classie.addClass($backwashInner[0], 'uncode-zoomout'); 2641 $backwashInner[0].dispatchEvent(new CustomEvent('enter-zoomout')); 2642 } else { 2643 classie.removeClass($backwashInner[0], 'uncode-zoomout'); 2644 $backwashInner[0].dispatchEvent(new CustomEvent('exit-zoomout')); 2645 } 2646 $backwashInner[0].addEventListener(animationEvent, onEndAnimationFn); 2647 } 2648 } 2649 }, 2650 /** Parallax Rows **/
2651 parallaxRowCol = function(bodyTop) { 2652 var value; 2653 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2654 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'); 2655 } 2656 if (typeof parallaxRows == 'object') { 2657 for (var i = 0; i < parallaxRows.length; i++) { 2658 var section = parallaxRows[i].parentNode, 2659 thisHeight = outerHeight(parallaxRows[i]), 2660 sectionHeight = outerHeight(section), 2661 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 2662 offSetPosition = wheight + bodyTop - offSetTop; 2663 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2664 value = ((offSetPosition - wheight) * speedDivider); 2665 if (Math.abs(value) < (thisHeight - sectionHeight)) {
2666 translateElement(parallaxRows[i], Math.floor(value)); 2667 } else { 2668 translateElement(parallaxRows[i], Math.floor(thisHeight - sectionHeight)); 2669 } 2670 } 2671 } 2672 } 2673 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2674 parallaxCols = document.querySelectorAll('.with-parallax > .column-background > .background-wrapper'); 2675 } 2676 if (typeof parallaxCols == 'object') { 2677 for (var j = 0; j < parallaxCols.length; j++) { 2678 var section = parallaxCols[j].parentNode, 2679 thisHeight = outerHeight(parallaxCols[j]), 2680 sectionHeight = outerHeight(section), 2681 offSetTop = bodyTop + (section != null ? section.getBoundingClientRect().top : 0), 2682 offSetPosition = wheight + bodyTop - offSetTop; 2683 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2684 value = ((offSetPosition - wheight) * speedDivider); 2685 value *= .8; 2686 if (Math.abs(value) < (thisHeight - sectionHeight)) { 2687 translateElement(parallaxCols[j], Math.floor(value)); 2688 } else { 2689 translateElement(parallaxCols[j], Math.floor(thisHeight - sectionHeight)); 2690 } 2691 } 2692 } 2693 } 2694 }, 2695 /** Parallax Headers **/ 2696 parallaxHeader = function(bodyTop) { 2697 var value; 2698 if (typeof parallaxHeaders == 'object') { 2699 for (var i = 0; i < parallaxHeaders.length; i++) { 2700 var section = parallaxHeaders[i].parentNode, 2701 thisSibling = section.nextSibling, 2702 thisHeight, 2703 sectionHeight, 2704 offSetTop, 2705 offSetPosition; 2706 if (classie.hasClass(parallaxHeaders[i], 'header-carousel-wrapper')) { 2707 getDivChildren(parallaxHeaders[i], '.t-entry-visual-cont', function(item, l, total) { 2708 thisHeight = outerHeight(item); 2709 sectionHeight = outerHeight(section); 2710 offSetTop = bodyTop + section.getBoundingClientRect().top; 2711 offSetPosition = wheight + bodyTop - offSetTop; 2712 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2713 value = ((offSetPosition - wheight) * speedDivider); 2714 if (Math.abs(value) < (thisHeight - sectionHeight)) { 2715 translateElement(item, Math.floor(value)); 2716 } 2717 } 2718 }); 2719 } else { 2720 thisHeight = outerHeight(parallaxHeaders[i]); 2721 sectionHeight = outerHeight(section); 2722 offSetTop = bodyTop + section.getBoundingClientRect().top; 2723 offSetPosition = wheight + bodyTop - offSetTop; 2724 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2725 value = ((offSetPosition - wheight) * speedDivider); 2726 if (Math.abs(value) < (thisHeight - sectionHeight)) { 2727 translateElement(parallaxHeaders[i], Math.floor(value)); 2728 } 2729 } 2730 } 2731 } 2732 } 2733 }, 2734 /** Header opacity **/ 2735 headerOpacity = function(bodyTop) { 2736 if ( UNCODE.isFrontEndEditor ) { 2737 return; 2738 } 2739 if (headerWithOpacity && headerWithOpacity.length) { 2740 var thisHeight = outerHeight(headerWithOpacity[0]); 2741 if (bodyTop > thisHeight / 8) { 2742 if (pageHeader != undefined) classie.addClass(pageHeader, 'header-scrolled'); 2743 } else { 2744 if (pageHeader != undefined) classie.removeClass(pageHeader, 'header-scrolled'); 2745 } 2746 } 2747 }, 2748 /** Show hide scroll top arrow **/ 2749 showHideScrollup = function(bodyTop) { 2750 if ( bodyTop != 0 ) { 2751 if (bodyTop > wheight || ((bodyTop + wheight) >= docheight) && docheight > 0) { 2752 classie.addClass(document.body, 'window-scrolled'); 2753 classie.removeClass(document.body, 'hide-scrollup'); 2754 if (footerScroller && footerScroller[0] != undefined) { 2755 footerScroller[0].style.display = ''; 2756 } 2757 } else { 2758 if (classie.hasClass(document.body, 'window-scrolled')) classie.addClass(document.body, 'hide-scrollup'); 2759 classie.removeClass(document.body, 'window-scrolled'); 2760 } 2761 } 2762 }, 2763 /** Fix menu **/ 2764 fixMenu = function(){ 2765 if ( UNCODE.isFrontEndEditor ) 2766 return; 2767 menuwrapper = document.querySelectorAll(".menu-wrapper"); 2768 if ( ! classie.hasClass(document.body, 'vmenu') && UNCODE.isFullPage && !UNCODE.isFullPageSnap && classie.hasClass(document.body, 'uncode-fp-menu-hide') ) { 2769 menuwrapper = document.querySelector(".menu-wrapper"); 2770 pageHeader = document.getElementById("page-header"); 2771 menuwrapper.style.position = 'fixed'; 2772 menuwrapper.style.zIndex = '5'; 2773 } 2774 }, 2775 /** Hide Menu **/ 2776 hideMenu = function(bodyTop) { 2777 if ( UNCODE.isFrontEndEditor ) 2778 return; 2779 if (UNCODE.menuOpened || bodyTop < 0) return; 2780 if (classie.hasClass(document.body, 'vmenu')) { 2781 if (wwidth < mediaQuery) menuhide = document.querySelector('#masthead .menu-hide-vertical'); 2782 else menuhide = null; 2783 } 2784 if (classie.hasClass(document.body, 'hmenu-center')) { 2785 if (wwidth > mediaQuery) menuhide = document.querySelector('#masthead .menu-hide'); 2786 else menuhide = document.querySelector('.menu-container-mobile.menu-hide'); 2787 } 2788 if (typeof menuhide == 'object' && menuhide != null && mainmenu[0] != undefined) { 2789 var translate, 2790 scrollingDown = true; 2791 /** fix for hmenu-center **/ 2792 var sticky_element = (typeof mainmenu.item === 'undefined' ? ((wwidth > mediaQuery) ? mainmenu[0] : mainmenu[1]) : mainmenu[0]); 2793 if (lastScrollValue == bodyTop) return; 2794 2795 if (lastScrollValue > bodyTop) scrollingDown = false;
2796 else scrollingDown = true; 2797 lastScrollValue = bodyTop; 2798 2799 if (!scrollingDown) { 2800 if (!UNCODE.scrolling) { 2801 if ((secmenuHeight == 0) ? bodyTop == 0 : bodyTop < secmenuHeight) { 2802 classie.removeClass(sticky_element.parentNode, 'is_stuck'); 2803 if (classie.hasClass(masthead, 'menu-transparent')) { 2804 if ((isMobileTransparent || wwidth > mediaQuery) && !classie.hasClass(masthead.parentNode, 'no-header')) masthead.parentNode.style.height = '0px'; 2805 } 2806 if (wwidth < mediaQuery) sticky_element.style.position = 'fixed'; 2807 else sticky_element.style.position = ''; 2808 hideMenuReset(sticky_element); 2809 clearTimeout(hidingTimer); 2810 } 2811 2812 if (classie.hasClass(menuhide, 'menu-hided')) { 2813 classie.removeClass(menuhide, 'menu-hided'); 2814 hidingTimer = setTimeout(function() { 2815 classie.addClass(sticky_element.parentNode, 'is_stuck'); 2816 hideMenuReset(sticky_element); 2817 }, 400); 2818 } 2819 } 2820 } else { 2821 if (menusticky.length == 0 && bodyTop < wheight / 3) { 2822 if (sticky_element.style.position == 'fixed') sticky_element.style.position = ''; 2823 } 2824 if (bodyTop > wheight / 2) { 2825 clearTimeout(hidingTimer); 2826 if (!classie.hasClass(menuhide, 'menu-hided')) { 2827 classie.addClass(menuhide, 'menu-hided'); 2828 classie.addClass(sticky_element.parentNode, 'is_stuck'); 2829 if (sticky_element.style.position != 'fixed') { 2830 sticky_element.style.visibility = 'hidden'; 2831 sticky_element.style.position = 'fixed'; 2832 sticky_element.style.top = '0px'; 2833 } 2834 translateElement(menuhide, -UNCODE.menuMobileHeight - 1); 2835 } 2836 } 2837 } 2838 } 2839 }, 2840 hideMenuReset = function(sticky_element) { 2841 var topOffset = 0; 2842 if (sticky_element.style.visibility == 'hidden') sticky_element.style.visibility = ''; 2843 if (bodyBorder > 0) topOffset += bodyBorder; 2844 if (adminBar != null && window.getComputedStyle(adminBar,null).getPropertyValue("position") != 'fixed') adminBarHeight = 0; 2845 if (adminBarHeight > 0) topOffset += adminBarHeight; 2846 //sticky_element.style.top = topOffset + 'px'; 2847 if (!classie.hasClass(document.body, 'boxed-width') && boxWidth > 0) sticky_element.style.width = boxWidth + 'px'; 2848 translateElement(menuhide, 0); 2849 }, 2850 /** Stick Menu **/ 2851 stickMenu = function(bodyTop) { 2852 if (header && mainmenu[0] != undefined) { 2853 if (classie.hasClass(mainmenu[0], 'vmenu-container') && wwidth > mediaQuery) return; 2854 /** fix for hmenu-center **/ 2855 var sticky_element = (typeof mainmenu.item === 'undefined' ? ((isMobileTransparent || wwidth > mediaQuery) ? mainmenu[0] : mainmenu[1]) : mainmenu[0]); 2856 if ((secmenuHeight == 0 && (isMobileTransparent || wwidth > mediaQuery)) ? bodyTop > (0 + adminBarHeight) : bodyTop > (secmenuHeight + adminBarHeight)) { 2857 if (!classie.hasClass(sticky_element.parentNode, 'is_stuck')) { 2858 classie.addClass(sticky_element.parentNode, 'is_stuck'); 2859 sticky_element.style.position = 'fixed'; 2860 var getAnchorTop = bodyBorder; 2861 if (adminBar != null && window.getComputedStyle(adminBar,null).getPropertyValue("position") != 'fixed') adminBarHeight = 0; 2862 if (adminBarHeight > 0) getAnchorTop += adminBarHeight; 2863 sticky_element.style.top = getAnchorTop + 'px'; 2864 if (!classie.hasClass(document.body, 'boxed-width') && boxWidth > 0) sticky_element.style.width = boxWidth + 'px'; 2865 } 2866 } else { 2867 clearTimeout(hidingTimer); 2868 classie.removeClass(sticky_element.parentNode, 'is_stuck'); 2869 sticky_element.style.position = 'fixed'; 2870 if (isMobileTransparent || wwidth > mediaQuery) sticky_element.style.position = ''; 2871 if (classie.hasClass(document.body, 'hmenu-center')) sticky_element.style.position = 'absolute'; 2872 sticky_element.style.top = ''; 2873 } 2874 } 2875 }, 2876 translateElement = function(element, valueY) { 2877 var translate = 'translate3d(0, ' + valueY + 'px' + ', 0)'; 2878 element.style['-webkit-transform'] = translate; 2879 element.style['-moz-transform'] = translate; 2880 element.style['-ms-transform'] = translate; 2881 element.style['-o-transform'] = translate; 2882 element.style['transform'] = translate; 2883 }, 2884 setScrollPosition, 2885 scrollFunction = function() { 2886 if ( ! UNCODE.isFullPage ) { 2887 kenburnsHeader(bodyTop); 2888 kenburnsRowCol(bodyTop); 2889 backwashHeader(bodyTop); 2890 backwashRowCol(bodyTop); 2891 if (logoel != undefined && logoel.length && !isMobile) shrinkMenu(bodyTop); 2892 if (menusticky != undefined && menusticky.length) stickMenu(bodyTop); 2893 hideMenu(bodyTop); 2894 if (isMobileParallaxAllowed || !isMobile) { 2895 if (header && menusticky != undefined && menusticky.length) 2896 switchColorsMenu(bodyTop);
2897 parallaxRowCol(bodyTop); 2898 parallaxHeader(bodyTop); 2899 headerOpacity(bodyTop); 2900 visibleRowCol(bodyTop); 2901 } 2902 clearRequestTimeout(setScrollPosition); 2903 setScrollPosition = requestTimeout( function(){ 2904 scrollRowHeight_fix = window.pageYOffset; 2905 }, 100 ); 2906 } 2907 }, 2908 /** Shape Dividers **/ 2909 shapeDivider = function() { 2910 var $shape = '.uncode-divider-wrap'; 2911 2912 forEachElement($shape, function($el, i) { 2913 var elH = parseInt( $el.getAttribute('data-height') ), 2914 elHunit = $el.getAttribute('data-unit'), 2915 newEl, 2916 $parent = $el.parentNode, 2917 parentH, 2918 $svg = $el.getElementsByTagName('svg')[0]; 2919 2920 if ( elHunit == 'px' ) { 2921 2922 switch (true) { 2923 case (wwidth < 1500 && wwidth >= 1180): 2924 newEl = elH*0.8; 2925 break; 2926 2927 case (wwidth < 1180 && wwidth >= 960): 2928 newEl = elH*0.65; 2929 break; 2930 2931 case (wwidth < 960 && wwidth >= 570): 2932 newEl = elH*0.5; 2933 break; 2934 2935 case (wwidth < 570): 2936 newEl = elH*0.25; 2937 break; 2938 2939 default: 2940 newEl = elH; 2941 } 2942 2943 $el.style.height = newEl + elHunit; 2944 } 2945 2946 2947 if ( classie.hasClass($el, 'uncode-divider-preserve-ratio') && ( window.navigator.userAgent.indexOf('MSIE ') !== -1 || window.navigator.userAgent.indexOf('Trident/') !== -1 ) ) { 2948 2949 $svg.setAttribute('preserveAspectRatio','none'); 2950 2951 var sizes = $svg.getAttribute('viewBox').split(' '), 2952 svgW = sizes[2], 2953 svgH = sizes[3], 2954 newSvgW; 2955 2956 newSvgW = newEl * ( svgW / svgH ); 2957 2958 $svg.style.width = newSvgW + 'px'; 2959 2960 } 2961 }); 2962 }; 2963 if (!noScroll && document.body == null) { 2964 window.addEventListener('scroll', function(e) { 2965 if ( ! UNCODE.isFullPage ) { 2966 bodyTop = document.documentElement.scrollTop || document.body.scrollTop; 2967 scrollFunction(); 2968 showHideScrollup(bodyTop); 2969 } 2970 }, false); 2971 } 2972 window.addEventListener('uncode-quick-view-loaded', function() { 2973 document.getElementById('unmodal-content').addEventListener('scroll', function(e) { 2974 bodyTop = document.getElementById('unmodal-content').scrollTop; 2975 scrollFunction(); 2976 showHideScrollup(bodyTop); 2977 }, false); 2978 }, false); 2979 /** All scrolling functions - End */ 2980 /** help functions */ 2981 function getClosest(el, tag) { 2982 do { 2983 if (el.className != undefined && el.className.indexOf(tag) > -1) return el; 2984 } while (el = el.parentNode); 2985 // not found :( 2986 return null; 2987 } 2988 2989 function outerHeight(el, includeMargin) { 2990 if (el != null) { 2991 var height = el.offsetHeight; 2992 if (includeMargin) { 2993 var style = el.currentStyle || getComputedStyle(el); 2994 height += parseInt(style.marginTop) + parseInt(style.marginBottom); 2995 } 2996 return height; 2997 } 2998 } 2999 3000 function outerWidth(el, includeMargin) { 3001 var width = el.offsetWidth; 3002 if (includeMargin) { 3003 var style = el.currentStyle || getComputedStyle(el); 3004 width += parseInt(style.marginLeft) + parseInt(style.marginRight); 3005 } 3006 return width; 3007 } 3008 // Replicate jQuery .each method 3009 function forEachElement(selector, fn) { 3010 var elements = document.querySelectorAll(selector); 3011 for (var i = 0; i < elements.length; i++) fn(elements[i], i); 3012 } 3013 3014 function getDivChildren(containerId, selector, fn) { 3015 if (containerId !== null) { 3016 var elements = containerId.querySelectorAll(selector); 3017 for (var i = 0; i < elements.length; i++) fn(elements[i], i, elements.length); 3018 } 3019 } 3020 3021 function hideFooterScroll() { 3022 if (classie.hasClass(document.body, 'hide-scrollup')) footerScroller[0].style.display = "none"; 3023 } 3024 document.addEventListener("DOMContentLoaded", function(event) { 3025 UNCODE.adaptive(); 3026 boxWrapper = document.querySelectorAll('.box-wrapper'); 3027 docheight = boxWrapper[0] != undefined ? boxWrapper[0].offsetHeight : 0; 3028 // if (!classie.hasClass(document.body, 'vmenu') && !classie.hasClass(document.body, 'menu-offcanvas')) init_overlay(); 3029 init_overlay(); 3030 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'); 3031 kenburnsCols = document.querySelectorAll('.with-kburns > .column-background > .background-wrapper'); 3032 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'); 3033 backwashCols = document.querySelectorAll('.with-zoomout > .column-background > .background-wrapper'); 3034 if (!UNCODE.isMobile || isMobileParallaxAllowed) {
3035 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'); 3036 parallaxCols = document.querySelectorAll('.with-parallax > .column-background > .background-wrapper'); 3037 } 3038 footerScroller = document.querySelectorAll('.footer-scroll-top'); 3039 if (footerScroller && footerScroller[0] != undefined) { 3040 if (transitionEvent) { 3041 footerScroller[0].addEventListener(transitionEvent, hideFooterScroll); 3042 } 3043 } 3044 Array.prototype.forEach.call(document.querySelectorAll('.row-inner'), function(el) { 3045 el.style.height = ''; 3046 el.style.marginBottom = ''; 3047 }); 3048 setRowHeight(document.querySelectorAll('.page-wrapper .row-parent, footer .row-parent')); 3049 }); 3050 /** On resize events **/ 3051 window.addEventListener("vc-resize", function() { 3052 scrollRowHeight_fix = window.pageYOffset; 3053 Array.prototype.forEach.call(document.querySelectorAll('.row-inner'), function(el) { 3054 el.style.height = ''; 3055 el.style.marginBottom = ''; 3056 }); 3057 setRowHeight(document.querySelectorAll('.page-wrapper .row-parent, footer .row-parent'), false, true); 3058 }); 3059 var setIsScrolling; 3060 window.addEventListener("scroll", function() { 3061 UNCODE.setIsScrolling = true; 3062 clearRequestTimeout(setIsScrolling); 3063 3064 setIsScrolling = requestTimeout(function() { 3065 UNCODE.setIsScrolling = false; 3066 }, 66); 3067 }); 3068 window.addEventListener("resize", function() { 3069 scrollRowHeight_fix = window.pageYOffset; 3070 docheight = (boxWrapper != undefined && boxWrapper[0] != undefined) ? boxWrapper[0].offsetHeight : 0; 3071 var oldWidth = wwidth; 3072 UNCODE.wwidth = wwidth = window.innerWidth || document.documentElement.clientWidth; 3073 UNCODE.wheight = wheight = (window.innerHeight || document.documentElement.clientHeight) - (bodyBorder * 2); 3074 if ( isSplitMenu && typeof resizeTimer_ === 'undefined' ) centerSplitMenu(); 3075 if (isMobile && (oldWidth == wwidth)) return false; 3076 calculateMenuHeight(false); 3077 initBox(); 3078 headerHeight('.header-wrapper'); 3079 window.dispatchEvent(boxEvent); 3080 scrollFunction(); 3081 shapeDivider(); 3082 showHideScrollup(bodyTop); 3083 clearTimeout(resizeTimer_); 3084 resizeTimer_ = setTimeout(function() { 3085 if (isSplitMenu) centerSplitMenu(); 3086 }, 10); 3087 if ( ! UNCODE.setIsScrolling ) { 3088 clearTimeout(resizeTimer); 3089 resizeTimer = setTimeout(function() { 3090 if ( ! UNCODE.setIsScrolling ) { 3091 UNCODE.wheight = wheight = (window.innerHeight || document.documentElement.clientHeight) - (bodyBorder * 2); 3092 Array.prototype.forEach.call(document.querySelectorAll('.row-inner'), function(el) { 3093 el.style.height = ''; 3094 el.style.marginBottom = ''; 3095 }); 3096 setRowHeight(document.querySelectorAll('.page-wrapper .row-parent, footer .row-parent'), false, true); 3097 } 3098 if (!isMobile) { 3099 initVideoComponent(document.body, '.uncode-video-container.video, .uncode-video-container.self-video'); 3100 } 3101 }, 500); 3102 } 3103 }); 3104 3105 /** 3106 * On DOM ready 3107 */ 3108 window.addEventListener("load", function(){ 3109 if (!UNCODE.isMobile) { 3110 setTimeout(function() { 3111 window.dispatchEvent(UNCODE.boxEvent); 3112 Waypoint.refreshAll(); 3113 }, 2000); 3114 } 3115 //repeat it for mobile since it changes layout on carousel after DOM loading 3116 if (UNCODE.isMobile && !isMobileParallaxAllowed) { 3117 kenburnsHeader(bodyTop); 3118 kenburnsRowCol(bodyTop); 3119 } 3120 backwashHeader(bodyTop); 3121 backwashRowCol(bodyTop); 3122 showHideScrollup(bodyTop); 3123 if (document.createEvent) { // W3C 3124 var ev = document.createEvent('Event'); 3125 ev.initEvent('resize', true, true); 3126 window.dispatchEvent(ev); 3127 } else { // IE 3128 document.fireEvent('onresize'); 3129 } 3130 }, false); 3131 3132 var UNCODE = { 3133 bodyTop: bodyTop, 3134 boxEvent: boxEvent, 3135 bodyBorder: bodyBorder, 3136 initBox: initBox, 3137 adminBarHeight: 0, 3138 menuHeight: 0, 3139 menuMobileHeight: 0, 3140 fixMenuHeight: fixMenuHeight, 3141 verticalRightMenu: verticalRightMenu, 3142 initHeader: initHeader, 3143 initRow: initRow, 3144 setRowHeight: setRowHeight, 3145 switchColorsMenu: switchColorsMenu, 3146 isMobile: isMobile, 3147 scrolling: false, 3148 menuHiding: false, 3149 menuOpened: false, 3150 menuMobileTriggerEvent: menuMobileTriggerEvent, 3151 mediaQuery: mediaQuery, 3152 initVideoComponent: initVideoComponent, 3153 hideMenu: hideMenu, 3154 wwidth: wwidth, 3155 wheight: wheight, 3156 }; 3157 // transport 3158 if (typeof define === 'function' && define.amd) { 3159 // AMD 3160 define(UNCODE); 3161 } else { 3162 // browser global 3163 window.UNCODE = UNCODE; 3164 } 3165 3166 UNCODE.adaptive = function() { 3167 var images = new Array(), 3168 getImages = document.querySelectorAll('.adaptive-async:not(.adaptive-fetching)'); 3169 for (var i = 0; i < getImages.length; i++) { 3170 var imageObj = {}, 3171 el = getImages[i]; 3172 classie.addClass(el, 'adaptive-fetching'); 3173 imageObj.unique = el.getAttribute('data-uniqueid'); 3174 imageObj.url = el.getAttribute('data-guid'); 3175 imageObj.path = el.getAttribute('data-path'); 3176 imageObj.singlew = el.getAttribute('data-singlew'); 3177 imageObj.singleh = el.getAttribute('data-singleh'); 3178 imageObj.origwidth = el.getAttribute('data-width'); 3179 imageObj.origheight = el.getAttribute('data-height'); 3180 imageObj.crop = el.getAttribute('data-crop'); 3181 imageObj.fixed = el.getAttribute('data-fixed') == undefined ? null : el.getAttribute('data-fixed'); 3182 imageObj.screen = window.uncodeScreen; 3183 imageObj.images = window.uncodeImages; 3184 images.push(imageObj); 3185 } 3186 3187 var post_data = { 3188 images: JSON.stringify(images), 3189 action: 'get_adaptive_async', 3190 nonce_adaptive_images: SiteParameters.nonce_adaptive_images 3191 }; 3192 3193 if (images.length > 0) { 3194 var xhr = new XMLHttpRequest(); 3195 xhr.open('POST', SiteParameters.ajax_url, true); 3196 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); 3197 xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 3198 3199 xhr.onreadystatechange = function() { 3200 if (xhr.readyState == XMLHttpRequest.DONE) { 3201 if (xhr.status == 200 && xhr.responseText) { 3202 var jsonResponse = JSON.parse(xhr.responseText); 3203 3204 if (jsonResponse.success && jsonResponse.data.images) { 3205 var images = jsonResponse.data.images; 3206 3207 for (var i = 0; i < images.length; i++) { 3208 var val = images[i], 3209 getImage = document.querySelectorAll('[data-uniqueid="'+val.unique+'"]'); 3210 for (var j = 0; j < getImage.length; j++) { 3211 var attrScr = getImage[j].getAttribute('src'), 3212 replaceImg = new Image(); 3213 replaceImg.source = attrScr; 3214 replaceImg.el = getImage[j]; 3215 3216 classie.removeClass(getImage[j], 'adaptive-async'); 3217 classie.removeClass(getImage[j], 'adaptive-fetching'); 3218 3219 replaceImg.onload = function () { 3220 3221 var _this = this, 3222 parentNode = (_this.el).parentNode, 3223 placeH; 3224 3225 //Workaround for lazy-load flickering on Firefox 3226 if ( typeof parentNode.prepend == 'undefined') { 3227 if (_this.source !== null) { 3228 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3229 (_this.el).lazySrc = _this.src; 3230 3231 if (classie.hasClass((_this.el), 'lazyloaded') || classie.hasClass((_this.el), 'lazyloading')) { 3232 (_this.el).src = _this.src; 3233 (_this.el).removeAttribute('data-lazy-src'); 3234 } 3235 } else { 3236 (_this.el).src = _this.src; 3237 } 3238 } else { 3239 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3240 (_this.el).dataset.bg = _this.src; 3241 3242 if (classie.hasClass((_this.el), 'lazyloaded') || classie.hasClass((_this.el), 'lazyloading')) { 3243 (_this.el).style.backgroundImage = 'url("'+_this.src+'")'; 3244 (_this.el).removeAttribute('data-bg'); 3245 } 3246 } else { 3247 (_this.el).style.backgroundImage = 'url("'+_this.src+'")'; 3248 } 3249 } 3250 3251 classie.addClass(_this.el, 'async-done'); 3252 } else { 3253 if (_this.source !== null) { 3254 placeH = document.createElement("IMG"); 3255 placeH.setAttribute('class', 'placeH'); 3256 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3257 placeH.dataset.lazySrc = _this.src; 3258 3259 if (classie.hasClass(placeH, 'lazyloaded') || classie.hasClass(placeH, 'lazyloading')) { 3260 placeH.src = _this.src; 3261 placeH.removeAttribute('data-lazy-src'); 3262 } 3263 } else { 3264 placeH.src = _this.src; 3265 } 3266 placeH.style.position = 'absolute'; 3267 placeH.style.opacity = '0'; 3268 } else { 3269 placeH = document.createElement("DIV"); 3270 placeH.setAttribute('style', _this.el.getAttribute('style')); 3271 placeH.setAttribute('class', 'placeH ' + _this.el.getAttribute('class')); 3272 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3273 placeH.dataset.bg = _this.src; 3274 3275 if (classie.hasClass(placeH, 'lazyloaded') || classie.hasClass(placeH, 'lazyloading')) { 3276 placeH.style.backgroundImage = 'url("'+_this.src+'")'; 3277 placeH.removeAttribute('data-bg'); 3278 } 3279 } else { 3280 placeH.style.backgroundImage = 'url("'+_this.src+'")'; 3281 } 3282 placeH.style.backgroundSize = 'cover'; 3283 placeH.style.backgroundPosition = 'center'; 3284 placeH.style.position = 'absolute'; 3285 placeH.style.top = '0'; 3286 placeH.style.width = '100%'; 3287 placeH.style.height = '100%'; 3288 } 3289 3290 if ( !classie.hasClass( _this.el, 'box-wrapper') ) { 3291 parentNode.prepend(placeH); 3292 } 3293 3294 requestTimeout(function(){ 3295 if (_this.source !== null) { 3296 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3297 (_this.el).dataset.lazySrc = _this.src; 3298 3299 if (classie.hasClass(_this.el, 'lazyloaded') || classie.hasClass(_this.el, 'lazyloading')) { 3300 (_this.el).src = _this.src; 3301 (_this.el).removeAttribute('data-lazy-src'); 3302 } 3303 } else { 3304 (_this.el).src = _this.src; 3305 } 3306 } else { 3307 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3308 (_this.el).dataset.bg = _this.src; 3309 3310 if (classie.hasClass(_this.el, 'lazyloaded') || classie.hasClass(_this.el, 'lazyloading')) { 3311 (_this.el).style.backgroundImage = 'url("'+_this.src+'")'; 3312 (_this.el).removeAttribute('data-bg'); 3313 } 3314 } else { 3315 (_this.el).style.backgroundImage = 'url("'+_this.src+'")'; 3316 } 3317 } 3318 if ( !classie.hasClass( _this.el, 'box-wrapper') ) { 3319 parentNode.removeChild(placeH); 3320 } 3321 classie.addClass(_this.el, 'async-done'); 3322 }, 250); 3323 } 3324 } 3325 replaceImg.src = val.url; 3326 } 3327 } 3328 3329 } else { 3330 if (SiteParameters.enable_debug == true) { 3331 // This console log is disabled by default 3332 // So nothing is printed in a typical installation 3333 // 3334 // It can be enabled for debugging purposes setting 3335 // the 'uncode_enable_debug_on_js_scripts' filter to true 3336 console.log('There was an error: bad response'); 3337 } 3338 } 3339 3340 } else if (xhr.status == 400) { 3341 if (SiteParameters.enable_debug == true) { 3342 // This console log is disabled by default 3343 // So nothing is printed in a typical installation 3344 // 3345 // It can be enabled for debugging purposes setting 3346 // the 'uncode_enable_debug_on_js_scripts' filter to true 3347 console.log('There was an error 400'); 3348 } 3349 } else { 3350 if (SiteParameters.enable_debug == true) { 3351 // This console log is disabled by default 3352 // So nothing is printed in a typical installation 3353 // 3354 // It can be enabled for debugging purposes setting 3355 // the 'uncode_enable_debug_on_js_scripts' filter to true 3356 console.log('Something else other than 200 was returned'); 3357 } 3358 } 3359 } 3360 } 3361 3362 // Serialize our data 3363 var queryString = "", 3364 arrayLength = Object.keys(post_data).length, 3365 arrayCounter = 0; 3366 3367 for (var key in post_data) { 3368 queryString += key + "=" + post_data[key]; 3369 3370 if (arrayCounter < arrayLength - 1) { 3371 queryString += "&"; 3372 } 3373 3374 arrayCounter++; 3375 } 3376 3377 xhr.send(queryString); 3378 } 3379 }; 3380 3381})(window); 3382 3383/** 3384 * vivus - JavaScript library to make drawing animation on SVG 3385 * @version v0.4.4 3386 * @link https://github.com/maxwellito/vivus 3387 * @license MIT 3388 */ 3389 3390'use strict'; 3391 3392(function () { 3393 3394 'use strict'; 3395 3396/** 3397 * Pathformer 3398 * Beta version 3399 * 3400 * Take any SVG version 1.1 and transform 3401 * child elements to 'path' elements 3402 * 3403 * This code is purely forked from 3404 * https://github.com/Waest/SVGPathConverter 3405 */ 3406 3407/** 3408 * Class constructor 3409 * 3410 * @param {DOM|String} element Dom element of the SVG or id of it 3411 */ 3412function Pathformer(element) { 3413 // Test params 3414 if (typeof element === 'undefined') { 3415 throw new Error('Pathformer [constructor]: "element" parameter is required'); 3416 } 3417 3418 // Set the element 3419 if (element.constructor === String) { 3420 element = document.getElementById(element); 3421 if (!element) { 3422 throw new Error('Pathformer [constructor]: "element" parameter is not related to an existing ID'); 3423 } 3424 } 3425 if (element instanceof window.SVGElement || 3426 element instanceof window.SVGGElement || 3427 /^svg$/i.test(element.nodeName)) { 3428 this.el = element; 3429 } else { 3430 throw new Error('Pathformer [constructor]: "element" parameter must be a string or a SVGelement'); 3431 } 3432 3433 // Start 3434 this.scan(element); 3435} 3436 3437/** 3438 * List of tags which can be transformed 3439 * to path elements 3440 * 3441 * @type {Array} 3442 */ 3443Pathformer.prototype.TYPES = ['line', 'ellipse', 'circle', 'polygon', 'polyline', 'rect']; 3444 3445/** 3446 * List of attribute names which contain 3447 * data. This array list them to check if 3448 * they contain bad values, like percentage. 3449 * 3450 * @type {Array} 3451 */ 3452Pathformer.prototype.ATTR_WATCH = ['cx', 'cy', 'points', 'r', 'rx', 'ry', 'x', 'x1', 'x2', 'y', '
vendor: 12,756 bytes, lines 3452-3853
3452y1', 'y2']; 3453 3454/** 3455 * Finds the elements compatible for transform 3456 * and apply the liked method 3457 * 3458 * @param {object} options Object from the constructor 3459 */ 3460Pathformer.prototype.scan = function (svg) { 3461 var fn, element, pathData, pathDom, 3462 elements = svg.querySelectorAll(this.TYPES.join(',')); 3463 3464 for (var i = 0; i < elements.length; i++) { 3465 element = elements[i]; 3466 fn = this[element.tagName.toLowerCase() + 'ToPath']; 3467 pathData = fn(this.parseAttr(element.attributes)); 3468 pathDom = this.pathMaker(element, pathData); 3469 element.parentNode.replaceChild(pathDom, element); 3470 } 3471}; 3472 3473 3474/** 3475 * Read `line` element to extract and transform 3476 * data, to make it ready for a `path` object. 3477 * 3478 * @param {DOMelement} element Line element to transform 3479 * @return {object} Data for a `path` element 3480 */ 3481Pathformer.prototype.lineToPath = function (element) { 3482 var newElement = {}, 3483 x1 = element.x1 || 0, 3484 y1 = element.y1 || 0, 3485 x2 = element.x2 || 0, 3486 y2 = element.y2 || 0; 3487 3488 newElement.d = 'M' + x1 + ',' + y1 + 'L' + x2 + ',' + y2; 3489 return newElement; 3490}; 3491 3492/** 3493 * Read `rect` element to extract and transform 3494 * data, to make it ready for a `path` object. 3495 * The radius-border is not taken in charge yet. 3496 * (your help is more than welcomed) 3497 * 3498 * @param {DOMelement} element Rect element to transform 3499 * @return {object} Data for a `path` element 3500 */ 3501Pathformer.prototype.rectToPath = function (element) { 3502 var newElement = {}, 3503 x = parseFloat(element.x) || 0, 3504 y = parseFloat(element.y) || 0, 3505 width = parseFloat(element.width) || 0, 3506 height = parseFloat(element.height) || 0; 3507 3508 if (element.rx || element.ry) { 3509 var rx = parseInt(element.rx, 10) || -1, 3510 ry = parseInt(element.ry, 10) || -1; 3511 rx = Math.min(Math.max(rx < 0 ? ry : rx, 0), width/2); 3512 ry = Math.min(Math.max(ry < 0 ? rx : ry, 0), height/2); 3513 3514 newElement.d = 'M ' + (x + rx) + ',' + y + ' ' + 3515 'L ' + (x + width - rx) + ',' + y + ' ' + 3516 'A ' + rx + ',' + ry + ',0,0,1,' + (x + width) + ',' + (y + ry) + ' ' + 3517 'L ' + (x + width) + ',' + (y + height - ry) + ' ' + 3518 'A ' + rx + ',' + ry + ',0,0,1,' + (x + width - rx) + ',' + (y + height) + ' ' + 3519 'L ' + (x + rx) + ',' + (y + height) + ' ' + 3520 'A ' + rx + ',' + ry + ',0,0,1,' + x + ',' + (y + height - ry) + ' ' + 3521 'L ' + x + ',' + (y + ry) + ' ' + 3522 'A ' + rx + ',' + ry + ',0,0,1,' + (x + rx) + ',' + y; 3523 } 3524 else { 3525 newElement.d = 'M' + x + ' ' + y + ' ' + 3526 'L' + (x + width) + ' ' + y + ' ' + 3527 'L' + (x + width) + ' ' + (y + height) + ' ' + 3528 'L' + x + ' ' + (y + height) + ' Z'; 3529 } 3530 return newElement; 3531}; 3532 3533/** 3534 * Read `polyline` element to extract and transform 3535 * data, to make it ready for a `path` object. 3536 * 3537 * @param {DOMelement} element Polyline element to transform 3538 * @return {object} Data for a `path` element 3539 */ 3540Pathformer.prototype.polylineToPath = function (element) { 3541 var newElement = {}, 3542 points = element.points.trim().split(' '), 3543 i, path; 3544 3545 // Reformatting if points are defined without commas 3546 if (element.points.indexOf(',') === -1) { 3547 var formattedPoints = []; 3548 for (i = 0; i < points.length; i+=2) { 3549 formattedPoints.push(points[i] + ',' + points[i+1]); 3550 } 3551 points = formattedPoints; 3552 } 3553 3554 // Generate the path.d value 3555 path = 'M' + points[0]; 3556 for(i = 1; i < points.length; i++) { 3557 if (points[i].indexOf(',') !== -1) { 3558 path += 'L' + points[i]; 3559 } 3560 } 3561 newElement.d = path; 3562 return newElement; 3563}; 3564 3565/** 3566 * Read `polygon` element to extract and transform 3567 * data, to make it ready for a `path` object. 3568 * This method rely on polylineToPath, because the 3569 * logic is similar. The path created is just closed, 3570 * so it needs an 'Z' at the end. 3571 * 3572 * @param {DOMelement} element Polygon element to transform 3573 * @return {object} Data for a `path` element 3574 */ 3575Pathformer.prototype.polygonToPath = function (element) { 3576 var newElement = Pathformer.prototype.polylineToPath(element); 3577 3578 newElement.d += 'Z'; 3579 return newElement; 3580}; 3581 3582/** 3583 * Read `ellipse` element to extract and transform 3584 * data, to make it ready for a `path` object. 3585 * 3586 * @param {DOMelement} element ellipse element to transform 3587 * @return {object} Data for a `path` element 3588 */ 3589Pathformer.prototype.ellipseToPath = function (element) { 3590 var newElement = {}, 3591 rx = parseFloat(element.rx) || 0, 3592 ry = parseFloat(element.ry) || 0, 3593 cx = parseFloat(element.cx) || 0, 3594 cy = parseFloat(element.cy) || 0, 3595 startX = cx - rx, 3596 startY = cy, 3597 endX = parseFloat(cx) + parseFloat(rx), 3598 endY = cy; 3599 3600 newElement.d = 'M' + startX + ',' + startY + 3601 'A' + rx + ',' + ry + ' 0,1,1 ' + endX + ',' + endY + 3602 'A' + rx + ',' + ry + ' 0,1,1 ' + startX + ',' + endY; 3603 return newElement; 3604}; 3605 3606/** 3607 * Read `circle` element to extract and transform 3608 * data, to make it ready for a `path` object. 3609 * 3610 * @param {DOMelement} element Circle element to transform 3611 * @return {object} Data for a `path` element 3612 */ 3613Pathformer.prototype.circleToPath = function (element) { 3614 var newElement = {}, 3615 r = parseFloat(element.r) || 0, 3616 cx = parseFloat(element.cx) || 0, 3617 cy = parseFloat(element.cy) || 0, 3618 startX = cx - r, 3619 startY = cy, 3620 endX = parseFloat(cx) + parseFloat(r), 3621 endY = cy; 3622 3623 newElement.d = 'M' + startX + ',' + startY + 3624 'A' + r + ',' + r + ' 0,1,1 ' + endX + ',' + endY + 3625 'A' + r + ',' + r + ' 0,1,1 ' + startX + ',' + endY; 3626 return newElement; 3627}; 3628 3629/** 3630 * Create `path` elements form original element 3631 * and prepared objects 3632 * 3633 * @param {DOMelement} element Original element to transform 3634 * @param {object} pathData Path data (from `toPath` methods) 3635 * @return {DOMelement} Path element 3636 */ 3637Pathformer.prototype.pathMaker = function (element, pathData) { 3638 var i, attr, pathTag = document.createElementNS('http://www.w3.org/2000/svg','path'); 3639 for(i = 0; i < element.attributes.length; i++) { 3640 attr = element.attributes[i]; 3641 if (this.ATTR_WATCH.indexOf(attr.name) === -1) { 3642 pathTag.setAttribute(attr.name, attr.value); 3643 } 3644 } 3645 for(i in pathData) { 3646 pathTag.setAttribute(i, pathData[i]); 3647 } 3648 return pathTag; 3649}; 3650 3651/** 3652 * Parse attributes of a DOM element to 3653 * get an object of attribute => value 3654 * 3655 * @param {NamedNodeMap} attributes Attributes object from DOM element to parse 3656 * @return {object} Object of attributes 3657 */ 3658Pathformer.prototype.parseAttr = function (element) { 3659 var attr, output = {}; 3660 for (var i = 0; i < element.length; i++) { 3661 attr = element[i]; 3662 // Check if no data attribute contains '%', or the transformation is impossible 3663 if (this.ATTR_WATCH.indexOf(attr.name) !== -1 && attr.value.indexOf('%') !== -1) { 3664 throw new Error('Pathformer [parseAttr]: a SVG shape got values in percentage. This cannot be transformed into \'path\' tags. Please use \'viewBox\'.'); 3665 } 3666 output[attr.name] = attr.value; 3667 } 3668 return output; 3669}; 3670 3671 'use strict'; 3672 3673var setupEnv, requestAnimFrame, cancelAnimFrame, parsePositiveInt; 3674 3675/** 3676 * Vivus 3677 * Beta version 3678 * 3679 * Take any SVG and make the animation 3680 * to give give the impression of live drawing 3681 * 3682 * This in more than just inspired from codrops 3683 * At that point, it's a pure fork. 3684 */ 3685 3686/** 3687 * Class constructor 3688 * option structure 3689 * type: 'delayed'|'sync'|'oneByOne'|'script' (to know if the items must be drawn synchronously or not, default: delayed) 3690 * duration: <int> (in frames) 3691 * start: 'inViewport'|'manual'|'autostart' (start automatically the animation, default: inViewport) 3692 * delay: <int> (delay between the drawing of first and last path) 3693 * dashGap <integer> whitespace extra margin between dashes 3694 * pathTimingFunction <function> timing animation function for each path element of the SVG 3695 * animTimingFunction <function> timing animation function for the complete SVG 3696 * forceRender <boolean> force the browser to re-render all updated path items 3697 * selfDestroy <boolean> removes all extra styling on the SVG, and leaves it as original 3698 * 3699 * The attribute 'type' is by default on 'delayed'. 3700 * - 'delayed' 3701 * all paths are draw at the same time but with a 3702 * little delay between them before start 3703 * - 'sync' 3704 * all path are start and finish at the same time 3705 * - 'oneByOne' 3706 * only one path is draw at the time 3707 * the end of the first one will trigger the draw 3708 * of the next one 3709 * 3710 * All these values can be overwritten individually 3711 * for each path item in the SVG 3712 * The value of frames will always take the advantage of 3713 * the duration value. 3714 * If you fail somewhere, an error will be thrown. 3715 * Good luck. 3716 * 3717 * @constructor 3718 * @this {Vivus} 3719 * @param {DOM|String} element Dom element of the SVG or id of it 3720 * @param {Object} options Options about the animation 3721 * @param {Function} callback Callback for the end of the animation 3722 */ 3723function Vivus (element, options, callback) { 3724 3725 setupEnv(); 3726 3727 // Setup 3728 this.isReady = false; 3729 this.setElement(element, options); 3730 this.setOptions(options); 3731 this.setCallback(callback); 3732 3733 if (this.isReady) { 3734 this.init(); 3735 } 3736} 3737 3738/** 3739 * Timing functions 3740 ************************************** 3741 * 3742 * Default functions to help developers. 3743 * It always take a number as parameter (between 0 to 1) then 3744 * return a number (between 0 and 1) 3745 */ 3746Vivus.LINEAR = function (x) {return x;}; 3747Vivus.EASE = function (x) {return -Math.cos(x * Math.PI) / 2 + 0.5;}; 3748Vivus.EASE_OUT = function (x) {return 1 - Math.pow(1-x, 3);}; 3749Vivus.EASE_IN = function (x) {return Math.pow(x, 3);}; 3750Vivus.EASE_OUT_BOUNCE = function (x) { 3751 var base = -Math.cos(x * (0.5 * Math.PI)) + 1, 3752 rate = Math.pow(base,1.5), 3753 rateR = Math.pow(1 - x, 2), 3754 progress = -Math.abs(Math.cos(rate * (2.5 * Math.PI) )) + 1; 3755 return (1- rateR) + (progress * rateR); 3756}; 3757 3758 3759/** 3760 * Setters 3761 ************************************** 3762 */ 3763 3764/** 3765 * Check and set the element in the instance 3766 * The method will not return anything, but will throw an 3767 * error if the parameter is invalid 3768 * 3769 * @param {DOM|String} element SVG Dom element or id of it 3770 */ 3771Vivus.prototype.setElement = function (element, options) { 3772 var onLoad, self; 3773 3774 // Basic check 3775 if (typeof element === 'undefined') { 3776 throw new Error('Vivus [constructor]: "element" parameter is required'); 3777 } 3778 3779 // Set the element 3780 if (element.constructor === String) { 3781 element = document.getElementById(element); 3782 if (!element) { 3783 throw new Error('Vivus [constructor]: "element" parameter is not related to an existing ID'); 3784 } 3785 } 3786 this.parentEl = element; 3787 3788 // Load the SVG with XMLHttpRequest and extract the SVG 3789 if (options && options.file) { 3790 var self = this; 3791 onLoad = function (e) { 3792 var domSandbox = document.createElement('div'); 3793 domSandbox.innerHTML = this.responseText; 3794 3795 var svgTag = domSandbox.querySelector('svg'); 3796 if (!svgTag) { 3797 throw new Error('Vivus [load]: Cannot find the SVG in the loaded file : ' + options.file); 3798 } 3799 3800 self.el = svgTag 3801 self.el.setAttribute('width', '100%'); 3802 self.el.setAttribute('height', '100%'); 3803 self.parentEl.appendChild(self.el) 3804 self.isReady = true; 3805 self.init(); 3806 self = null; 3807 } 3808 3809 var oReq = new window.XMLHttpRequest(); 3810 oReq.addEventListener('load', onLoad); 3811 oReq.open('GET', options.file); 3812 oReq.send(); 3813 return; 3814 } 3815 3816 switch (element.constructor) { 3817 case window.SVGSVGElement: 3818 case window.SVGElement: 3819 case window.SVGGElement: 3820 this.el = element; 3821 this.isReady = true; 3822 break; 3823 3824 case window.HTMLObjectElement: 3825 self = this; 3826 onLoad = function (e) { 3827 if (self.isReady) { 3828 return; 3829 } 3830 self.el = element.contentDocument && element.contentDocument.querySelector('svg'); 3831 if (!self.el && e) { 3832 throw new Error('Vivus [constructor]: object loaded does not contain any SVG'); 3833 } 3834 else if (self.el) { 3835 if (element.getAttribute('built-by-vivus')) { 3836 self.parentEl.insertBefore(self.el, element); 3837 self.parentEl.removeChild(element); 3838 self.el.setAttribute('width', '100%'); 3839 self.el.setAttribute('height', '100%'); 3840 } 3841 self.isReady = true; 3842 self.init(); 3843 self = null; 3844 } 3845 }; 3846 3847 if (!onLoad()) { 3848 element.addEventListener('load', onLoad); 3849 } 3850 break; 3851 3852 default: 3853 throw new Error('Vivus [constructor]: "element" parameter is not val
3853id (or miss the "file" attribute)'); 3854 } 3855}; 3856 3857/** 3858 * Set up user option to the instance 3859 * The method will not return anything, but will throw an 3860 * error if the parameter is invalid 3861 * 3862 * @param {object} options Object from the constructor 3863 */ 3864Vivus.prototype.setOptions = function (options) { 3865 var allowedTypes = ['delayed', 'sync', 'async', 'nsync', 'oneByOne', 'scenario', 'scenario-sync']; 3866 var allowedStarts = ['inViewport', 'manual', 'autostart']; 3867 3868 // Basic check 3869 if (options !== undefined && options.constructor !== Object) { 3870 throw new Error('Vivus [constructor]: "options" parameter must be an object'); 3871 } 3872 else { 3873 options = options || {}; 3874 } 3875 3876 // Set the animation type 3877 if (options.type && allowedTypes.indexOf(options.type) === -1) { 3878 throw new Error('Vivus [constructor]: ' + options.type + ' is not an existing animation `type`'); 3879 } 3880 else { 3881 this.type = options.type || allowedTypes[0]; 3882 } 3883 3884 // Set the start type 3885 if (options.start && allowedStarts.indexOf(options.start) === -1) { 3886 throw new Error('Vivus [constructor]: ' + options.start + ' is not an existing `start` option'); 3887 } 3888 else { 3889 this.start = options.start || allowedStarts[0]; 3890 } 3891 3892 this.isIE = (window.navigator.userAgent.indexOf('MSIE') !== -1 || window.navigator.userAgent.indexOf('Trident/') !== -1 || window.navigator.userAgent.indexOf('Edge/') !== -1 ); 3893 this.duration = parsePositiveInt(options.duration, 120); 3894 this.delay = parsePositiveInt(options.delay, null); 3895 //Uncode addition 3896 this.delayStart = parsePositiveInt(options.delayStart, null); 3897 //#END 3898 this.dashGap = parsePositiveInt(options.dashGap, 1); 3899 this.forceRender = options.hasOwnProperty('forceRender') ? !!options.forceRender : this.isIE; 3900 this.reverseStack = !!options.reverseStack; 3901 this.selfDestroy = !!options.selfDestroy; 3902 this.onReady = options.onReady; 3903 this.map = []; 3904 this.frameLength = this.currentFrame = this.delayUnit = this.speed = this.handle = null; 3905 3906 this.ignoreInvisible = options.hasOwnProperty('ignoreInvisible') ? !!options.ignoreInvisible : false; 3907 3908 this.animTimingFunction = options.animTimingFunction || Vivus.LINEAR; 3909 this.pathTimingFunction = options.pathTimingFunction || Vivus.LINEAR; 3910 3911 if (this.delay >= this.duration) { 3912 throw new Error('Vivus [constructor]: delay must be shorter than duration'); 3913 } 3914}; 3915 3916/** 3917 * Set up callback to the instance 3918 * The method will not return enything, but will throw an 3919 * error if the parameter is invalid 3920 * 3921 * @param {Function} callback Callback for the animation end 3922 */ 3923Vivus.prototype.setCallback = function (callback) { 3924 // Basic check 3925 if (!!callback && callback.constructor !== Function) { 3926 throw new Error('Vivus [constructor]: "callback" parameter must be a function'); 3927 } 3928 this.callback = callback || function () {}; 3929}; 3930 3931 3932/** 3933 * Core 3934 ************************************** 3935 */ 3936 3937/** 3938 * Map the svg, path by path. 3939 * The method return nothing, it just fill the 3940 * `map` array. Each item in this array represent 3941 * a path element from the SVG, with informations for 3942 * the animation. 3943 * 3944 * ``` 3945 * [ 3946 * { 3947 * el: <DOMobj> the path element 3948 * length: <number> length of the path line 3949 * startAt: <number> time start of the path animation (in frames) 3950 * duration: <number> path animation duration (in frames) 3951 * }, 3952 * ... 3953 * ] 3954 * ``` 3955 * 3956 */ 3957Vivus.prototype.mapping = function () { 3958 var i, paths, path, pAttrs, pathObj, totalLength, lengthMeter, timePoint; 3959 timePoint = totalLength = lengthMeter = 0; 3960 paths = this.el.querySelectorAll('path'); 3961 3962 for (i = 0; i < paths.length; i++) { 3963 path = paths[i]; 3964 if (this.isInvisible(path)) { 3965 continue; 3966 } 3967 pathObj = { 3968 el: path, 3969 length: Math.ceil(path.getTotalLength()) 3970 }; 3971 // Test if the path length is correct 3972 if (isNaN(pathObj.length)) { 3973 if (window.console && console.warn) { 3974 console.warn('Vivus [mapping]: cannot retrieve a path element length', path); 3975 } 3976 continue; 3977 } 3978 this.map.push(pathObj); 3979 path.style.strokeDasharray = pathObj.length + ' ' + (pathObj.length + this.dashGap * 2); 3980 path.style.strokeDashoffset = pathObj.length + this.dashGap; 3981 pathObj.length += this.dashGap; 3982 totalLength += pathObj.length; 3983 3984 this.renderPath(i); 3985 } 3986 3987 totalLength = totalLength === 0 ? 1 : totalLength; 3988 this.delay = this.delay === null ? this.duration / 3 : this.delay; 3989 this.delayUnit = this.delay / (paths.length > 1 ? paths.length - 1 : 1); 3990 3991 // Reverse stack if asked 3992 if (this.reverseStack) { 3993 this.map.reverse(); 3994 } 3995 3996 for (i = 0; i < this.map.length; i++) { 3997 pathObj = this.map[i]; 3998 3999 switch (this.type) { 4000 case 'delayed': 4001 pathObj.startAt = this.delayUnit * i; 4002 pathObj.duration = this.duration - this.delay; 4003 break; 4004 4005 case 'oneByOne': 4006 pathObj.startAt = lengthMeter / totalLength * this.duration; 4007 pathObj.duration = pathObj.length / totalLength * this.duration; 4008 break; 4009 4010 case 'sync': 4011 case 'async': 4012 case 'nsync': 4013 pathObj.startAt = 0; 4014 pathObj.duration = this.duration; 4015 break; 4016 4017 case 'scenario-sync': 4018 path = pathObj.el; 4019 pAttrs = this.parseAttr(path); 4020 pathObj.startAt = timePoint + (parsePositiveInt(pAttrs['data-delay'], this.delayUnit) || 0); 4021 pathObj.duration = parsePositiveInt(pAttrs['data-duration'], this.duration); 4022 timePoint = pAttrs['data-async'] !== undefined ? pathObj.startAt : pathObj.startAt + pathObj.duration; 4023 this.frameLength = Math.max(this.frameLength, (pathObj.startAt + pathObj.duration)); 4024 break; 4025 4026 case 'scenario': 4027 path = pathObj.el; 4028 pAttrs = this.parseAttr(path); 4029 pathObj.startAt = parsePositiveInt(pAttrs['data-start'], this.delayUnit) || 0; 4030 pathObj.duration = parsePositiveInt(pAttrs['data-duration'], this.duration); 4031 this.frameLength = Math.max(this.frameLength, (pathObj.startAt + pathObj.duration)); 4032 break; 4033 } 4034 lengthMeter += pathObj.length; 4035 this.frameLength = this.frameLength || this.duration; 4036 } 4037}; 4038 4039/** 4040 * Interval method to draw the SVG from current 4041 * position of the animation. It update the value of 4042 * `currentFrame` and re-trace the SVG. 4043 * 4044 * It use this.handle to store the requestAnimationFrame 4045 * and clear it one the animation is stopped. So this 4046 * attribute can be used to know if the animation is 4047 * playing. 4048 * 4049 * Once the animation at the end, this method will 4050 * trigger the Vivus callback. 4051 * 4052 */ 4053Vivus.prototype.drawer = function () { 4054 var self = this; 4055 this.currentFrame += this.speed; 4056 4057 if (this.currentFrame <= 0) { 4058 this.stop(); 4059 this.reset(); 4060 } else if (this.currentFrame >= this.frameLength) { 4061 this.stop(); 4062 this.currentFrame = this.frameLength; 4063 this.trace();
vendor: 5,092 bytes, lines 4064-4250
4064 if (this.selfDestroy) { 4065 this.destroy(); 4066 } 4067 } else { 4068 this.trace(); 4069 this.handle = requestAnimFrame(function () { 4070 self.drawer(); 4071 }); 4072 return; 4073 } 4074 4075 this.callback(this); 4076 if (this.instanceCallback) { 4077 this.instanceCallback(this); 4078 this.instanceCallback = null; 4079 } 4080}; 4081 4082/** 4083 * Draw the SVG at the current instant from the 4084 * `currentFrame` value. Here is where most of the magic is. 4085 * The trick is to use the `strokeDashoffset` style property. 4086 * 4087 * For optimisation reasons, a new property called `progress` 4088 * is added in each item of `map`. This one contain the current 4089 * progress of the path element. Only if the new value is different 4090 * the new value will be applied to the DOM element. This 4091 * method save a lot of resources to re-render the SVG. And could 4092 * be improved if the animation couldn't be played forward. 4093 * 4094 */ 4095Vivus.prototype.trace = function () { 4096 var i, progress, path, currentFrame; 4097 currentFrame = this.animTimingFunction(this.currentFrame / this.frameLength) * this.frameLength; 4098 for (i = 0; i < this.map.length; i++) { 4099 path = this.map[i]; 4100 progress = (currentFrame - path.startAt) / path.duration; 4101 progress = this.pathTimingFunction(Math.max(0, Math.min(1, progress))); 4102 if (path.progress !== progress) { 4103 path.progress = progress; 4104 path.el.style.strokeDashoffset = Math.floor(path.length * (1 - progress)); 4105 this.renderPath(i); 4106 } 4107 } 4108}; 4109 4110/** 4111 * Method forcing the browser to re-render a path element 4112 * from it's index in the map. Depending on the `forceRender` 4113 * value. 4114 * The trick is to replace the path element by it's clone. 4115 * This practice is not recommended because it's asking more 4116 * ressources, too much DOM manupulation.. 4117 * but it's the only way to let the magic happen on IE. 4118 * By default, this fallback is only applied on IE. 4119 * 4120 * @param {Number} index Path index 4121 */ 4122Vivus.prototype.renderPath = function (index) { 4123 if (this.forceRender && this.map && this.map[index]) { 4124 var pathObj = this.map[index], 4125 newPath = pathObj.el.cloneNode(true); 4126 pathObj.el.parentNode.replaceChild(newPath, pathObj.el); 4127 pathObj.el = newPath; 4128 } 4129}; 4130 4131/** 4132 * When the SVG object is loaded and ready, 4133 * this method will continue the initialisation. 4134 * 4135 * This this mainly due to the case of passing an 4136 * object tag in the constructor. It will wait 4137 * the end of the loading to initialise. 4138 * 4139 */ 4140Vivus.prototype.init = function () { 4141 // Set object variables 4142 this.frameLength = 0; 4143 this.currentFrame = 0; 4144 this.map = []; 4145 4146 // Start 4147 new Pathformer(this.el); 4148 this.mapping(); 4149 this.starter(); 4150 4151 if (this.onReady) { 4152 this.onReady(this); 4153 } 4154}; 4155 4156/** 4157 * Trigger to start of the animation. 4158 * Depending on the `start` value, a different script 4159 * will be applied. 4160 * 4161 * If the `start` value is not valid, an error will be thrown. 4162 * Even if technically, this is impossible. 4163 * 4164 */ 4165Vivus.prototype.starter = function () { 4166 switch (this.start) { 4167 case 'manual': 4168 return; 4169 4170 case 'autostart': 4171 this.play(); 4172 break; 4173 4174 case 'inViewport': 4175 var self = this, 4176 listener = function () { 4177 if (self.isInViewport(self.parentEl, 1)) { 4178 self.play(); 4179 window.removeEventListener('scroll', listener); 4180 //Uncode addition 4181 window.removeEventListener('fp-slide-changed', listener); 4182 window.removeEventListener('fp-slide-scroll', listener); 4183 //#END 4184 } 4185 }; 4186 window.addEventListener('scroll', listener); 4187 //Uncode addition 4188 window.addEventListener('fp-slide-changed', listener); 4189 window.addEventListener('fp-slide-scroll', listener); 4190 //#END 4191 listener(); 4192 break; 4193 } 4194}; 4195 4196 4197/** 4198 * Controls 4199 ************************************** 4200 */ 4201 4202/** 4203 * Get the current status of the animation between 4204 * three different states: 'start', 'progress', 'end'. 4205 * @return {string} Instance status 4206 */ 4207Vivus.prototype.getStatus = function () { 4208 return this.currentFrame === 0 ? 'start' : this.currentFrame === this.frameLength ? 'end' : 'progress'; 4209}; 4210 4211/** 4212 * Reset the instance to the initial state : undraw 4213 * Be careful, it just reset the animation, if you're 4214 * playing the animation, this won't stop it. But just 4215 * make it start from start. 4216 * 4217 */ 4218Vivus.prototype.reset = function () { 4219 return this.setFrameProgress(0); 4220}; 4221 4222/** 4223 * Set the instance to the final state : drawn 4224 * Be careful, it just set the animation, if you're 4225 * playing the animation on rewind, this won't stop it. 4226 * But just make it start from the end. 4227 * 4228 */ 4229Vivus.prototype.finish = function () { 4230 return this.setFrameProgress(1); 4231}; 4232 4233/** 4234 * Set the level of progress of the drawing. 4235 * 4236 * @param {number} progress Level of progress to set 4237 */ 4238Vivus.prototype.setFrameProgress = function (progress) { 4239 progress = Math.min(1, Math.max(0, progress)); 4240 this.currentFrame = Math.round(this.frameLength * progress); 4241 this.trace(); 4242 return this; 4243}; 4244 4245/** 4246 * Play the animation at the desired speed. 4247 * Speed must be a valid number (no zero). 4248 * By default, the speed value is 1. 4249 * But a negative value is accepted to go forward. 4250 *
4251 * And works with float too. 4252 * But don't forget we are in JavaScript, se be nice 4253 * with him and give him a 1/2^x value. 4254 * 4255 * @param {number} speed Animation speed [optional] 4256 */ 4257Vivus.prototype.play = function (speed, callback) { 4258 this.instanceCallback = null; 4259 4260 if (speed && typeof speed === 'function') { 4261 this.instanceCallback = speed; // first parameter is actually the callback function 4262 speed = null; 4263 } 4264 else if (speed && typeof speed !== 'number') { 4265 throw new Error('Vivus [play]: invalid speed'); 4266 } 4267 // if the first parameter wasn't the callback, check if the seconds was 4268 if (callback && typeof(callback) === 'function' && !this.instanceCallback) { 4269 this.instanceCallback = callback; 4270 } 4271 4272 4273 this.speed = speed || 1; 4274 //Uncode addition 4275 if (!this.handle) { 4276 var $this = this, 4277 delay = (this.delayStart != null) ? this.delayStart : 0; 4278 setTimeout(function() { 4279 $this.drawer(); 4280 }, delay); 4281 } 4282 //#END 4283 return this; 4284}; 4285 4286/** 4287 * Stop the current animation, if on progress. 4288 * Should not trigger any error. 4289 * 4290 */ 4291Vivus.prototype.stop = function () { 4292 if (this.handle) { 4293 cancelAnimFrame(this.handle); 4294 this.handle = null; 4295 } 4296 return this; 4297}; 4298 4299/** 4300 * Destroy the instance. 4301 * Remove all bad styling attributes on all 4302 * path tags 4303 * 4304 */ 4305Vivus.prototype.destroy = function () { 4306 this.stop(); 4307 var i, path; 4308 for (i = 0; i < this.map.length; i++) { 4309 path = this.map[i]; 4310 path.el.style.strokeDashoffset = null; 4311 path.el.style.strokeDasharray = null; 4312 this.renderPath(i); 4313 } 4314}; 4315 4316 4317/** 4318 * Utils methods 4319 * include methods from Codrops 4320 ************************************** 4321 */ 4322 4323/** 4324 * Method to best guess if a path should added into 4325 * the animation or not. 4326 * 4327 * 1. Use the `data-vivus-ignore` attribute if set 4328 * 2. Check if the instance must ignore invisible paths 4329 * 3. Check if the path is visible 4330 * 4331 * For now the visibility checking is unstable. 4332 * It will be used for a beta phase. 4333 * 4334 * Other improvments are planned. Like detecting 4335 * is the path got a stroke or a valid opacity. 4336 */ 4337Vivus.prototype.isInvisible = function (el) { 4338 var rect, 4339 ignoreAttr = el.getAttribute('data-ignore'); 4340 4341 if (ignoreAttr !== null) { 4342 return ignoreAttr !== 'false'; 4343 } 4344 4345 if (this.ignoreInvisible) { 4346 rect = el.getBoundingClientRect(); 4347 return !rect.width && !rect.height; 4348 } 4349 else { 4350 return false; 4351 } 4352}; 4353 4354/** 4355 * Parse attributes of a DOM element to 4356 * get an object of {attributeName => attributeValue} 4357 * 4358 * @param {object} element DOM element to parse 4359 * @return {object} Object of attributes 4360 */ 4361Vivus.prototype.parseAttr = function (element) { 4362 var attr, output = {}; 4363 if (element && element.attributes) { 4364 for (var i = 0; i < element.attributes.length; i++) { 4365 attr = element.attributes[i]; 4366 output[attr.name] = attr.value; 4367 } 4368 } 4369 return output; 4370}; 4371 4372/** 4373 * Reply if an element is in the page viewport 4374 * 4375 * @param {object} el Element to observe 4376 * @param {number} h Percentage of height 4377 * @return {boolean} 4378 */ 4379Vivus.prototype.isInViewport = function (el, h) { 4380 var scrolled = this.scrollY(), 4381 viewed = scrolled + this.getViewportH(), 4382 elBCR = el.getBoundingClientRect(), 4383 elHeight = elBCR.height, 4384 elTop = scrolled + elBCR.top, 4385 elBottom = elTop + elHeight; 4386 4387 // if 0, the element is considered in the viewport as soon as it enters. 4388 // if 1, the element is considered in the viewport only when it's fully inside 4389 // value in percentage (1 >= h >= 0) 4390 h = h || 0; 4391 4392 return (elTop + elHeight * h) <= viewed && (elBottom) >= scrolled; 4393}; 4394 4395 4396/** 4397 * Get the viewport height in pixels 4398 * 4399 * @return {integer} Viewport height 4400 */ 4401Vivus.prototype.getViewportH = function () { 4402 var client = this.docElem.clientHeight, 4403 inner = window.innerHeight; 4404 4405 if (client < inner) { 4406 return inner; 4407 } 4408 else { 4409 return client; 4410 } 4411}; 4412 4413/** 4414 * Get the page Y offset 4415 * 4416 * @return {integer} Page Y offset 4417 */ 4418Vivus.prototype.scrollY = function () { 4419 return window.pageYOffset || this.docElem.scrollTop; 4420}; 4421 4422setupEnv = function () { 4423 4424 if (Vivus.prototype.docElem) { 4425 return; 4426 } 4427 4428 /** 4429 * Alias for document element 4430 * 4431 * @type {DOMelement} 4432 */ 4433 Vivus.prototype.docElem = window.document.documentElement; 4434 4435 /** 4436 * Alias for `requestAnimationFrame` or 4437 * `setTimeout` function for deprecated browsers. 4438 * 4439 */ 4440 requestAnimFrame = (function () { 4441 return ( 4442 window.requestAnimationFrame || 4443 window.webkitRequestAnimationFrame || 4444 window.mozRequestAnimationFrame || 4445 window.oRequestAnimationFrame || 4446 window.msRequestAnimationFrame || 4447 function(/* function */ callback){ 4448 return window.setTimeout(callback, 1000 / 60); 4449 } 4450 ); 4451 })(); 4452 4453 /** 4454 * Alias for `cancelAnimationFrame` or 4455 * `cancelTimeout` function for deprecated browsers. 4456 * 4457 */ 4458 cancelAnimFrame = (function () { 4459 return ( 4460 window.cancelAnimationFrame || 4461 window.webkitCancelAnimationFrame || 4462 window.mozCancelAnimationFrame || 4463 window.oCancelAnimationFrame || 4464 window.msCancelAnimationFrame || 4465 function(id){ 4466 return window.clearTimeout(id); 4467 } 4468 ); 4469 })(); 4470}; 4471 4472/** 4473 * Parse string to integer. 4474 * If the number is not positive or null 4475 * the method will return the default value 4476 * or 0 if undefined 4477 * 4478 * @param {string} value String to parse 4479 * @param {*}
4479 defaultValue Value to return if the result parsed is invalid 4480 * @return {number} 4481 * 4482 */ 4483parsePositiveInt = function (value, defaultValue) { 4484 var output = parseInt(value, 10); 4485 return (output >= 0) ? output : defaultValue; 4486}; 4487 4488 4489 if (typeof define === 'function' && define.amd) { 4490 // AMD. Register as an anonymous module. 4491 define([], function() { 4492 return Vivus; 4493 }); 4494 } else if (typeof exports === 'object') { 4495 // Node. Does not work with strict CommonJS, but 4496 // only CommonJS-like environments that support module.exports, 4497 // like Node. 4498 module.exports = Vivus; 4499 } else { 4500 // Browser globals 4501 window.Vivus = Vivus; 4502 } 4503 4504}()); 4505 4506(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); 4507iNoBounce.disable(); 4508 4509/* 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)}} 4510function 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)})}; 4511function 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,
4511window.Promise.race=x,window.Promise.all=w,window.Promise.prototype.then=n.prototype.c,window.Promise.prototype["catch"]=n.prototype.g);}()); 4512 4513(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;"; 4514this.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)} 4515function 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} 4516function 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(" ")} 4517B.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)}, 4518b)}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(""+ 4519n+"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();
4519A(e,function(a){f=a;v()});u(e, 4520L(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.