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 menuOpacity(); 872 }, 873 menuOpacity = function(){ 874 transmenuel = document.querySelectorAll('.menu-transparent:not(.vmenu-container)'); 875 if (typeof transmenuel === 'undefined' || !transmenuel.length) { 876 return false; 877 } 878 if (wwidth > mediaQuery && classie.hasClass(transmenuel[0], 'menu-desktoptransparent')) { 879 classie.removeClass(transmenuel[0], 'menu-desktoptransparent'); 880 classie.addClass(transmenuel[0], 'menu-desktop-transparent'); 881 } else if (wwidth <= mediaQuery && classie.hasClass(transmenuel[0], 'menu-desktop-transparent')) { 882 classie.removeClass(transmenuel[0], 'menu-desktop-transparent'); 883 classie.addClass(transmenuel[0], 'menu-desktoptransparent'); 884 } 885 }, 886 verticalRightMenu = function() { 887 var setVrightMenu, vRightMenuw; 888 var vRightMenu = function(){ 889 $initBox = document.getElementById("initBox"); 890 $mainHeader = document.querySelector('.main-header'); 891 mainHeader = $mainHeader.innerHTML; 892 $mainWrapper = document.querySelector('.main-wrapper'); 893 if ( classie.hasClass(document.body, 'vmenu') && ( ( classie.hasClass(document.body, 'vmenu-position-right') && ! classie.hasClass(document.body, 'rtl') ) || ( classie.hasClass(document.body, 'vmenu-position-left') && classie.hasClass(document.body, 'rtl') ) ) ) { 894 if ( wwidth <= mediaQuery ) { 895 $initBox.parentNode.insertBefore($mainHeader, $initBox.nextSibling); 896 } else { 897 $mainWrapper.parentNode.insertBefore($mainHeader, $mainWrapper.nextSibling); 898 } 899 $mainHeader.removeChild; 900 } 901 }; 902 vRightMenu(); 903 window.addEventListener("resize", function() { 904 if ( wwidth != vRightMenuw ) { 905 clearRequestTimeout(setVrightMenu); 906 setVrightMenu = requestTimeout( function(){ 907 vRightMenuw = wwidth; 908 vRightMenu(); 909 }, 100 ); 910 } 911 }); 912 }, 913 calculateMenuHeight = function(first) { 914 menuHeight = transmenuHeight = secmenuHeight = 0; 915 916 if (mastheadMobile != null) { 917 if (mastheadMobile.length === 2) { 918 if (wwidth > mediaQuery) { 919 UNCODE.menuMobileHeight = outerHeight(mastheadMobile[1]); 920 mastheadMobilePaddingTop = parseFloat(getComputedStyle(mastheadMobile[1]).paddingTop); 921 } else { 922 UNCODE.menuMobileHeight = outerHeight(mastheadMobile[0]); 923 mastheadMobilePaddingTop = parseFloat(getComputedStyle(mastheadMobile[0]).paddingTop); 924 } 925 } else { 926 UNCODE.menuMobileHeight = outerHeight(mastheadMobile); 927 mastheadMobilePaddingTop = parseFloat(getComputedStyle(mastheadMobile).paddingTop); 928 } 929 } 930 931 if (wwidth > mediaQuery) { 932 for (var i = 0; i < mainmenu.length; i++) { 933 if (classie.hasClass(document.body, 'hmenu-center') && i === 1) continue; 934 if (!classie.hasClass(masthead, 'masthead-vertical')) { 935 menuHeight = menuHeight + outerHeight(mainmenu[i]); 936 } else menuHeight = 0; 937 938 if (isIE && first) { 939 getDivChildren(mainmenu[i], '.menu-horizontal-inner', function(innerMenu, i) { 940 innerMenu.style.height = menuHeight + 'px'; 941 }); 942 } 943 944 if (classie.hasClass(mainmenu[i].parentNode, 'menu-transparent')) { 945 transmenuHeight += menuHeight; 946 } 947 } 948 949 for (var j = 0; j < secmenu.length; j++) { 950 secmenuHeight += outerHeight(secmenu[j]); 951 } 952 menuHeight += secmenuHeight; 953 } else { 954 menuHeight = UNCODE.menuMobileHeight; 955 if (isMobileTransparent) { 956 for (var i = 0; i < mainmenu.length; i++) { 957 if (classie.hasClass(mainmenu[i].parentNode, 'menu-transparent')) { 958 transmenuHeight += menuHeight; 959 } 960 } 961 } 962 var search_box = document.querySelectorAll('.search-icon .drop-menu'); 963 for (var i = 0; i < search_box.length; i++) { 964 search_box[i].removeAttribute('style'); 965 } 966 } 967 968 969 if (classie.hasClass(document.documentElement, 'admin-mode')) { 970 adminBar = document.getElementById("wpadminbar"); 971 if (wwidth > 600) { 972 if (adminBar != null) adminBarHeight = outerHeight(adminBar); 973 else { 974 if (wwidth > 782) adminBarHeight = 32; 975 else adminBarHeight = 46; 976 } 977 } else adminBarHeight = 0; 978 } 979 UNCODE.adminBarHeight = adminBarHeight; 980 UNCODE.menuHeight = menuHeight; 981 982 if ( UNCODE.isFullPage && ! UNCODE.isFrontEndEditor ) { 983 if ( UNCODE.adminBarHeight > 0 ) 984 document.body.style.marginTop = ( ( UNCODE.adminBarHeight +
984UNCODE.bodyBorder ) * -1 ) + 'px'; 985 986 document.body.style.paddingTop = ( UNCODE.adminBarHeight + UNCODE.bodyBorder ) + 'px'; 987 } else { 988 document.body.style.marginTop = 0; 989 document.body.style.paddingTop = 0; 990 } 991 992 if (masthead != undefined) { 993 //masthead.parentNode.style.height = menuHeight + 'px'; 994 if (classie.hasClass(masthead, 'menu-transparent')) { 995 if (wwidth > mediaQuery) masthead.parentNode.style.height = '0px'; 996 } 997 } 998 999 if (typeof menuhide == 'object' && menuhide != null && mainmenu[0] != undefined) { 1000 var sticky_element = (typeof mainmenu.item === 'undefined' ? ((wwidth > mediaQuery) ? mainmenu[0] : mainmenu[1]) : mainmenu[0]); 1001 if (sticky_element.style.top != '') { 1002 sticky_element.style.top = UNCODE.bodyBorder + 'px' 1003 } 1004 } 1005 1006 }, 1007 centerSplitMenu = function() { 1008 if (wwidth > mediaQuery && mainNavMenu) { 1009 if (mainNavMenu.style.left == '') { 1010 mainNavMenu.style.left = '0px'; 1011 var logoPos = logo.parentNode.getBoundingClientRect(); 1012 mainNavMenu.style.left = (wwidth / 2) - (logoPos.left + (logoPos.width / 2) ) + 'px'; 1013 mainNavWrapper.style.opacity = '1'; 1014 } 1015 mainNavWrapper.style.opacity = '1'; 1016 } 1017 }, 1018 initHeader = function() { 1019 pageHeader = document.getElementById("page-header"); 1020 if (SiteParameters.dynamic_srcset_active === '1') { 1021 UNCODE.adaptive_srcset_replace_bg(pageHeader); 1022 } 1023 UNCODE.adaptive(); 1024 headerHeight('.header-wrapper'); 1025 1026 parallaxHeaders = document.querySelectorAll('.header-parallax > .header-bg-wrapper'); 1027 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'); 1028 headerWithOpacity = document.querySelectorAll('.header-scroll-opacity'); 1029 if ( typeof pageHeader === 'object' && pageHeader !== null ) { 1030 headerVideo = pageHeader.querySelectorAll('.uncode-video-container'); 1031 kenburnsHeaders = pageHeader.querySelectorAll('.with-kburns > .header-bg-wrapper'); 1032 backwashHeaders = pageHeader.querySelectorAll('.with-zoomout > .header-bg-wrapper'); 1033 if ( headerVideo.length ) { 1034 classie.addClass(pageHeader, 'has-video'); 1035 } 1036 } 1037 if (pageHeader != undefined) { 1038 var backs = pageHeader.querySelectorAll('.header-bg'), 1039 backsCarousel = pageHeader.querySelectorAll('.header-uncode-block .background-inner'), 1040 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; 1041 if (backs.length == 0 && backsCarousel.length == 0) { 1042 pageHeader.setAttribute('data-imgready', 'true'); 1043 } else { 1044 if (backsCarousel.length) { 1045 for (var j = 0; j < backsCarousel.length; j++) { 1046 if (j == 0) { 1047 if (!!backsCarousel[j].style.backgroundImage && backsCarousel[j].style.backgroundImage !== void 0) { 1048 var url = (backsCarousel[j].style.backgroundImage).match(uri_pattern), 1049 image = new Image(); 1050 image.onload = function() { 1051 pageHeader.setAttribute('data-imgready', 'true'); 1052 }; 1053 image.src = url[0]; 1054 } else { 1055 pageHeader.setAttribute('data-imgready', 'true'); 1056 } 1057 } 1058 } 1059 } else { 1060 for (var i = 0; i < backs.length; i++) { 1061 if (i == 0) { 1062 if (!!backs[i].style.backgroundImage && backs[i].style.backgroundImage !== void 0) { 1063 var url = (backs[i].style.backgroundImage).match(uri_pattern), 1064 image = new Image(); 1065 image.onload = function() { 1066 pageHeader.setAttribute('data-imgready', 'true'); 1067 }; 1068 image.src = url[0]; 1069 } else { 1070 pageHeader.setAttribute('data-imgready', 'true'); 1071 } 1072 } 1073 } 1074 } 1075 } 1076 } 1077 1078 if (masthead != undefined && !classie.hasClass(masthead, 'masthead-vert
1078ical')) { 1079 if (header.length) { 1080 masthead.parentNode.style.height = menuHeight + 'px'; 1081 if (menuwrapper[0] != undefined) classie.addClass(menuwrapper[0], 'with-header'); 1082 for (var j = 0; j < header.length; j++) { 1083 var headerel = header[j], 1084 closestStyle = getClosest(headerel, 'style-light'), 1085 wcClosestStyle = getClosest(headerel, 'wc-parent-style-light'); 1086 if (closestStyle != null && classie.hasClass(closestStyle, 'style-light')) { 1087 switchColorsMenu(0, 'light'); 1088 } else if (wcClosestStyle != null && classie.hasClass(wcClosestStyle, 'wc-parent-style-light')) { 1089 switchColorsMenu(0, 'light'); 1090 } else if (getClosest(headerel, 'style-dark') != null) { 1091 switchColorsMenu(0, 'dark'); 1092 } else if (getClosest(headerel, 'wc-parent-style-dark') != null) { 1093 switchColorsMenu(0, 'dark'); 1094 } else { 1095 if (masthead.style.opacity !== 1) masthead.style.opacity = 1; 1096 } 1097 if (classie.hasClass(masthead, 'menu-transparent')) { 1098 if (isMobileTransparent || wwidth > mediaQuery) { 1099 masthead.parentNode.style.height = '0px'; 1100 if (classie.hasClass(masthead, 'menu-add-padding')) { 1101 var headerBlock = getClosest(headerel, 'header-uncode-block'); 1102 if (headerBlock != null) { 1103 var parentRow = headerBlock.querySelector('.vc_row'), 1104 innerRows = parentRow.querySelectorAll('.column_parent > .uncol > .uncoltable > .uncell > .uncont, .uncode-slider .column_child > .uncol > .uncoltable > .uncell > .uncont'); 1105 for (var k = 0; k < innerRows.length; k++) { 1106 if (innerRows[k] != undefined) { 1107 if (wwidth > mediaQuery) innerRows[k].style.paddingTop = transmenuHeight + 'px'; 1108 else innerRows[k].style.paddingTop = (transmenuHeight - mastheadMobilePaddingTop) + 'px'; 1109 } 1110 } 1111 } else { 1112 getDivChildren(headerel, '.header-content', function(headerContent, i) { 1113 if (wwidth > mediaQuery) headerContent.style.paddingTop = transmenuHeight + 'px'; 1114 else headerContent.style.paddingTop = (transmenuHeight - mastheadMobilePaddingTop) + 'px'; 1115 }); 1116 } 1117 } 1118 } 1119 } 1120 if (classie.hasClass(headerel, 'uncoltable')) { 1121 break; 1122 } 1123 } 1124 } else { 1125 if (menuwrapper[0] != undefined) classie.addClass(menuwrapper[0], 'no-header'); 1126 classie.removeClass(masthead, 'menu-transparent'); 1127 transmenuHeight = 0; 1128 isMobileTransparent = false; 1129 } 1130 } else { 1131 isMobileTransparent = false; 1132 } 1133 if (typeof transmenuel === 'undefined' || !transmenuel.length) isMobileTransparent = false; 1134 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 1135 UNCODE.bodyTop = bodyTop; 1136 if (!classie.hasClass(document.body, 'vmenu')) 1137 initBox(); 1138 scrollFunction(); 1139 showHideScrollup(bodyTop); 1140 1141 if ( UNCODE.isMobile ) { 1142 1143 var eventName = 'loadedmetadata'; 1144 eventName = eventName.replace(/^on/, ''); 1145 var elt = document.createElement('video'[eventName]); 1146 var eventIsSupported = ('on'+eventName in elt); 1147 elt = null; 1148 if ( ! eventIsSupported || ( classie.hasClass(document.documentElement, 'firefox') && classie.hasClass(document.documentElement, 'android') ) ) { 1149 classie.addClass(document.body, 'video-not-supported'); 1150 } 1151 } 1152 1153 }, 1154 initRow = function(currentRow) { 1155 if (SiteParameters.dynamic_srcset_active === '1') { 1156 UNCODE.adaptive_srcset_replace_bg(currentRow); 1157 } 1158 UNCODE.adaptive(); 1159 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 ), 1160 rowParent = el.parentNode, 1161 rowInner = currentRow.parentNode, 1162 percentHeight = el.getAttribute("data-height-ratio"), 1163 minHeight = el.getAttribute("data-minheight"), 1164 calculateHeight, 1165 calculatePadding = 0, 1166 isHeader = false, 1167 isFirst = false, 1168 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; 1169 1170 /** Add class to the row when contains responsive column size */ 1171 getDivChildren(el.parentNode, '.column_parent, .column_child', function(obj, i, total) { 1172 if ((obj.className).indexOf("col-md-") > - 1) { 1173 classie.addClass(obj.parentNode, 'cols-md-responsive'); 1174 } 1175 obj.className = obj.className.replace(/vc_col-sm-(\d{1,2})/g, ""); 1176 if ((obj.className).indexOf("col-sm-") > - 1 && (obj.className).indexOf("col-sm-clear") == - 1) { 1177 classie.addClass(obj.parentNode, 'cols-sm-responsive'); 1178 } 1179 }); 1180 1181 setRowHeight(el); 1182 1183 var elements = 0; 1184 getDivChildren(el, '.row-internal .background-inner', function(obj, i, total) { 1185 elements++; 1186 if (i == 0) { 1187 if (!!obj.style.backgroundImage && obj.style.backgroundImage !== void 0) { 1188 var url = (obj.style.backgroundImage).match(uri_pattern), 1189 image = new Image(); 1190 image.onload = function() { 1191 el.setAttribute('data-imgready', 'true'); 1192 el.dispatchEvent(new CustomEvent('imgLoaded')); 1193 }; 1194 image.src = url[0]; 1195 } else { 1196 el.setAttribute('data-imgready', 'true'); 1197 el.dispatchEvent(new CustomEvent('imgLoaded')); 1198 } 1199 } 1200 }); 1201 if (elements == 0) { 1202 el.setAttribute('data-imgready', 'true'); 1203 } 1204 1205 // var $bgs = rowParent.querySelectorAll('.background-inner'); 1206 1207 // for (var i = 0; i < $bgs.length; i++) { 1208 // var $bg = $bgs[i]; 1209 // if ($bg.style.backgroundImage && $bg.style.backgroundImage !== '') { 1210 // var url = ($bg.style.backgroundImage).match(uri_pattern), 1211 // image = new Image(); 1212 // url = url[0]; 1213 // image.source = url; 1214 // image.el = $bg; 1215 // image.onload = function() { 1216 // var _this = this; 1217 // _this.el.setAttribute('data-imgloaded', 'true'); 1218 // }; 1219 // image.src = url; 1220 // } else { 1221 // $bg.setAttribute('data-imgloaded', 'true'); 1222 // } 1223 // } 1224 1225 /** init parallax is not mobile */ 1226 if ( ! UNCODE.isFullPage ) { 1227 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 1228 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'); 1229 kenburnsCols = el.querySelectorAll('.with-kburns > .column-background > .background-wrapper'); 1230 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'); 1231 backwashCols = el.querySelectorAll('.with-zoomout > .column-background > .background-wrapper'); 1232 if (isMobileParallaxAllowed || !UNCODE.isMobile) {
1233 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'); 1234 parallaxCols = el.querySelectorAll('.with-parallax > .column-background > .background-wrapper'); 1235 visibleRows = el.parentNode.parentNode; 1236 parallaxRowCol(bodyTop); 1237 visibleRowCol(bodyTop); 1238 } else { 1239 if (UNCODE.isMobile) { 1240 kenburnsHeader(bodyTop); 1241 kenburnsRowCol(bodyTop); 1242 backwashHeader(bodyTop); 1243 backwashRowCol(bodyTop); 1244 } 1245 } 1246 } 1247 1248 shapeDivider(); 1249 1250 var wrapLinesWw = wwidth; 1251 1252 //Text animation, automatic lines and highlights 1253 var setWrap; 1254 1255 //Font style of grouped products 1256 function product_relative_font_style(el){ 1257 var $labels = el.querySelectorAll('.woocommerce-grouped-product-list-item__label, .woocommerce-grouped-product-list-item__price'); 1258 if ( $labels.length ) { 1259 var $main_price = el.querySelectorAll('.heading-text .woocommerce-Price-amount'); 1260 if ( $main_price.length ) { 1261 var $price_wrap = $main_price[0].closest('.heading-text'), 1262 $price_nest = $price_wrap.querySelector(':first-child'), 1263 font_class = $price_nest.getAttribute('class').split(' '), 1264 cli, labI; 1265 1266 for ( labI = 0; labI < $labels.length; labI++ ) { 1267 for ( cli = 0; cli < font_class.length; cli++ ) { 1268 if ( font_class[cli].indexOf('font') !== -1 && font_class[cli].indexOf('fontsize') === -1 ) { 1269 classie.addClass($labels[labI], font_class[cli]); 1270 } 1271 } 1272 } 1273 1274 } 1275 } 1276 } 1277 product_relative_font_style(el) 1278 1279 function word_for_lines(event, $parent_el){ 1280 1281 if ( typeof $parent_el === 'undefined' || $parent_el === null ) { 1282 $parent_el = document.body; 1283 } 1284 1285 var $headings = $parent_el.querySelectorAll('.heading-text'); 1286 1287 for (var head_k = 0; head_k < $headings.length; head_k++) { 1288 var $heading = $headings[head_k], 1289 heading_cont = $heading.innerHTML, 1290 $row = $heading.closest('.row-parent'), 1291 $owl_carousel = $heading.closest('.owl-carousel-wrapper'), 1292 $owl_item = $heading.closest('.owl-item'), 1293 $words = $heading.querySelectorAll('.split-word'), 1294 setWrap; 1295 1296 if ( ! $words.length ) { 1297 if ( $owl_item !== null ) 1298 continue; 1299 } 1300 1301 if ( $owl_carousel === null && typeof event !== 'undefined' && event !== 'resize' && event !== false ) { 1302 continue; 1303 } 1304 1305 if ( $owl_carousel !== null ) { 1306 if ( 1307 ( $owl_item === null ) 1308 || 1309 ( $owl_item !== null && classie.hasClass($owl_item, 'active') && $owl_item.getAttribute('data-index') !== '1' ) 1310 || 1311 ( $owl_item !== null && classie.hasClass($owl_item, 'active') && $owl_item.getAttribute('data-index') === '1' && $owl_item.getAttribute('data-already-reached') === 'true' ) 1312 ) { 1313 continue; 1314 } 1315 } 1316 1317 $heading.innerHTML = heading_cont; 1318 $words = $heading.querySelectorAll('.split-word'); 1319 var lineArray = [], 1320 lineIndex = 0, 1321 lineStart = true, 1322 lineEnd = false, 1323 $text_highlight = $heading.querySelectorAll('.heading-text-highlight'), 1324 $line_wraps = $heading.querySelectorAll('.heading-line-wrap'); 1325 1326 if ( $line_wraps.length && typeof event === 'undefined' ) { 1327 continue; 1328 } 1329 1330 var lettering = function(){ 1331 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'); 1332 1333 for (var i = 0; i < $wraps.length; i++) { 1334 var $wrap = $wraps[i], 1335 $lines = $wrap.querySelectorAll('.heading-line-wrap'), 1336 $words = $wrap.querySelectorAll('.split-word'), 1337 containerDelay = $wrap.getAttribute('data-delay'), 1338 containerSpeed = $wrap.getAttribute('data-speed'), 1339 containerSpeed_val = typeof containerSpeed !== 'undefined' && containerSpeed !== null ? parseFloat(containerSpeed) : 400, 1340 containerInterval = typeof $wrap.getAttribute('data-interval') !== 'undefined' && $wrap.getAttribute('data-interval') !== null ? $wrap.getAttribute('data-interval') : 0, 1341 delayAttr = (containerDelay != undefined) ? containerDelay : 0; 1342 1343 if ( classie.hasClass($wrap, 'already-animated') ) { 1344 continue; 1345 } 1346 1347 if ( classie.hasClass($wrap, 'curtain') ) { 1348 1349 for (var il = 0; il < $lines.length; il++) { 1350 var $line = $lines[il], 1351 $spans = $line.querySelectorAll('.split-word-inner'); 1352 1353 for (var is = 0; is < $spans.length; is++) { 1354 1355 var $span = $spans[is]; 1356 1357 $span.setAttribute('data-delay', ( parseFloat(delayAttr) + ( ( parseFloat(containerInterval) + 100 ) * il ) ) ); 1358 1359 if (typeof containerSpeed_val !== 'undefined' ) { 1360 $span.setAttribute('data-speed', containerSpeed_val); 1361 } 1362 1363 classie.addClass($span, 'animate_when_parent_almost_visible'); 1364 classie.addClass($span, 'text-bottom-t-top'); 1365 1366 if ( is+1 === $spans.length && il+1 === $lines.length ) { 1367 classie.addClass($span, 'anim-tot-checker'); 1368 } 1369 } 1370 1371 } 1372 1373 } else if ( classie.hasClass($wrap, 'single-curtain') ) { 1374 1375 var $spans = $wrap.querySelectorAll('.split-char'); 1376 1377 for (var is = 0; is < $spans.length; is++) { 1378 var $span = $spans[is]; 1379 1380 $span.setAttribute('data-delay', ( parseFloat(delayAttr) + ( ( parseFloat(containerInterval) + 20 ) * is ) ) ); 1381 1382 if (typeof containerSpeed_val !== 'undefined' ) { 1383 $span.setAttribute('data-speed', containerSpeed_val); 1384 } 1385 1386 classie.addClass($span, 'animate_when_parent_almost_visible'); 1387 classie.addClass($span, 'text-bottom-t-top'); 1388 1389 if ( is+1 == $spans.length ) { 1390 classie.addClass($span, 'anim-tot-checker'); 1391 } 1392 }; 1393 1394 } else if ( classie.hasClass($wrap, 'typewriter') ) { 1395 1396 var $spans = $wrap.querySelectorAll('.split-char'); 1397 1398 for (var is = 0; is < $spans.length; is++) { 1399 var $span = $spans[is]; 1400 1401 $span.setAttribute('data-delay', ( parseFloat(delayAttr) + ( ( parseFloat(containerInterval) + 20 ) * is ) ) ); 1402 1403 if (typeof containerSpeed_val !== 'undefined' ) { 1404 $span.setAttribute('data-speed', containerSpeed_val); 1405 } 1406 1407 classie.addClass($span, 'animate_when_parent_almost_visible'); 1408 classie.addClass($span, 'typewriter'); 1409 1410 if ( is+1 == $spans.length ) { 1411 classie.addClass($span, 'anim-tot-checker'); 1412 } 1413 1414 } 1415 1416 } else if ( classie.hasClass($wrap, 'single-slide') ) { 1417 1418 var $spans = $wrap.querySelectorAll('.split-word-inner'); 1419 1420 for (var is = 0; is < $spans.length; is++) { 1421 var $span = $spans[is]; 1422 1423 $span.setAttribute('data-delay', ( parseFloat(delayAttr) + ( ( parseFloat(containerInterval) + 50 ) * is ) ) ); 1424 1425 if (typeof containerSpeed_val !== 'undefined' ) { 1426 $span.setAttribute('data-speed', containerSpeed_val); 1427 } 1428 1429 classie.addClass($span, 'animate_when_parent_almost_visible'); 1430 if ( classie.hasClass(document.body, 'rtl') ) { 1431 classie.addClass($span, 'text-left-t-right'); 1432 } else { 1433 classie.addClass($span, 'text-right-t-left'); 1434 } 1435 1436 if ( is+1 == $spans.length ) { 1437 classie.addClass($span, 'anim-tot-checker'); 1438 } 1439 } 1440 1441 } else if ( classie.hasClass($wrap, 'single-slide-opposite') ) { 1442 1443 var $spans = $wrap.querySelectorAll('.split-word-inner'); 1444 1445 for (var is = 0; is < $spans.length; is++) { 1446 var $span = $spans[is]; 1447 1448 $span.setAttribute('data-delay', ( parseFloat(delayAttr) + ( ( parseFloat(containerInterval) + 50 ) * is ) ) ); 1449 1450 if (typeof containerSpeed_val !== 'undefined' ) { 1451 $span.setAttribute('data-speed', containerSpeed_val); 1452 } 1453 1454 classie.addClass($span, 'animate_when_parent_almost_visible'); 1455 if ( classie.hasClass(document.body, 'rtl') ) { 1456 classie.addClass($span, 'text-right-t-left'); 1457 } else { 1458 classie.addClass($span, 'text-left-t-right'); 1459 } 1460 1461 if ( is+1 == $spans.length ) { 1462 classie.addClass($span, 'anim-tot-checker'); 1463 } 1464 } 1465 1466 } else if ( classie.hasClass($wrap, 'curtain-words') ) { 1467 1468 var $spans = $wrap.querySelectorAll('.split-word-inner'); 1469 1470 for (var is = 0; is < $spans.length; is++) { 1471 var $span = $spans[is]; 1472 1473 $span.setAttribute('data-delay', ( parseFloat(delayAttr) + ( ( parseFloat(containerInterval) + 50 ) * is ) ) ); 1474 1475 if (typeof containerSpeed_val !== 'undefined' ) { 1476 $span.setAttribute('data-speed', containerSpeed_val); 1477 } 1478 1479 classie.addClass($span, 'animate_when_parent_almost_visible'); 1480 classie.addClass($span, 'text-bottom-t-top'); 1481 1482 if ( is+1 == $spans.length ) { 1483 classie.addClass($span, 'anim-tot-checker'); 1484 } 1485 } 1486 } 1487 1488 } 1489 } 1490 1491 var removeOldLines = function(){ 1492 for (var wrap_k = 0; wrap_k < $line_wraps.length; wrap_k++) { 1493 var $line_wrap = $line_wraps[wrap_k]; 1494 var $parent_wrap = $line_wrap.parentNode; 1495 if ( $parent_wrap !== null ) { 1496 while ( $line_wrap.firstChild ) { 1497 $parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap); 1498 } 1499 $parent_wrap.removeChild($line_wrap); 1500 } 1501 } 1502 } 1503 1504 var createHighlightSpans = function(){ 1505 for (var high_k = 0; high_k < $text_highlight.length; high_k++) { 1506 var $highlight = $text_highlight[high_k], 1507 atts = $highlight.getAttribute('data-atts'), 1508 objAtts, 1509 styleEl = '', 1510 classEl = '', 1511 animation = false, 1512 hexRe = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i, 1513 $h_words = $highlight.querySelectorAll('.split-word'); 1514 1515 if ( typeof atts !== 'undefined' && atts != '' ) { 1516 objAtts = JSON.parse(atts); 1517 if ( typeof objAtts.bg != 'undefined' ) { 1518 if ( hexRe.test(objAtts.bg)) { 1519 styleEl += 'background-color:' + objAtts.bg + ';'; 1520 } else { 1521 classEl += ' ' + objAtts.bg; 1522 } 1523 } 1524 if ( typeof objAtts.color != 'undefined' ) { 1525 if ( hexRe.test(objAtts.color)) { 1526 styleEl += 'color:' + objAtts.color + ';'; 1527 } else {
1528 var classChild = objAtts.color; 1529 } 1530 } 1531 if ( typeof objAtts.height != 'undefined' ) { 1532 styleEl += 'height:' + objAtts.height + ';'; 1533 } 1534 if ( typeof objAtts.offset != 'undefined' ) { 1535 styleEl += 'bottom:' + objAtts.offset + ';'; 1536 } 1537 if ( typeof objAtts.opacity != 'undefined' ) { 1538 styleEl += 'opacity:' + objAtts.opacity + ';'; 1539 } 1540 if ( objAtts.animated == 'yes' ) { 1541 animation = true; 1542 } 1543 1544 } 1545 1546 for (var h_words_k = 0; h_words_k < $h_words.length; h_words_k++) { 1547 var $word = $h_words[h_words_k], 1548 $new_el = document.createElement('span'); 1549 1550 if ( typeof classChild !== 'undefined' ) { 1551 classie.addClass($word, objAtts.color); 1552 } 1553 1554 if ( h_words_k === 0 ) { 1555 classie.addClass($word, 'first-highlight'); 1556 } else if ( (h_words_k+1) === $h_words.length ) { 1557 classie.addClass($word, 'last-highlight'); 1558 } 1559 1560 $new_el.className = 'heading-text-highlight-inner' + classEl; 1561 if ( styleEl !== '' ) { 1562 $new_el.setAttribute('style', styleEl); 1563 } 1564 1565 if ( animation ) { 1566 $new_el.setAttribute('data-animated', 'yes'); 1567 } 1568 1569 $word.appendChild($new_el); 1570 1571 }; 1572 1573 var $parent_highlight = $highlight.parentNode; 1574 if ( $parent_highlight != null ) { 1575 while ( $highlight.firstChild ) { 1576 $parent_highlight.insertBefore($highlight.firstChild, $highlight); 1577 } 1578 $parent_highlight.removeChild($highlight); 1579 } 1580 } 1581 1582 } 1583 1584 var createNewLines = function(){ 1585 for (var word_k = 0; word_k < $words.length; word_k++) { 1586 var $word = $words[word_k], 1587 top = $word.offsetTop, 1588 elH = $word.offsetHeight, 1589 $next = typeof $words[(word_k+1)] !== 'undefined' ? $words[(word_k+1)] : null, 1590 nextTop = $next !== null ? $next.offsetTop : null; 1591 1592 if (lineStart) { 1593 lineArray[lineIndex] = [word_k]; 1594 1595 if (nextTop !== null && nextTop > (top + elH/2)) { 1596 lineArray[lineIndex].push(word_k); 1597 lineIndex++; 1598 lineStart = true; 1599 } else { 1600 lineStart = false;
1601 } 1602 } else { 1603 if (nextTop !== null && nextTop > (top + elH/2)) {//tollerance 1604 lineArray[lineIndex].push(word_k); 1605 lineIndex++; 1606 lineStart = true; 1607 } else if ( nextTop === null ) { 1608 lineArray[lineIndex].push(word_k); 1609 } 1610 } 1611 } 1612 1613 for (var i = 0; i < lineArray.length; i++) { 1614 var start = lineArray[i][0], 1615 end = lineArray[i][1] + 1; 1616 1617 var spanWrap = document.createElement('span'); 1618 spanWrap.className = 'heading-line-wrap'; 1619 1620 if (!end) { 1621 window.wrap(spanWrap, $words[start]); 1622 } else { 1623 for (var _i = start; _i < end; _i++) { 1624 if ( typeof $words[_i] !== 'undefined' && $words[_i] !== null ) { 1625 classie.addClass($words[_i], 'heading-temp'); 1626 $words[_i].style.zIndex = end - _i; 1627 } 1628 } 1629 var $towrap = $heading.querySelectorAll('.heading-temp'); 1630 if ( typeof $towrap[0] !== 'undefined' && $towrap[0] !== null ) { 1631 window.wrapAll(spanWrap, $towrap); 1632 for (var _i = 0; _i < $towrap.length; _i++) { 1633 classie.removeClass($towrap[_i], 'heading-temp'); 1634 } 1635 } 1636 } 1637 1638 if ( (i+1) == lineArray.length ) { 1639 classie.addClass($row, 'loaded-split-word'); 1640 } 1641 1642 classie.addClass($heading, 'heading-lined'); 1643 } 1644 lettering(); 1645 1646 } 1647 1648 removeOldLines(); 1649 createHighlightSpans(); 1650 createNewLines(); 1651 1652 $parent_el.addEventListener("owl-carousel-changed", function() { 1653 removeOldLines(); 1654 createHighlightSpans(); 1655 createNewLines(); 1656 }); 1657 1658 if ( event !== 'resize' ) { 1659 document.body.dispatchEvent(new CustomEvent('uncode_waypoints')); 1660 } 1661 1662 } 1663 } 1664 1665 var $h_markup = document.body.querySelectorAll('.font-obs'), 1666 fontArr = new Array(); 1667 1668 for (var i = 0; i < $h_markup.length; i++) { 1669 var font_to_check = $h_markup[i].getAttribute("data-font"); 1670 1671 if ( font_to_check === null ) { 1672 word_for_lines(false, el); 1673 } else { 1674 var font_weight = $h_markup[i].getAttribute("data-weight"); 1675 var font_style = $h_markup[i].getAttribute("data-style"); 1676 1677 if ( font_weight === null ) { 1678 font_weight = 'normal'; 1679 } 1680 1681 if ( font_style === null ) { 1682 font_style = 'normal'; 1683 } 1684 1685 font_to_check = font_to_check.split(','); 1686 1687 var font_val = font_to_check[0].replace(/['"]+/g, ''), 1688 font_key = '\''+font_val+'_'+font_weight+'_'+font_style+'\''; 1689 1690 if ( fontArr.indexOf( font_val+'_'+font_weight ) === -1 ) { 1691 fontArr[font_key] = {'family':font_val,'weight':font_weight,'style':font_style }; 1692 } 1693 } 1694 } 1695 1696 var counter = 0; 1697 1698 for (var key in fontArr) { 1699 if (fontArr.hasOwnProperty(key)) { 1700 var font = new FontFaceObserver(fontArr[key].family, { weight: fontArr[key].weight, style: fontArr[key].style } ); 1701 1702 font.load(null, 10000).then(function (font) { 1703 counter++; 1704 if ( counter == Object.keys(fontArr).length ) { 1705 already_font = true; 1706 requestTimeout(function(){ 1707 word_for_lines(false, el); 1708 }, 10); 1709 } 1710 }, function (error) { 1711 word_for_lines(false, el); 1712 }); 1713 } 1714 } 1715 1716 el.addEventListener("owl-carousel-initialized", function() { 1717 word_for_lines("owl-carousel-initialized", el); 1718 }); 1719 1720 el.addEventListener("vc-shortcodeView-updated", function() { 1721 word_for_lines(false, el); 1722 }); 1723 1724 window.addEventListener("resize", function() { 1725 if ( wwidth != wrapLinesWw ) { 1726 clearRequestTimeout(setWrap); 1727 setWrap = requestTimeout( function(){ 1728 wrapLinesWw = wwidth; 1729 word_for_lines('resize'); 1730 }, 100 ); 1731 } 1732 }); 1733 1734 scrollFunction(); 1735 1736 var videos = document.querySelectorAll('.wp-video-shortcode'); 1737 for (var i = 0; i < videos.length; i++) { 1738 var video = videos[i]; 1739 if ( typeof video.getAttribute('autoplay') !== 'undefined' && video.getAttribute('autoplay') !== null && ( typeof video.getAttribute('muted') === 'undefined' || video.getAttribute('muted') === null ) ) { 1740 video.oncanplay = function(e) { 1741 video.muted = true; 1742 video.play(); 1743 }; 1744 break; 1745 } 1746 } 1747 1748 // Single Product reviews counter on Page Builder module 1749 var singleProductReviewsCounter = function(){ 1750 var $reviews = document.getElementById("reviews"), 1751 $comments = $reviews != undefined ? $reviews.querySelector(".commentlist") : undefined; 1752 if ( $reviews != undefined && $comments != undefined ) { 1753 var dataReviews = $reviews.getAttribute('data-reviewed'), 1754 comments = $comments.getAttribute('data-comment-amout'), 1755 count_review_class = comments > 0 ? '' : ' hidden'; 1756 if ( typeof dataReviews == 'undefined' || dataReviews == null || dataReviews == '' ) { 1757 $reviews.setAttribute('data-reviewed', 'reviewed'); 1758 var $tabPane = getClosest($reviews, 'tab-pane'), 1759 $panel = getClosest($reviews, 'wpb_accordion_section'); 1760 if ( $tabPane != undefined) { 1761 var revID = $tabPane.getAttribute('id'), 1762 $spanTxt = document.querySelector('[data-tab-id=' + revID + '] > a > span'); 1763 1764 if ( typeof revID !== 'undefined' && revID !== '' && $spanTxt != null ) { 1765 var $spanCount = $spanTxt.querySelector('span.review-count'); 1766 if ( $spanCount != null ) { 1767 $spanCount.innerHTML = comments; 1768 } else { 1769 var textReviews = $spanTxt.innerHTML; 1770 $spanTxt.innerHTML = textReviews + ' <span class="review-count' + count_review_class + '">' + comments + '</span>'; 1771 } 1772 } 1773 } 1774 if ( $panel != undefined ) { 1775 var $spanTxt = $panel.querySelector('.panel-title > a > span'); 1776 1777 if ( $spanTxt != null ) { 1778 var $spanTxt_0 = $spanTxt; 1779 if ( $spanTxt[0] != undefined ) { 1780 $spanTxt_0 = $spanTxt[0]; 1781 } 1782 var $spanCount = $spanTxt.querySelector('span.review-count'); 1783 if ( $spanCount != null ) { 1784 $spanCount.innerHTML = comments; 1785 } else { 1786 var textReviews = $spanTxt.innerHTML; 1787 $spanTxt.innerHTML = textReviews + ' <span class="review-count' + count_review_class + '">' + comments + '</span>'; 1788 } 1789 } 1790 } 1791 } 1792 } 1793 }; 1794 singleProductReviewsCounter(); 1795 window.addEventListener( "vc_panel_title_edited", singleProductReviewsCounter ); 1796 1797 //Check for empty additional info tabs 1798 var checkEmptyAdditionalInfo = function(){ 1799 var $emptyAdditional = document.getElementById("no_additional_info"), 1800 $emptyPane, 1801 empty_pane_ID, 1802 $tabsParent, 1803 $emptyTab; 1804 if ( $emptyAdditional != undefined ) { 1805 $emptyPane = getClosest($emptyAdditional, 'tab-pane'); 1806 $tabsParent = getClosest($emptyAdditional, 'uncode-tabs'); 1807 if ( $emptyPane == undefined ) 1808 return false;
1809 empty_pane_ID = $emptyPane.getAttribute('id'); 1810 1811 $emptyTab = $tabsParent.querySelector('li[data-tab-id="' + empty_pane_ID + '"]'); 1812 $emptyTab.parentNode.removeChild($emptyTab); 1813 $emptyPane.parentNode.removeChild($emptyPane); 1814 } 1815 }; 1816 checkEmptyAdditionalInfo(); 1817 1818 var waitForSrcSetMedia = function(){ 1819 var $thumbs = el.querySelectorAll('.srcset-lazy-animations'); 1820 1821 for ( var th_i = 0; th_i < $thumbs.length; th_i++ ) { 1822 var $thumb = $thumbs[th_i], 1823 $media = $thumb.querySelectorAll('.srcset-auto'); 1824 1825 if ( $media.length ) { 1826 var $media_inside = $media[0].querySelectorAll('.srcset-sizes-done'); 1827 if ( classie.hasClass($media[0], 'srcset-sizes-done') || $media_inside.length ) { 1828 classie.removeClass($thumb, 'srcset-lazy-animations'); 1829 } 1830 } else { 1831 classie.removeClass($thumb, 'srcset-lazy-animations'); 1832 } 1833 } 1834 }; 1835 waitForSrcSetMedia(); 1836 1837 }, 1838 1839 setRowHeight = function(container, forced, resized) { 1840 var currentTallest = 0, 1841 percentHeight = 0, 1842 minHeight = 0, 1843 el, 1844 child, 1845 hasSubCols = false; 1846 if (container.length == undefined) { 1847 container = [container]; 1848 } 1849 // Loop for each container element to match their heights 1850 for (var i = 0; i < container.length; i++) { 1851 var el = container[i], 1852 $row = el, 1853 totalHeight = 0, 1854 colsArray = new Array(), 1855 calculatePadding = 0, 1856 $rowParent = $row.parentNode, 1857 isHeader = false, 1858 isFirst = false; 1859 $row.oversized = false; 1860 percentHeight = el.getAttribute("data-height-ratio"); 1861 minHeight = el.getAttribute("data-minheight"); 1862 child = (el.firstElementChild || el.firstChild); 1863 var childHeight = outerHeight(child); 1864 /** window height without header **/ 1865 if (!!percentHeight || !!minHeight || forced || (isIE && classie.hasClass(el, 'unequal')) ) { 1866 child.style.height = ''; 1867 if (!!percentHeight) { 1868 if (percentHeight == 'full') { 1869 currentTallest = parseInt(wheight); 1870 } else { 1871 currentTallest = parseInt((wheight * percentHeight) / 100); 1872 } 1873 } else { 1874 currentTallest = el.clientHeight; 1875 } 1876 1877 if (!!minHeight) { 1878 if (currentTallest < minHeight || currentTallest == undefined) currentTallest = parseInt(minHeight); 1879 } 1880 1881 if (getClosest(el, 'header-uncode-block') != null) { 1882 el.setAttribute('data-row-header', 'true'); 1883 isHeader = true; 1884 } else { 1885 if (pageHeader == null) { 1886 var prevRow = $rowParent.previousSibling; 1887 if (prevRow != null && prevRow.innerText == 'UNCODE.initHeader();') { 1888 isFirst = true; 1889 } 1890 } 1891 } 1892 1893 if (classie.hasClass(el, 'row-slider')) { 1894 percentHeight = el.getAttribute("data-height-ratio"); 1895 minHeight = el.getAttribute("data-minheight"); 1896 if (percentHeight == 'full') { 1897 currentTallest = parseInt(wheight); 1898 } else { 1899 currentTallest = parseInt((wheight * percentHeight) / 100); 1900 } 1901 1902 var computedStyleRow = getComputedStyle(el), 1903 computedStyleRowParent = getComputedStyle($rowParent); 1904 calculatePadding -= (parseFloat(computedStyleRow.paddingTop) + parseFloat(computedStyleRowParent.paddingTop)); 1905 calculatePadding -= (parseFloat(computedStyleRow.paddingBottom) + parseFloat(computedStyleRowParent.paddingBottom)); 1906 1907 if (isHeader || isFirst) { 1908 if (isMobileTransparent || wwidth > mediaQuery) currentTallest -= menuHeight - transmenuHeight; 1909 else currentTallest -= menuHeight - secmenuHeight; 1910 currentTallest += calculatePadding; 1911 } else { 1912 if (isMobileTransparent || wwidth > mediaQuery) currentTallest += calculatePadding; 1913 else currentTallest = 'auto'; 1914 } 1915 1916 getDivChildren(el, '.owl-carousel', function(owl, i) { 1917 owl.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1918 if (isIE) { 1919 getDivChildren(owl, '.owl-stage', function(owlIn, i) { 1920 owlIn.style.height = (currentTallest == 'auto' ? '100%' : currentTallest + 'px'); 1921 }); 1922 } 1923 }); 1924 if ( UNCODE.isFullPageSnap || classie.hasClass(masthead, 'menu-transparent') ) 1925 continue; 1926 else { 1927 if ( classie.hasClass(document.body, 'uncode-fp-menu-hide') ) { 1928 $rowParent.parentNode.style.paddingTop = menuHeight + 'px'; 1929 } 1930 } 1931 } else { 1932 if (isHeader || isFirst || UNCODE.isFullPage ) { 1933 if ( !( UNCODE.isFullPage && !classie.hasClass(masthead, 'menu-transparent') && classie.hasClass(document.body, 'uncode-fp-menu-hide') && !isHeader && !isFirst ) ) {
1934 if (isMobileTransparent || wwidth > mediaQuery) currentTallest -= menuHeight - transmenuHeight; 1935 else currentTallest -= menuHeight - secmenuHeight; 1936 } 1937 if ( UNCODE.isFullPage && classie.hasClass(document.body, 'uncode-scroll-safe-padding') && classie.hasClass(masthead, 'menu-transparent') && !classie.hasClass(document.body, 'uncode-fp-menu-hide') ) { 1938 var safeMenuHeight = parseFloat(document.body.getAttribute("data-additional-padding")) + parseFloat(menuHeight); 1939 if ( (" " + child.parentNode.className + " ").replace(/[\n\t]/g, " ").indexOf("-top-padding ") < 0 || classie.hasClass(child.parentNode, 'single-top-padding') ) { 1940 classie.addClass(child.parentNode, 'fp-safe-padding-top'); 1941 child.parentNode.style.paddingTop = safeMenuHeight + 'px'; 1942 } 1943 if ( (" " + child.parentNode.className + " ").replace(/[\n\t]/g, " ").indexOf("-bottom-padding ") < 0 || classie.hasClass(child.parentNode, 'single-bottom-padding') ) { 1944 classie.addClass(child.parentNode, 'fp-safe-padding-bottom'); 1945 child.parentNode.style.paddingBottom = safeMenuHeight + 'px'; 1946 } 1947 } 1948 if ( !classie.hasClass(masthead, 'menu-transparent') && classie.hasClass(document.body, 'uncode-fp-menu-hide') && ( isFirst || isHeader ) ) 1949 $rowParent.parentNode.style.paddingTop = menuHeight + 'px'; 1950 1951 var computedStyleRow = getComputedStyle(el), 1952 computedStyleRowParent = getComputedStyle($rowParent); 1953 calculatePadding -= (parseFloat(computedStyleRow.paddingTop) + parseFloat(computedStyleRowParent.paddingTop)); 1954 calculatePadding -= (parseFloat(computedStyleRow.paddingBottom) + parseFloat(computedStyleRowParent.paddingBottom)); 1955 1956 currentTallest += calculatePadding; 1957 1958 } else { 1959 1960 var computedStyleRow = getComputedStyle(el), 1961 computedStyleRowParent = getComputedStyle($rowParent); 1962 calculatePadding -= (parseFloat(computedStyleRow.paddingTop) + parseFloat(computedStyleRowParent.paddingTop)); 1963 calculatePadding -= (parseFloat(computedStyleRow.paddingBottom) + parseFloat(computedStyleRowParent.paddingBottom)); 1964 1965 if (wwidth > mediaQuery) currentTallest += calculatePadding; 1966 else currentTallest = 'auto'; 1967 1968 } 1969 } 1970 if ( UNCODE.isFullPage ) { 1971 currentTallest -= UNCODE.adminBarHeight; 1972 } 1973 if (!!minHeight) { 1974 if (currentTallest < minHeight || currentTallest == 'auto') currentTallest = parseInt(minHeight); 1975 } 1976 1977 if ( UNCODE.isFrontEndEditor && child !== null ) { 1978 var innerWrapper = child.querySelectorAll('.owl-carousel-wrapper.vc_uncode_slider'); 1979 if ( innerWrapper.length ) { 1980 getDivChildren(child, '.owl-carousel-wrapper.vc_uncode_slider', function(wrapper, i) { 1981 if ( wrapper !== null ) { 1982 wrapper.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1983 } else { 1984 child.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1985 } 1986 }); 1987 } else { 1988 child.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1989 } 1990 } else { 1991 child.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1992 } 1993 1994 if ( wwidth < mediaQuery && classie.hasClass(child, 'auto-height-device') ) { 1995 child.style.height = 'auto'; 1996 } 1997 1998 } else { 1999 currentTallest = 0; 2000 if ( UNCODE.isFrontEndEditor && child !== null ) { 2001 2002 child.style.height = ''; 2003 2004 getDivChildren(el, '.owl-carousel', function(owl, i) { 2005 owl.style.height = ''; 2006 if (isIE) { 2007 getDivChildren(owl, '.owl-stage', function(owlIn, i) { 2008 owlIn.style.height = ''; 2009 }); 2010 } 2011 }); 2012 } 2013 } 2014 2015 if (wwidth > mediaQuery) { 2016 2017 getDivChildren(el, '.column_parent', function(col, i, total) { 2018 var $col = col, 2019 $colHeight = 0, 2020 $colDiff = 0, 2021 $colPercDiff = 100; 2022 $col.oversized = false; 2023 $col.forceHeight = currentTallest; 2024 currentTallest = child.clientHeight; 2025 if ((isHeader || isFirst) && currentTallest != 'auto') currentTallest -= transmenuHeight; 2026 var getFirstCol = null, 2027 getMargin = 0, 2028 getSubMargin = 0; 2029 getDivChildren(col, '.row-child', function(obj, i, total) { 2030 var $colChild = obj, 2031 $colParent = $colChild.parentNode, 2032 computedStyleCol = getComputedStyle($colParent); 2033 parseFloat(computedStyleCol.marginTop); 2034 getSubMargin += parseFloat(computedStyleCol.marginTop); 2035 }); 2036 currentTallest += getSubMargin; 2037 getDivChildren(col, '.row-child', function(obj, i, total) { 2038 var $colChild = obj, 2039 $colInner, 2040 $colParent = $colChild.parentNode, 2041 $uncont = $colParent.parentNode; 2042 for (var it = 0; it < $colChild.childNodes.length; it++) { 2043 if ( ! classie.hasClass($colChild.childNodes[it], 'uncode-divider-wrap') ) { 2044 $colInner = $colChild.childNodes[it]; 2045 break; 2046 } 2047 } 2048 if (i == 0 && total > 1) getFirstCol = $colInner; 2049 $colChild.oversized = false;
2050 percentHeight = $colChild.getAttribute("data-height"); 2051 minHeight = $colChild.getAttribute("data-minheight"); 2052 if (percentHeight != null || minHeight != null) { 2053 if ( ! classie.hasClass($colInner, 'uncode-divider-wrap') ) 2054 $colInner.style.height = ''; 2055 $colParent.style.height = 'auto'; 2056 $uncont.style.height = '100%'; 2057 $colChild.removeAttribute("style"); 2058 var newHeight = (percentHeight != null) ? Math.ceil((currentTallest) * (percentHeight / 100)) : parseInt(minHeight); 2059 var computedStyleCol = getComputedStyle($colParent); 2060 getMargin = parseFloat(computedStyleCol.marginTop); 2061 newHeight -= (getMargin); 2062 $colPercDiff -= (percentHeight != null) ? percentHeight : 0; 2063 if (currentTallest > newHeight) { 2064 var getColHeight = outerHeight($colChild); 2065 if (getColHeight > newHeight) { 2066 $colHeight += getColHeight; 2067 $colDiff += getColHeight; 2068 $colChild.oversized = true; 2069 $col.oversized = true; 2070 $row.oversized = true; 2071 } else { 2072 $colHeight += newHeight; 2073 if ( ! classie.hasClass($colInner, 'uncode-divider-wrap') ) { 2074 $colInner.style.height = newHeight + 'px'; 2075 } 2076 } 2077 } 2078 } else { 2079 $colHeight += outerHeight($colChild); 2080 } 2081 }); 2082 if (getFirstCol != null) { 2083 getFirstCol.style.height = (parseFloat(getFirstCol.style.height) - getMargin) + 'px'; 2084 } 2085 colsArray.push({ 2086 colHeight: $colHeight, 2087 colDiv: $col 2088 }); 2089 $col.colDiff = $colDiff; 2090 $col.colPercDiff = $colPercDiff; 2091 2092 }); 2093 2094 if ($row.oversized) { 2095 child.style.height = ''; 2096 colsArray.sort(function(a, b) { 2097 if (a.colHeight < b.colHeight) return 1; 2098 if (a.colHeight > b.colHeight) return -1; 2099 return 0; 2100 }); 2101 var $totalHeight = 0; 2102 colsArray.forEach(function(col) { 2103 var $col = col.colDiv, 2104 $colHeight = col.colHeight; 2105 getDivChildren($col, '.row-child', function(obj, i, total) { 2106 var $colChild = obj, 2107 $colInner = $colChild.children[0], 2108 percentHeight = $colChild.getAttribute("data-height"), 2109 $colParent = $colChild.parentNode, 2110 $uncont = $colParent.parentNode, 2111 newHeight; 2112 2113 $colHeight = $col.forceHeight - $col.colDiff; 2114 if (percentHeight != null) { 2115 if ($colHeight > 0) { 2116 if ($col.oversized) { 2117 if (!$colChild.oversized) { 2118 newHeight = Math.ceil(($colHeight) * (percentHeight / $col.colPercDiff)); 2119 if (i == total - 1 && total > 1) { 2120 $uncont.style.height = 'auto'; 2121 $colChild.style.display = 'none'; 2122 newHeight = outerHeight($col.parentNode) - outerHeight($uncont); 2123 $uncont.style.height = '100%'; 2124 $colChild.style.display = 'table'; 2125 } 2126 if (newHeight == 0) newHeight = Math.ceil(($col.forceHeight) * (percentHeight / 100)); 2127 $colInner.style.height = newHeight + 'px'; 2128 } 2129 } else { 2130 if ($totalHeight == 0) newHeight = Math.ceil(($colHeight) * (percentHeight / $col.colPercDiff)); 2131 else { 2132 newHeight = Math.ceil(($totalHeight) * (percentHeight / $col.colPercDiff)); 2133 } 2134 if (i == total - 1 && total > 1) { 2135 $uncont.style.height = 'auto'; 2136 $colChild.style.display = 'none'; 2137 newHeight = outerHeight($col.parentNode) - outerHeight($uncont); 2138 $uncont.style.height = '100%'; 2139 $colChild.style.display = 'table'; 2140 } 2141 $colInner.style.height = newHeight + 'px'; 2142 } 2143 } else { 2144 if ($colChild.oversized) { 2145 if ($totalHeight == 0) newHeight = Math.ceil(($colHeight) * (percentHeight / $col.colPercDiff)); 2146 else { 2147 if ($col.colPercDiff == 0) $col.colPercDiff = 100; 2148 newHeight = Math.ceil(($totalHeight) * (percentHeight / $col.colPercDiff)); 2149 } 2150 if (i == total - 1 && total > 1) { 2151 $uncont.style.height = 'auto'; 2152 $colChild.style.display = 'none'; 2153 newHeight = outerHeight($col.parentNode) - outerHeight($uncont); 2154 $uncont.style.height = '100%'; 2155 $colChild.style.display = 'table'; 2156 } 2157 $colInner.style.height = newHeight + 'px'; 2158 } 2159 } 2160 } 2161 }); 2162 var uncell = $col.getElementsByClassName('uncell'); 2163 if (uncell[0] != undefined && $totalHeight == 0) $totalHeight = outerHeight(uncell[0]); 2164 }); 2165 } 2166 if (isFF) { 2167 getDivChildren(el, '.uncoltable', function(col, i, total) { 2168 if (col.style.minHeight != '') { 2169 col.style.height = ''; 2170 } 2171 }); 2172 } 2173 if (resized) { 2174 getDivChildren(el, '.row-child > .row-inner', function(obj, k, total) { 2175 if (obj.style.height == '') { 2176 if (wwidth > mediaQueryMobile) { 2177 var getStyle = (window.getComputedStyle((obj.parentNode), null)), 2178 getInnerHeight = (parseInt(obj.parentNode.clientHeight) - parseInt(getStyle.paddingTop) - parseInt(getStyle.paddingBottom)); 2179 obj.style.height = getInnerHeight + 'px'; 2180 //obj.style.marginBottom = '-1px'; 2181 } 2182 } 2183 }); 2184 getDivChildren(el, '.row-parent > .row-inner', function(obj, k, total) { 2185 if (obj.style.height != '') { 2186 var getStyle = (window.getComputedStyle((obj.parentNode), null)), 2187 getInnerHeight = (parseInt(obj.parentNode.clientHeight) - parseInt(getStyle.paddingTop) - parseInt(getStyle.paddingBottom)), 2188 getTempHeight = parseInt(obj.style.height); 2189 if (getInnerHeight > getTempHeight) { 2190 obj.style.height = getInnerHeight + 'px'; 2191 //obj.style.marginBottom = '-1px'; 2192 } 2193 } 2194 }); 2195 } 2196 } else { 2197 if (isFF) { 2198 getDivChildren(el, '.uncoltable', function(col, i, total) { 2199 if (col.style.minHeight != '') { 2200 col.style.height = ''; 2201 col.style.height = outerHeight(col.parentNode) + 'px'; 2202 } 2203 }); 2204 } 2205 if (isIE && (wwidth > mediaQueryMobile)) { 2206 if (child.style.height == 'auto') { 2207 child.style.height = outerHeight(child) + 'px'; 2208 } 2209 } 2210 } 2211 if (isFF) { 2212 var sliderColumnFix = document.querySelector('.uncode-slider .row-inner > .column_child:only-child'); 2213 if (sliderColumnFix != null) { 2214 if (wwidth > mediaQuery) { 2215 sliderColumnFix.style.setProperty("height", ""); 2216 } else { 2217 sliderColumnFix.style.setProperty("height", ""); 2218 sliderColumnFix.style.setProperty("height", outerHeight(sliderColumnFix.parentNode) + "px", "important"); 2219 } 2220 } 2221 } 2222 }; 2223 if ( resized || UNCODE.isFrontEndEditor ) { 2224 window.scroll(0, scrollRowHeight_fix); 2225 } 2226 }, 2227 headerHeight = function(container) {
2228 forEachElement(container, function(el, i) { 2229 var getHeight = el.getAttribute("data-height"), 2230 newHeight = ((wheight * getHeight) / 100); 2231 if (getHeight != 'fixed' && newHeight != 0) { 2232 if (isMobileTransparent || wwidth > mediaQuery) newHeight -= menuHeight - transmenuHeight; 2233 else newHeight -= menuHeight - secmenuHeight; 2234 el.style.height = newHeight + 'px'; 2235 } 2236 }); 2237 if (masthead != undefined) { 2238 masthead.parentNode.style.height = menuHeight + 'px'; 2239 if (header != undefined && header.length) { 2240 if (classie.hasClass(masthead, 'menu-transparent')) { 2241 if (isMobileTransparent || wwidth > mediaQuery) { 2242 masthead.parentNode.style.height = '0px'; 2243 if (classie.hasClass(masthead, 'menu-add-padding')) { 2244 for (var j = 0; j < header.length; j++) { 2245 var headerel = header[j]; 2246 var headerBlock = getClosest(headerel, 'header-uncode-block'); 2247 if (headerBlock != null) { 2248 var parentRow = headerBlock.querySelector('.vc_row'), 2249 innerRows = parentRow.querySelectorAll('.column_parent > .uncol > .uncoltable > .uncell > .uncont, .uncode-slider .column_child > .uncol > .uncoltable > .uncell > .uncont'); 2250 for (var k = 0; k < innerRows.length; k++) { 2251 if (innerRows[k] != undefined) { 2252 if (wwidth > mediaQuery) innerRows[k].style.paddingTop = transmenuHeight + 'px'; 2253 else innerRows[k].style.paddingTop = (transmenuHeight - mastheadMobilePaddingTop) + 'px'; 2254 } 2255 } 2256 } else { 2257 getDivChildren(headerel, '.header-content', function(headerContent, i) { 2258 if (wwidth > mediaQuery) headerContent.style.paddingTop = transmenuHeight + 'px'; 2259 else headerContent.style.paddingTop = (transmenuHeight - mastheadMobilePaddingTop) + 'px'; 2260 }); 2261 } 2262 } 2263 } 2264 } 2265 } 2266 } 2267 } 2268 }, 2269 initVideoComponent = function(container, classTarget) { 2270 if ( UNCODE.isFrontEndEditor ) 2271 return; 2272 getDivChildren(container, classTarget, function(el, i) { 2273 var width = outerWidth(el), 2274 pWidth, // player width, to be defined 2275 height = outerHeight(el), 2276 pHeight, // player height, tbd 2277 $tubularPlayer = (el.getElementsByTagName('iframe').length == 1) ? el.getElementsByTagName('iframe') : el.getElementsByTagName('video'), 2278 ratio = (el.getAttribute("data-ratio") != null) ? Number(el.getAttribute("data-ratio")) : typeof $tubularPlayer[0] !== 'undefined' ? $tubularPlayer[0].getAttribute("data-ratio") : '1.8', 2279 heightOffset = 80, 2280 widthOffset = heightOffset * ratio; 2281 // when screen aspect ratio differs from video, video must center and underlay one dimension 2282 if ($tubularPlayer[0] != undefined) { 2283 if (width / ratio < height) { // if new video height < window height (gap underneath) 2284 pWidth = Math.ceil((height + heightOffset) * ratio); // get new player width 2285 $tubularPlayer[0].style.width = pWidth + widthOffset + 'px'; 2286 $tubularPlayer[0].style.height = height + heightOffset + 'px'; 2287 $tubularPlayer[0].style.left = ((width - pWidth) / 2) - (widthOffset / 2) + 'px'; 2288 $tubularPlayer[0].style.top = '-' + (heightOffset / 2) + 'px'; 2289 $tubularPlayer[0].style.position = 'absolute'; 2290 } else { // new video width < window width (gap to right) 2291 pHeight = Math.ceil(width / ratio); // get new player height 2292 $tubularPlayer[0].style.width = width + widthOffset + 'px'; 2293 $tubularPlayer[0].style.height = pHeight + heightOffset + 'px'; 2294 $tubularPlayer[0].style.left = '-' + (widthOffset / 2) + 'px'; 2295 $tubularPlayer[0].style.top = ((height - pHeight) / 2) - (heightOffset / 2) + 'px'; 2296 $tubularPlayer[0].style.position = 'absolute'; 2297 } 2298 } 2299 }); 2300 }, 2301 init_overlay = function() { 2302 if ( UNCODE.isFrontEndEditor ) 2303 return; 2304 var triggerButton, 2305 globalBtnn, 2306 sequential = false, 2307 closeButtons = new Array(); 2308 function toggleOverlay(btn) { 2309 if ( classie.hasClass(triggerButton, 'menu-button-offcanvas') || classie.hasClass(triggerButton, 'opening') || classie.hasClass(triggerButton, 'closing') ) { 2310 return true; 2311 } 2312 Array.prototype.forEach.call(document.querySelectorAll('div.overlay'), function(overlay) { 2313 if (btn.getAttribute('data-area') == overlay.getAttribute('data-area')) { 2314 var container = document.querySelector('div.' + btn.getAttribute('data-container')), 2315 menuCont = overlay.querySelector('.menu-container'), 2316 masthead = document.getElementById("masthead"), 2317 inputField = overlay.querySelector('.search-field'); 2318 if (classie.has(overlay, 'open')) { 2319 globalBtnn = false;
2320 window.dispatchEvent(menuClose); 2321 overlayOpened = false; 2322 classie.remove(overlay, 'open'); 2323 classie.add(overlay, 'close'); 2324 classie.remove(overlay, 'open-items'); 2325 classie.remove(document.documentElement, 'menu-overlay-open'); 2326 requestTimeout(function(){ 2327 if ( classie.has( masthead, 'style-dark-stop' ) ) { 2328 classie.remove( masthead, 'style-dark-stop' ); 2329 classie.remove( masthead, 'style-light-override' ); 2330 classie.add( masthead, 'style-dark-override' ); 2331 } else if ( classie.has( masthead, 'style-light-stop' ) ) { 2332 classie.remove( masthead, 'style-light-stop' ); 2333 classie.remove( masthead, 'style-dark-override' ); 2334 classie.add( masthead, 'style-light-override' ); 2335 } 2336 if ( classie.has( masthead, 'is_stuck-stop' ) ) { 2337 classie.remove( masthead, 'is_stuck-stop' ); 2338 classie.add( masthead, 'is_stuck' ); 2339 } 2340 classie.remove(document.documentElement, 'overlay-open'); 2341 }, 500); 2342 var onEndTransitionFn = function(ev) { 2343 if (transitionEvent) { 2344 if (ev.propertyName !== 'visibility') return; 2345 this.removeEventListener(transitionEvent, onEndTransitionFn); 2346 } 2347 classie.remove(overlay, 'close'); 2348 if ( sequential !== false ) { 2349 toggleOverlay(sequential); 2350 sequential = false; 2351 } 2352 }; 2353 if (transitionEvent) { 2354 overlay.addEventListener(transitionEvent, onEndTransitionFn); 2355 } else { 2356 onEndTransitionFn(); 2357 } 2358 } else if (!classie.has(overlay, 'close') && !classie.hasClass(btn, 'overlay-close')) { 2359 globalBtnn = btn; 2360 window.dispatchEvent(menuOpen); 2361 overlayOpened = true; 2362 classie.add(overlay, 'open'); 2363 classie.add(container, 'overlay-open'); 2364 if ( wwidth > mediaQuery && overlay.getAttribute('data-area') != 'search' ) { 2365 classie.add(document.documentElement, 'overlay-open'); 2366 classie.add(document.documentElement, 'menu-overlay-open'); 2367 } 2368 if ( classie.has( menuCont, 'style-light' ) ) { 2369 if ( classie.has( masthead, 'style-dark-override' ) && ! classie.has( masthead, 'style-light-override' ) ) { 2370 classie.remove( masthead, 'style-dark-override' ); 2371 classie.add( masthead, 'style-dark-stop' ); 2372 classie.add( masthead, 'style-light-override' ); 2373 } 2374 } else if ( classie.has( menuCont, 'style-dark' ) ) { 2375 if ( classie.has( masthead, 'style-light-override' ) && ! classie.has( masthead, 'style-dark-override' ) ) { 2376 classie.remove( masthead, 'style-light-override' ); 2377 classie.add( masthead, 'style-light-stop' ); 2378 classie.add( masthead, 'style-dark-override' ); 2379 } 2380 } 2381 if ( classie.has( masthead, 'is_stuck' ) ) { 2382 classie.remove( masthead, 'is_stuck' ); 2383 classie.add( masthead, 'is_stuck-stop' ); 2384 } 2385 if (jQuery('body.menu-overlay').length == 0 && inputField != null) { 2386 setTimeout(function() { 2387 inputField.focus(); 2388 }, 1000); 2389 } 2390 setTimeout(function() { 2391 if (classie.has(overlay, 'overlay-sequential')) classie.add(overlay, 'open-items'); 2392 }, 800); 2393 } 2394 } 2395 }); 2396 2397 if (classie.hasClass(btn, 'search-icon') || classie.hasClass(btn, 'menu-close-search') || classie.hasClass(btn, 'mobile-search-icon')) return; 2398 2399 if (classie.hasClass(triggerButton, 'close')) { 2400 UNCODE.menuOpened = false; 2401 classie.removeClass(triggerButton, 'close'); 2402 classie.addClass(triggerButton, 'closing'); 2403 Array.prototype.forEach.call(closeButtons, function(closeButton) { 2404 if (!classie.hasClass(closeButton, 'menu-close-search')) { 2405 classie.removeClass(closeButton, 'close'); 2406 classie.addClass(closeButton, 'closing'); 2407 } 2408 }); 2409 setTimeout(function() { 2410 classie.removeClass(triggerButton, 'closing'); 2411 // triggerButton.style.opacity = 1; 2412 Array.prototype.forEach.call(closeButtons, function(closeButton) { 2413 if (!classie.hasClass(closeButton, 'menu-close-search')) { 2414 classie.removeClass(closeButton, 'closing'); 2415 // closeButton.style.opacity = 0; 2416 } 2417 }); 2418 }, 1000); 2419 } else { 2420 UNCODE.menuOpened = true; 2421 // triggerButton.style.opacity = 0; 2422 var getBtnRect = !classie.hasClass(triggerButton, 'search-icon') ? triggerButton.getBoundingClientRect() : null; 2423 classie.addClass(triggerButton, 'opening'); 2424 Array.prototype.forEach.call(closeButtons, function(closeButton) { 2425 if (!classie.hasClass(closeButton, 'menu-close-search')) { 2426 // classie.addClass(triggerButton, 'close'); 2427 // if (getBtnRect != null) closeButton.setAttribute('style', 'top:' + getBtnRect.top + 'px; left:'+ getBtnRect.left + 'px !important'); 2428 classie.addClass(closeButton, 'close'); 2429 classie.addClass(closeButton, 'opening'); 2430 // closeButton.style.opacity = 1; 2431 } 2432 }); 2433 setTimeout(function() { 2434 classie.removeClass(triggerButton, 'opening'); 2435 Array.prototype.forEach.call(closeButtons, function(closeButton) { 2436 if (!classie.hasClass(closeButton, 'menu-close-search')) { 2437 classie.removeClass(closeButton, 'opening'); 2438 } 2439 }); 2440 }, 1000); 2441 window.addEventListener("resize", function() { 2442 positionCloseBtn(triggerButton, closeButtons); 2443 }); 2444 } 2445 } 2446 function positionCloseBtn(triggerButton, closeButtons){ 2447 var getBtnRect = !classie.hasClass(triggerButton, 'search-icon') ? triggerButton.getBoundingClientRect() : null; 2448 // Array.prototype.forEach.call(closeButtons, function(closeButton) { 2449 // if (!classie.hasClass(closeButton, 'menu-close-search')) { 2450 // if (getBtnRect != null) closeButton.setAttribute('style', 'top:' + getBtnRect.top + 'px; left:'+ getBtnRect.left + 'px !important'); 2451 // closeButton.style.opacity = 1; 2452 // } 2453 // }); 2454 } 2455 (function bindEscape() { 2456 document.onkeydown = function(evt) { 2457 evt = evt || window.event; 2458 var isEscape = false;
2459 if ("key" in evt) { 2460 isEscape = (evt.key == "Escape" || evt.key == "Esc"); 2461 } else { 2462 isEscape = (evt.keyCode == 27); 2463 } 2464 if (isEscape && overlayOpened) { 2465 Array.prototype.forEach.call(closeButtons, function(closeButton) { 2466 if (classie.hasClass(closeButton, 'overlay-close') && classie.hasClass(closeButton, 'menu-button-overlay')) { 2467 closeButton.click(); 2468 } 2469 }); 2470 } 2471 }; 2472 })(); 2473 Array.prototype.forEach.call(document.querySelectorAll('.trigger-overlay'), function(triggerBttn) { 2474 if ( UNCODE.menuOpened || ( (classie.hasClass(document.body, 'vmenu') || classie.hasClass(document.body, 'menu-offcanvas')) && UNCODE.wwidth >= 960 ) ) return; 2475 triggerBttn.addEventListener('click', function(e) { 2476 triggerButton = e.currentTarget; 2477 // if (wwidth < mediaQuery && classie.hasClass(triggerButton, 'search-icon')) { 2478 if ( wwidth < mediaQuery && triggerButton.getAttribute('data-area') != 'search' ) { 2479 return true; 2480 } else { 2481 e.stopPropagation(); 2482 // if (wwidth > mediaQuery) toggleOverlay(triggerButton); 2483 // else { 2484 // if (classie.addClass(triggerButton, 'search-icon')) return true; 2485 // } 2486 if ( triggerButton.getAttribute('data-area') == 'search' ) { 2487 if ( globalBtnn !== undefined && globalBtnn !== false && globalBtnn !== triggerButton ) { 2488 sequential = triggerButton; 2489 globalBtnn.dispatchEvent(new Event("click")); 2490 } else { 2491 window.dispatchEvent(new CustomEvent('menuMobileTrigged')); 2492 toggleOverlay(triggerButton); 2493 } 2494 } else { 2495 window.dispatchEvent(new CustomEvent('menuMobileTrigged')); 2496 toggleOverlay(triggerButton); 2497 } 2498 e.preventDefault(); 2499 return false; 2500 } 2501 }, false); 2502 }); 2503 Array.prototype.forEach.call(document.querySelectorAll('.overlay-close, .menu-button-overlay'), function(closeBttn) { 2504 closeButtons.push(closeBttn); 2505 if ( classie.hasClass(closeBttn, 'menu-close-search') ) { 2506 closeBttn.addEventListener('click', function(e) { 2507 // if (wwidth > mediaQuery) toggleOverlay(closeBttn); 2508 toggleOverlay(closeBttn); 2509 e.preventDefault(); 2510 return false; 2511 }, false); 2512 } 2513 }); 2514 }, 2515 /** All scrolling functions - Begin */ 2516 /** Shrink menu **/ 2517 shrinkMenu = function(bodyTop) { 2518 if ( UNCODE.isFrontEndEditor ) 2519 return; 2520 var logoShrink, 2521 offset = 100; 2522 for (var i = 0; i < logoel.length; i++) { 2523 if (((secmenuHeight == 0) ? bodyTop > menuHeight : bodyTop > secmenuHeight + offset) && !classie.hasClass(logoel[i], 'shrinked') && (wwidth > mediaQuery)) { 2524 classie.addClass(logoel[i], 'shrinked'); 2525 if (logoMinScale != undefined) { 2526 logoShrink = logolink.children; 2527 Array.prototype.forEach.call(logoShrink, function(singleLogo) { 2528 singleLogo.style.height = logoMinScale + 'px'; 2529 singleLogo.style.lineHeight = logoMinScale + 'px'; 2530 if (classie.hasClass(singleLogo, 'text-logo')) singleLogo.style.fontSize = logoMinScale + 'px'; 2531 }); 2532 } 2533 setTimeout(function() { 2534 calculateMenuHeight(false); 2535 //window.dispatchEvent(new Event('resize')); 2536 }, 300); 2537 } else if ((((secmenuHeight == 0) ? bodyTop == 0 : bodyTop <= secmenuHeight + offset) || (wwidth < mediaQuery)) && classie.hasClass(logoel[i], 'shrinked')) { 2538 classie.removeClass(logoel[i], 'shrinked'); 2539 if (logoMinScale != undefined) { 2540 logoShrink = logolink.children; 2541 Array.prototype.forEach.call(logoShrink, function(singleLogo) { 2542 singleLogo.style.height = singleLogo.getAttribute('data-maxheight') + 'px'; 2543 singleLogo.style.lineHeight = singleLogo.getAttribute('data-maxheight') + 'px'; 2544 if (classie.hasClass(singleLogo, 'text-logo')) singleLogo.style.fontSize = singleLogo.getAttribute('data-maxheight') + 'px'; 2545 }); 2546 } 2547 setTimeout(function() { 2548 calculateMenuHeight(false); 2549 //window.dispatchEvent(new Event('resize')); 2550 }, 300); 2551 } 2552 } 2553 }, 2554 /** Switch colors menu **/ 2555 switchColorsMenu = function(bodyTop, style) { 2556 for (var i = 0; i < transmenuel.length; i++) { 2557 if (masthead.style.opacity !== 1) masthead.style.opacity = 1;
2558 if ((secmenuHeight == 0) ? bodyTop > menuHeight / 2 : bodyTop > secmenuHeight) { 2559 if (classie.hasClass(masthead, 'style-dark-original')) { 2560 logo.className = logo.className.replace("style-light", "style-dark"); 2561 } 2562 if (classie.hasClass(masthead, 'style-light-original')) { 2563 logo.className = logo.className.replace("style-dark", "style-light"); 2564 } 2565 if (style != undefined) { 2566 if (style == 'dark') { 2567 classie.removeClass(transmenuel[i], 'style-light-override'); 2568 } 2569 if (style == 'light') { 2570 classie.removeClass(transmenuel[i], 'style-dark-override'); 2571 } 2572 classie.addClass(transmenuel[i], 'style-' + style + '-override'); 2573 } 2574 } else { 2575 if (style != undefined) { 2576 if (style == 'dark') { 2577 classie.removeClass(transmenuel[i], 'style-light-override'); 2578 } 2579 if (style == 'light') { 2580 classie.removeClass(transmenuel[i], 'style-dark-override'); 2581 } 2582 classie.addClass(transmenuel[i], 'style-' + style + '-override'); 2583 } 2584 } 2585 } 2586 if (pageHeader != undefined) { 2587 if (style != undefined) { 2588 if (classie.hasClass(pageHeader, 'header-style-dark')) { 2589 classie.removeClass(pageHeader, 'header-style-dark'); 2590 } 2591 if (classie.hasClass(pageHeader, 'header-style-light')) { 2592 classie.removeClass(pageHeader, 'header-style-light'); 2593 } 2594 classie.addClass(pageHeader, 'header-style-' + style); 2595 } 2596 } 2597 }, 2598 /** VisibleRows **/ 2599 visibleRowCol = function(bodyTop) { 2600 if ( typeof visibleRows == 'object') { 2601 for (var i = 0; i < visibleRows.length; i++) { 2602 var section = visibleRows[i], 2603 sectionHeight = outerHeight(section), 2604 offSetTop = bodyTop + ( section != null ? section.getBoundingClientRect().top : 0 ), 2605 offSetPosition = wheight + bodyTop - offSetTop; 2606 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2607 classie.addClass($kenburnsInner[0], 'uncode-scroll-visible'); 2608 visibleRows[i].dispatchEvent(new CustomEvent('enter-row')); 2609 } else { 2610 classie.removeClass($kenburnsInner[0], 'uncode-scroll-visible'); 2611 visibleRows[i].dispatchEvent(new CustomEvent('exit-row')); 2612 } 2613 } 2614 } 2615 }, 2616 /** KenBurns **/ 2617 kenburnsHeader = function(bodyTop) { 2618 var value; 2619 if ( typeof kenburnsHeaders == 'object' && kenburnsHeaders.length ) { 2620 for (var i = 0; i < kenburnsHeaders.length; i++) { 2621 var section = kenburnsHeaders[i].parentNode, 2622 sectionHeight = outerHeight(section), 2623 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 2624 offSetPosition = wheight + bodyTop - offSetTop, 2625 $kenburnsInner = kenburnsHeaders[i].querySelectorAll('.header-bg'); 2626 if (classie.hasClass(kenburnsHeaders[i], 'header-carousel-wrapper')) { 2627 $kenburnsInner = kenburnsHeaders[i].querySelectorAll('.t-background-cover'); 2628 } 2629 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2630 for (var i = 0; i < $kenburnsInner.length; i++) { 2631 classie.addClass($kenburnsInner[i], 'uncode-kburns'); 2632 $kenburnsInner[i].dispatchEvent(new CustomEvent('enter-kburns')); 2633 } 2634 } else { 2635 for (var i = 0; i < $kenburnsInner.length; i++) { 2636 classie.removeClass($kenburnsInner[i], 'uncode-kburns'); 2637 $kenburnsInner[i].dispatchEvent(new CustomEvent('exit-kburns')); 2638 } 2639 } 2640 } 2641 } 2642 }, 2643 kenburnsRowCol = function(bodyTop) { 2644 var value; 2645 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2646 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'); 2647 } 2648 if ( typeof kenburnsRows == 'object' && kenburnsRows.length ) { 2649 for (var i = 0; i < kenburnsRows.length; i++) { 2650 var section = kenburnsRows[i].parentNode, 2651 sectionHeight = outerHeight(section), 2652 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 2653 offSetPosition = wheight + bodyTop - offSetTop, 2654 $kenburnsInner = kenburnsRows[i].querySelectorAll('.background-inner, .header-bg'); 2655 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2656 classie.addClass($kenburnsInner[0], 'uncode-kburns'); 2657 $kenburnsInner[0].dispatchEvent(new CustomEvent('enter-kburns')); 2658 } else { 2659 classie.removeClass($kenburnsInner[0], 'uncode-kburns'); 2660 $kenburnsInner[0].dispatchEvent(new CustomEvent('exit-kburns')); 2661 } 2662 } 2663 } 2664 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2665 kenburnsCols = document.querySelectorAll('.with-kburns > .column-background > .background-wrapper'); 2666 } 2667 if ( typeof kenburnsCols == 'object' && kenburnsCols.length ) { 2668 for (var j = 0; j < kenburnsCols.length; j++) { 2669 var elm = kenburnsCols[j], 2670 $kenburnsInner = elm.querySelectorAll('.background-inner'); 2671 if (checkVisible(elm)) { 2672 classie.addClass($kenburnsInner[0], 'uncode-kburns'); 2673 $kenburnsInner[0].dispatchEvent(new CustomEvent('enter-kburns')); 2674 } else { 2675 classie.removeClass($kenburnsInner[0], 'uncode-kburns'); 2676 $kenburnsInner[0].dispatchEvent(new CustomEvent('exit-kburns')); 2677 } 2678 } 2679 } 2680 }, 2681 /** Zoom Out BackWash **/ 2682 backwashHeader = function(bodyTop) { 2683 var value; 2684 var onEndAnimationFn = function(ev){ 2685 if (animationEvent) { 2686 if (ev.animationName !== 'backwash') { 2687 return; 2688 } 2689 this.removeEventListener(animationEvent, onEndAnimationFn); 2690 } 2691 classie.addClass(ev.target, 'uncode-zoomout-already'); 2692 } 2693 if ( typeof backwashHeaders == 'object' && backwashHeaders.length ) { 2694 for (var i = 0; i < backwashHeaders.length; i++) { 2695 var section = backwashHeaders[i].parentNode, 2696 sectionHeight = outerHeight(section), 2697 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 2698 offSetPosition = wheight + bodyTop - offSetTop, 2699 $backwashInner = backwashHeaders[i].querySelectorAll('.header-bg'); 2700 2701 if ( classie.hasClass($backwashInner[0], 'uncode-video-container') ) { 2702 continue; 2703 } 2704 2705 if (classie.hasClass(backwashHeaders[i], 'header-carousel-wrapper')) { 2706 $backwashInner = backwashHeaders[i].querySelectorAll('.t-background-cover'); 2707 } 2708 2709 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2710 for (var i = 0; i < $backwashInner.length; i++) { 2711 classie.addClass($backwashInner[i], 'uncode-zoomout'); 2712 $backwashInner[i].dispatchEvent(new CustomEvent('enter-zoomout')); 2713 } 2714 } else { 2715 for (var i = 0; i < $backwashInner.length; i++) { 2716 classie.removeClass($backwashInner[i], 'uncode-zoomout'); 2717 $backwashInner[i].dispatchEvent(new CustomEvent('exit-zoomout')); 2718 } 2719 } 2720 for (var i = 0; i < $backwashInner.length; i++) { 2721 $backwashInner[i].addEventListener(animationEvent, onEndAnimationFn); 2722 } 2723 } 2724 } 2725 }, 2726 backwashRowCol = function(bodyTop) { 2727 var value; 2728 var onEndAnimationFn = function(ev){ 2729 if (animationEvent) { 2730 if (ev.animationName !== 'backwash') { 2731 return; 2732 } 2733 this.removeEventListener(animationEvent, onEndAnimationFn); 2734 } 2735 classie.addClass(ev.target, 'uncode-zoomout-already'); 2736 } 2737 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2738 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'); 2739 } 2740 if ( typeof backwashRows == 'object' && backwashRows.length ) { 2741 for (var i = 0; i < backwashRows.length; i++) { 2742 var section = backwashRows[i].parentNode, 2743 sectionHeight = outerHeight(section), 2744 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 2745 offSetPosition = wheight + bodyTop - offSetTop, 2746 $backwashInner = backwashRows[i].querySelectorAll('.background-inner'); 2747 2748 if ( classie.hasClass($backwashInner[0], 'uncode-video-container') ) { 2749 continue; 2750 } 2751 2752 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight) ) { 2753 classie.addClass($backwashInner[0], 'uncode-zoomout'); 2754 $backwashInner[0].dispatchEvent(new CustomEvent('enter-zoomout')); 2755 } else { 2756 classie.removeClass($backwashInner[0], 'uncode-zoomout'); 2757 $backwashInner[0].dispatchEvent(new CustomEvent('exit-zoomout')); 2758 } 2759 $backwashInner[0].addEventListener(animationEvent, onEndAnimationFn); 2760 } 2761 2762 } 2763 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2764 backwashCols = document.querySelectorAll('.with-zoomout > .column-background > .background-wrapper'); 2765 } 2766 if ( typeof backwashCols == 'object' && backwashCols.length ) { 2767 for (var j = 0; j < backwashCols.length; j++) { 2768 var elm = backwashCols[j], 2769 $backwashInner = elm.querySelectorAll('.background-inner'); 2770 if (checkVisible(elm)) { 2771 classie.addClass($backwashInner[0], 'uncode-zoomout'); 2772 $backwashInner[0].dispatchEvent(new CustomEvent('enter-zoomout')); 2773 } else { 2774 classie.removeClass($backwashInner[0], 'uncode-zoomout'); 2775 $backwashInner[0].dispatchEvent(new CustomEvent('exit-zoomout')); 2776 } 2777 $backwashInner[0].addEventListener(animationEvent, onEndAnimationFn); 2778 } 2779 } 2780 }, 2781 /** Parallax Rows **/
2782 parallaxRowCol = function(bodyTop) { 2783 var value; 2784 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2785 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'); 2786 } 2787 if (typeof parallaxRows == 'object') { 2788 for (var i = 0; i < parallaxRows.length; i++) { 2789 var section = parallaxRows[i].parentNode, 2790 thisHeight = outerHeight(parallaxRows[i]), 2791 sectionHeight = outerHeight(section), 2792 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 2793 offSetPosition = wheight + bodyTop - offSetTop; 2794 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2795 value = ((offSetPosition - wheight) * speedDivider); 2796 if (Math.abs(value) < (thisHeight - sectionHeight)) {
2797 translateElement(parallaxRows[i], Math.floor(value)); 2798 } else { 2799 translateElement(parallaxRows[i], Math.floor(thisHeight - sectionHeight)); 2800 } 2801 } 2802 } 2803 } 2804 if ( UNCODE.isFrontEndEditor || UNCODE.isQuickView ) { 2805 parallaxCols = document.querySelectorAll('.with-parallax > .column-background > .background-wrapper'); 2806 } 2807 if (typeof parallaxCols == 'object') { 2808 for (var j = 0; j < parallaxCols.length; j++) { 2809 var section = parallaxCols[j].parentNode, 2810 thisHeight = outerHeight(parallaxCols[j]), 2811 sectionHeight = outerHeight(section), 2812 offSetTop = bodyTop + (section != null ? section.getBoundingClientRect().top : 0), 2813 offSetPosition = wheight + bodyTop - offSetTop; 2814 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2815 value = ((offSetPosition - wheight) * speedDivider); 2816 value *= .8; 2817 if (Math.abs(value) < (thisHeight - sectionHeight)) { 2818 translateElement(parallaxCols[j], Math.floor(value)); 2819 } else { 2820 translateElement(parallaxCols[j], Math.floor(thisHeight - sectionHeight)); 2821 } 2822 } 2823 } 2824 } 2825 }, 2826 /** Parallax Headers **/ 2827 parallaxHeader = function(bodyTop) { 2828 var value; 2829 if (typeof parallaxHeaders == 'object') { 2830 for (var i = 0; i < parallaxHeaders.length; i++) { 2831 var section = parallaxHeaders[i].parentNode, 2832 thisSibling = section.nextSibling, 2833 thisHeight, 2834 sectionHeight, 2835 offSetTop, 2836 offSetPosition; 2837 if (classie.hasClass(parallaxHeaders[i], 'header-carousel-wrapper')) { 2838 getDivChildren(parallaxHeaders[i], '.t-entry-visual-cont', function(item, l, total) { 2839 thisHeight = outerHeight(item); 2840 sectionHeight = outerHeight(section); 2841 offSetTop = bodyTop + section.getBoundingClientRect().top; 2842 offSetPosition = wheight + bodyTop - offSetTop; 2843 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2844 value = ((offSetPosition - wheight) * speedDivider); 2845 if (Math.abs(value) < (thisHeight - sectionHeight)) { 2846 translateElement(item, Math.floor(value)); 2847 } 2848 } 2849 }); 2850 } else { 2851 thisHeight = outerHeight(parallaxHeaders[i]); 2852 sectionHeight = outerHeight(section); 2853 offSetTop = bodyTop + section.getBoundingClientRect().top; 2854 offSetPosition = wheight + bodyTop - offSetTop; 2855 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 2856 value = ((offSetPosition - wheight) * speedDivider); 2857 if (Math.abs(value) < (thisHeight - sectionHeight)) { 2858 translateElement(parallaxHeaders[i], Math.floor(value)); 2859 } 2860 } 2861 } 2862 } 2863 } 2864 }, 2865 /** Header opacity **/ 2866 headerOpacity = function(bodyTop) { 2867 if ( UNCODE.isFrontEndEditor ) { 2868 return; 2869 } 2870 if (headerWithOpacity && headerWithOpacity.length) { 2871 var thisHeight = outerHeight(headerWithOpacity[0]); 2872 if (bodyTop > thisHeight / 8) { 2873 if (pageHeader != undefined) classie.addClass(pageHeader, 'header-scrolled'); 2874 } else { 2875 if (pageHeader != undefined) classie.removeClass(pageHeader, 'header-scrolled'); 2876 } 2877 } 2878 }, 2879 /** Show hide scroll top arrow **/ 2880 showHideScrollup = function(bodyTop) { 2881 if ( bodyTop != 0 ) { 2882 if (bodyTop > wheight || ((bodyTop + wheight) >= docheight) && docheight > 0) { 2883 classie.addClass(document.body, 'window-scrolled'); 2884 classie.removeClass(document.body, 'hide-scrollup'); 2885 if (footerScroller && footerScroller[0] != undefined) { 2886 footerScroller[0].style.display = ''; 2887 } 2888 } else { 2889 if (classie.hasClass(document.body, 'window-scrolled')) classie.addClass(document.body, 'hide-scrollup'); 2890 classie.removeClass(document.body, 'window-scrolled'); 2891 } 2892 } 2893 }, 2894 /** Fix menu **/ 2895 fixMenu = function(){ 2896 if ( UNCODE.isFrontEndEditor ) 2897 return; 2898 menuwrapper = document.querySelectorAll(".menu-wrapper"); 2899 if ( ! classie.hasClass(document.body, 'vmenu') && UNCODE.isFullPage && !UNCODE.isFullPageSnap && classie.hasClass(document.body, 'uncode-fp-menu-hide') ) { 2900 menuwrapper = document.querySelector(".menu-wrapper"); 2901 pageHeader = document.getElementById("page-header"); 2902 menuwrapper.style.position = 'fixed'; 2903 menuwrapper.style.zIndex = '5'; 2904 } 2905 }, 2906 /** Hide Menu **/ 2907 hideMenu = function(bodyTop) { 2908 if ( UNCODE.isFrontEndEditor ) 2909 return; 2910 if (UNCODE.menuOpened || bodyTop < 0) return; 2911 if (classie.hasClass(document.body, 'vmenu')) { 2912 if (wwidth < mediaQuery) menuhide = document.querySelector('#masthead .menu-hide-vertical'); 2913 else menuhide = null; 2914 } 2915 if (classie.hasClass(document.body, 'hmenu-center')) { 2916 if (wwidth > mediaQuery) menuhide = document.querySelector('#masthead .menu-hide'); 2917 else menuhide = document.querySelector('.menu-container-mobile.menu-hide'); 2918 } 2919 if (typeof menuhide == 'object' && menuhide != null && mainmenu[0] != undefined) { 2920 var translate, 2921 scrollingDown = true; 2922 /** fix for hmenu-center **/ 2923 var sticky_element = (typeof mainmenu.item === 'undefined' ? ((wwidth > mediaQuery) ? mainmenu[0] : mainmenu[1]) : mainmenu[0]); 2924 if (lastScrollValue == bodyTop) return; 2925 2926 if (lastScrollValue > bodyTop) scrollingDown = false;
2927 else scrollingDown = true; 2928 lastScrollValue = bodyTop; 2929 2930 if (!scrollingDown) { 2931 if (!UNCODE.scrolling) { 2932 if ((secmenuHeight == 0) ? bodyTop == 0 : bodyTop < secmenuHeight) { 2933 classie.removeClass(sticky_element.parentNode, 'is_stuck'); 2934 if (classie.hasClass(masthead, 'menu-transparent')) { 2935 if ((isMobileTransparent || wwidth > mediaQuery) && !classie.hasClass(masthead.parentNode, 'no-header')) masthead.parentNode.style.height = '0px'; 2936 } 2937 if (wwidth < mediaQuery) sticky_element.style.position = 'fixed'; 2938 else sticky_element.style.position = ''; 2939 hideMenuReset(sticky_element); 2940 clearTimeout(hidingTimer); 2941 } 2942 2943 if (classie.hasClass(menuhide, 'menu-hided')) { 2944 classie.removeClass(menuhide, 'menu-hided'); 2945 hidingTimer = setTimeout(function() { 2946 classie.addClass(sticky_element.parentNode, 'is_stuck'); 2947 hideMenuReset(sticky_element); 2948 }, 400); 2949 } 2950 } 2951 } else { 2952 if (menusticky.length == 0 && bodyTop < wheight / 3) { 2953 if (sticky_element.style.position == 'fixed') sticky_element.style.position = ''; 2954 } 2955 if (bodyTop > wheight / 2) { 2956 clearTimeout(hidingTimer); 2957 if (!classie.hasClass(menuhide, 'menu-hided')) { 2958 classie.addClass(menuhide, 'menu-hided'); 2959 classie.addClass(sticky_element.parentNode, 'is_stuck'); 2960 if (sticky_element.style.position != 'fixed') { 2961 sticky_element.style.visibility = 'hidden'; 2962 sticky_element.style.position = 'fixed'; 2963 sticky_element.style.top = '0px'; 2964 } 2965 translateElement(menuhide, -UNCODE.menuMobileHeight - 1); 2966 } 2967 } 2968 } 2969 } 2970 }, 2971 hideMenuReset = function(sticky_element) { 2972 var topOffset = 0; 2973 if (sticky_element.style.visibility == 'hidden') sticky_element.style.visibility = ''; 2974 if (bodyBorder > 0) topOffset += bodyBorder; 2975 if (adminBar != null && window.getComputedStyle(adminBar,null).getPropertyValue("position") != 'fixed') adminBarHeight = 0; 2976 if (adminBarHeight > 0) topOffset += adminBarHeight; 2977 //sticky_element.style.top = topOffset + 'px'; 2978 if (!classie.hasClass(document.body, 'boxed-width') && boxWidth > 0) sticky_element.style.width = boxWidth + 'px'; 2979 translateElement(menuhide, 0); 2980 }, 2981 /** Stick Menu **/ 2982 stickMenu = function(bodyTop) { 2983 if (header && mainmenu[0] != undefined) { 2984 if (classie.hasClass(mainmenu[0], 'vmenu-container') && wwidth > mediaQuery) return; 2985 /** fix for hmenu-center **/ 2986 var sticky_element = (typeof mainmenu.item === 'undefined' ? ((isMobileTransparent || wwidth > mediaQuery) ? mainmenu[0] : mainmenu[1]) : mainmenu[0]); 2987 if ((secmenuHeight == 0 && (isMobileTransparent || wwidth > mediaQuery)) ? bodyTop > (0 + adminBarHeight) : bodyTop > (secmenuHeight + adminBarHeight)) { 2988 if (!classie.hasClass(sticky_element.parentNode, 'is_stuck')) { 2989 classie.addClass(sticky_element.parentNode, 'is_stuck'); 2990 sticky_element.style.position = 'fixed'; 2991 var getAnchorTop = bodyBorder; 2992 if (adminBar != null && window.getComputedStyle(adminBar,null).getPropertyValue("position") != 'fixed') adminBarHeight = 0; 2993 if (adminBarHeight > 0) getAnchorTop += adminBarHeight; 2994 sticky_element.style.top = getAnchorTop + 'px'; 2995 if (!classie.hasClass(document.body, 'boxed-width') && boxWidth > 0) sticky_element.style.width = boxWidth + 'px'; 2996 } 2997 } else { 2998 clearTimeout(hidingTimer); 2999 classie.removeClass(sticky_element.parentNode, 'is_stuck'); 3000 sticky_element.style.position = 'fixed'; 3001 if (isMobileTransparent || wwidth > mediaQuery) sticky_element.style.position = ''; 3002 if (classie.hasClass(document.body, 'hmenu-center')) sticky_element.style.position = 'absolute'; 3003 sticky_element.style.top = ''; 3004 } 3005 } 3006 }, 3007 translateElement = function(element, valueY) { 3008 var translate = 'translate3d(0, ' + valueY + 'px' + ', 0)'; 3009 element.style['-webkit-transform'] = translate; 3010 element.style['-moz-transform'] = translate; 3011 element.style['-ms-transform'] = translate; 3012 element.style['-o-transform'] = translate; 3013 element.style['transform'] = translate; 3014 }, 3015 setScrollPosition, 3016 scrollFunction = function() { 3017 if ( ! UNCODE.isFullPage ) { 3018 kenburnsHeader(bodyTop); 3019 kenburnsRowCol(bodyTop); 3020 backwashHeader(bodyTop); 3021 backwashRowCol(bodyTop); 3022 if (logoel != undefined && logoel.length && !isMobile) shrinkMenu(bodyTop); 3023 if (menusticky != undefined && menusticky.length) stickMenu(bodyTop); 3024 hideMenu(bodyTop); 3025 if (isMobileParallaxAllowed || !isMobile) { 3026 if (header && menusticky != undefined && menusticky.length) 3027 switchColorsMenu(bodyTop);
3028 parallaxRowCol(bodyTop); 3029 parallaxHeader(bodyTop); 3030 headerOpacity(bodyTop); 3031 visibleRowCol(bodyTop); 3032 } 3033 clearRequestTimeout(setScrollPosition); 3034 setScrollPosition = requestTimeout( function(){ 3035 scrollRowHeight_fix = window.pageYOffset; 3036 }, 100 ); 3037 } 3038 }, 3039 /** Custom Cursor **/ 3040 initCursor = function(){ 3041 var clientX, clientY; 3042 3043 var $customCursor = document.getElementById('uncode-custom-cursor'), 3044 $customPilot = document.getElementById('uncode-custom-cursor-pilot'), 3045 cursorType = 'auto', 3046 loadedCursor = false; 3047 3048 document.addEventListener("mousemove", function(e) { 3049 clientX = e.clientX; 3050 clientY = e.clientY; 3051 3052 if ( loadedCursor !== true ) { 3053 loadedCursor = true; 3054 classie.addClass($customCursor, 'loaded-cursor'); 3055 if ( $customPilot !== null ) { 3056 classie.addClass($customPilot, 'loaded-cursor'); 3057 } 3058 } 3059 }); 3060 3061 function render() { 3062 if ( $customCursor != null ) { 3063 $customCursor.style.transform = 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0)'; 3064 if ( $customPilot !== null ) { 3065 $customPilot.style.transform = 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0)'; 3066 } 3067 requestAnimationFrame(render); 3068 } 3069 }; 3070 requestAnimationFrame(render); 3071 }, 3072 3073 /** Shape Dividers **/ 3074 shapeDivider = function() { 3075 var $shape = '.uncode-divider-wrap'; 3076 3077 forEachElement($shape, function($el, i) { 3078 var elH = parseInt( $el.getAttribute('data-height') ), 3079 elHunit = $el.getAttribute('data-unit'), 3080 newEl, 3081 $parent = $el.parentNode, 3082 parentH, 3083 $svg = $el.getElementsByTagName('svg')[0]; 3084 3085 if ( elHunit == 'px' ) { 3086 3087 switch (true) { 3088 case (wwidth < 1500 && wwidth >= 1180): 3089 newEl = elH*0.8; 3090 break; 3091 3092 case (wwidth < 1180 && wwidth >= 960): 3093 newEl = elH*0.65; 3094 break; 3095 3096 case (wwidth < 960 && wwidth >= 570): 3097 newEl = elH*0.5; 3098 break; 3099 3100 case (wwidth < 570): 3101 newEl = elH*0.25; 3102 break; 3103 3104 default: 3105 newEl = elH; 3106 } 3107 3108 $el.style.height = newEl + elHunit; 3109 } 3110 3111 3112 if ( classie.hasClass($el, 'uncode-divider-preserve-ratio') && ( window.navigator.userAgent.indexOf('MSIE ') !== -1 || window.navigator.userAgent.indexOf('Trident/') !== -1 ) ) { 3113 3114 $svg.setAttribute('preserveAspectRatio','none'); 3115 3116 var sizes = $svg.getAttribute('viewBox').split(' '), 3117 svgW = sizes[2], 3118 svgH = sizes[3], 3119 newSvgW; 3120 3121 newSvgW = newEl * ( svgW / svgH ); 3122 3123 $svg.style.width = newSvgW + 'px'; 3124 3125 } 3126 }); 3127 }; 3128 if (!noScroll && document.body == null) { 3129 window.addEventListener('scroll', function(e) { 3130 if ( ! UNCODE.isFullPage ) { 3131 bodyTop = document.documentElement.scrollTop || document.body.scrollTop; 3132 scrollFunction(); 3133 showHideScrollup(bodyTop); 3134 } 3135 }, false); 3136 } 3137 window.addEventListener('uncode-quick-view-loaded', function() { 3138 document.getElementById('unmodal-content').addEventListener('scroll', function(e) { 3139 bodyTop = document.getElementById('unmodal-content').scrollTop; 3140 scrollFunction(); 3141 showHideScrollup(bodyTop); 3142 }, false); 3143 }, false); 3144 /** All scrolling functions - End */ 3145 /** help functions */ 3146 function getClosest(el, tag) { 3147 do { 3148 if (el.className != undefined && el.className.indexOf(tag) > -1) return el; 3149 } while (el = el.parentNode); 3150 // not found :( 3151 return null; 3152 } 3153 3154 function outerHeight(el, includeMargin) { 3155 if (el != null) { 3156 var height = el.offsetHeight; 3157 if (includeMargin) { 3158 var style = el.currentStyle || getComputedStyle(el); 3159 height += parseInt(style.marginTop) + parseInt(style.marginBottom); 3160 } 3161 return height; 3162 } 3163 } 3164 3165 function outerWidth(el, includeMargin) { 3166 var width = el.offsetWidth; 3167 if (includeMargin) { 3168 var style = el.currentStyle || getComputedStyle(el); 3169 width += parseInt(style.marginLeft) + parseInt(style.marginRight); 3170 } 3171 return width; 3172 } 3173 // Replicate jQuery .each method 3174 function forEachElement(selector, fn) { 3175 var elements = document.querySelectorAll(selector); 3176 for (var i = 0; i < elements.length; i++) fn(elements[i], i); 3177 } 3178 3179 function getDivChildren(containerId, selector, fn) { 3180 if (containerId !== null) { 3181 var elements = containerId.querySelectorAll(selector); 3182 for (var i = 0; i < elements.length; i++) fn(elements[i], i, elements.length); 3183 } 3184 } 3185 3186 function hideFooterScroll() { 3187 if (classie.hasClass(document.body, 'hide-scrollup')) footerScroller[0].style.display = "none"; 3188 } 3189 window.addEventListener("load", function(event) {
3190 if (SiteParameters.dynamic_srcset_active === '1') { 3191 UNCODE.adaptive_srcset_bg(); 3192 UNCODE.adaptive_srcset(false); 3193 } 3194 classie.addClass(document.body, 'uncode-loaded'); 3195 }); 3196 document.addEventListener("DOMContentLoaded", function(event) { 3197 UNCODE.adaptive(); 3198 boxWrapper = document.querySelectorAll('.box-wrapper'); 3199 docheight = boxWrapper[0] != undefined ? boxWrapper[0].offsetHeight : 0; 3200 // if (!classie.hasClass(document.body, 'vmenu') && !classie.hasClass(document.body, 'menu-offcanvas')) init_overlay(); 3201 init_overlay(); 3202 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'); 3203 kenburnsCols = document.querySelectorAll('.with-kburns > .column-background > .background-wrapper'); 3204 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'); 3205 backwashCols = document.querySelectorAll('.with-zoomout > .column-background > .background-wrapper'); 3206 if (!UNCODE.isMobile || isMobileParallaxAllowed) { 3207 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'); 3208 parallaxCols = document.querySelectorAll('.with-parallax > .column-background > .background-wrapper'); 3209 } 3210 footerScroller = document.querySelectorAll('.footer-scroll-top'); 3211 if (footerScroller && footerScroller[0] != undefined) { 3212 if (transitionEvent) { 3213 footerScroller[0].addEventListener(transitionEvent, hideFooterScroll); 3214 } 3215 } 3216 Array.prototype.forEach.call(document.querySelectorAll('.row-inner'), function(el) { 3217 el.style.height = ''; 3218 el.style.marginBottom = ''; 3219 }); 3220 setRowHeight(document.querySelectorAll('.page-wrapper .row-parent, footer .row-parent')); 3221 }); 3222 /** On resize events **/ 3223 window.addEventListener("vc-resize", function() { 3224 scrollRowHeight_fix = window.pageYOffset; 3225 Array.prototype.forEach.call(document.querySelectorAll('.row-inner'), function(el) { 3226 el.style.height = ''; 3227 el.style.marginBottom = ''; 3228 }); 3229 setRowHeight(document.querySelectorAll('.page-wrapper .row-parent, footer .row-parent'), false, true); 3230 }); 3231 var setIsScrolling; 3232 window.addEventListener("scroll", function() { 3233 UNCODE.setIsScrolling = true; 3234 clearRequestTimeout(setIsScrolling); 3235 3236 setIsScrolling = requestTimeout(function() { 3237 UNCODE.setIsScrolling = false; 3238 }, 66); 3239 }); 3240 window.addEventListener("resize", function() { 3241 scrollRowHeight_fix = window.pageYOffset; 3242 docheight = (boxWrapper != undefined && boxWrapper[0] != undefined) ? boxWrapper[0].offsetHeight : 0; 3243 var oldWidth = wwidth; 3244 UNCODE.wwidth = wwidth = window.innerWidth || document.documentElement.clientWidth; 3245 UNCODE.wheight = wheight = (window.innerHeight || document.documentElement.clientHeight) - (bodyBorder * 2); 3246 if ( isSplitMenu && typeof resizeTimer_ === 'undefined' ) centerSplitMenu(); 3247 if (isMobile && (oldWidth == wwidth)) return false; 3248 calculateMenuHeight(false); 3249 initBox(); 3250 headerHeight('.header-wrapper'); 3251 window.dispatchEvent(boxEvent); 3252 scrollFunction(); 3253 shapeDivider(); 3254 showHideScrollup(bodyTop); 3255 clearTimeout(resizeTimer_); 3256 resizeTimer_ = setTimeout(function() { 3257 if (isSplitMenu) centerSplitMenu(); 3258 }, 10); 3259 resizeThrottle( 3260 function() { 3261 if (SiteParameters.dynamic_srcset_active === '1') { 3262 UNCODE.refresh_dynamic_srcset_size(false); 3263 } 3264 menuOpacity(); 3265 }, 100 3266 ); 3267 if ( ! UNCODE.setIsScrolling ) { 3268 clearTimeout(resizeTimer); 3269 resizeTimer = setTimeout(function() { 3270 if ( ! UNCODE.setIsScrolling ) { 3271 UNCODE.wheight = wheight = (window.innerHeight || document.documentElement.clientHeight) - (bodyBorder * 2); 3272 Array.prototype.forEach.call(document.querySelectorAll('.row-inner'), function(el) { 3273 el.style.height = ''; 3274 el.style.marginBottom = ''; 3275 }); 3276 setRowHeight(document.querySelectorAll('.page-wrapper .row-parent, footer .row-parent'), false, true); 3277 } 3278 if (!isMobile) { 3279 initVideoComponent(document.body, '.uncode-video-container.video, .uncode-video-container.self-video'); 3280 } 3281 }, 500); 3282 } 3283 }); 3284 3285 var resizeThrottle = (function () { 3286 var timer = 0; 3287 return function (callback, ms) { 3288 clearTimeout(timer); 3289 timer = setTimeout(callback, ms); 3290 }; 3291 })(); 3292 3293 /** 3294 * On DOM ready 3295 */ 3296 window.addEventListener("load", function(){ 3297 if (!UNCODE.isMobile) { 3298 setTimeout(function() { 3299 // window.dispatchEvent(UNCODE.boxEvent); 3300 if (typeof Waypoint !== 'undefined') { 3301 Waypoint.refreshAll(); 3302 } 3303 }, 2000); 3304 } 3305 //repeat it for mobile since it changes layout on carousel after DOM loading 3306 if (UNCODE.isMobile && !isMobileParallaxAllowed) { 3307 kenburnsHeader(bodyTop); 3308 kenburnsRowCol(bodyTop); 3309 } 3310 backwashHeader(bodyTop); 3311 backwashRowCol(bodyTop); 3312 scrollFunction(); 3313 showHideScrollup(bodyTop); 3314 3315 // if (document.createEvent) { // W3C 3316 // var ev = document.createEvent('Event'); 3317 // ev.initEvent('resize', true, true); 3318 // window.dispatchEvent(ev); 3319 // } else { // IE 3320 // document.fireEvent('onresize'); 3321 // } 3322 3323 scrollRowHeight_fix = window.pageYOffset; 3324 docheight = (boxWrapper != undefined && boxWrapper[0] != undefined) ? boxWrapper[0].offsetHeight : 0; 3325 var oldWidth = wwidth; 3326 UNCODE.wwidth = wwidth = window.innerWidth || document.documentElement.clientWidth; 3327 UNCODE.wheight = wheight = (window.innerHeight || document.documentElement.clientHeight) - (bodyBorder * 2); 3328 if ( isSplitMenu && typeof resizeTimer_ === 'undefined' ) { 3329 centerSplitMenu(); 3330 } 3331 3332 }, false); 3333 3334 function localStorageAvailable() { 3335 try { 3336 var storage = window['localStorage'], 3337 x = '__storage_test__'; 3338 storage.setItem(x, x); 3339 storage.removeItem(x); 3340 return true; 3341 } catch(e) { 3342 return false;
3343 } 3344 } 3345 3346 var UNCODE = { 3347 bodyTop: bodyTop, 3348 boxEvent: boxEvent, 3349 bodyBorder: bodyBorder, 3350 initBox: initBox, 3351 adminBarHeight: 0, 3352 menuHeight: 0, 3353 menuMobileHeight: 0, 3354 menuOpacity: menuOpacity, 3355 fixMenuHeight: fixMenuHeight, 3356 verticalRightMenu: verticalRightMenu, 3357 initHeader: initHeader, 3358 initRow: initRow, 3359 initCursor: initCursor, 3360 setRowHeight: setRowHeight, 3361 switchColorsMenu: switchColorsMenu, 3362 isMobile: isMobile, 3363 scrolling: false, 3364 menuHiding: false, 3365 menuOpened: false, 3366 menuMobileTriggerEvent: menuMobileTriggerEvent, 3367 mediaQuery: mediaQuery, 3368 initVideoComponent: initVideoComponent, 3369 hideMenu: hideMenu, 3370 wwidth: wwidth, 3371 wheight: wheight, 3372 webp_lossy_supported: SiteParameters.force_webp ? true : localStorageAvailable() && localStorage.getItem('webp_lossy_supported') === 'true' ? true : false, 3373 webp_lossless_supported: SiteParameters.force_webp ? true : localStorageAvailable() && localStorage.getItem('webp_lossless_supported') === 'true' ? true : false, 3374 }; 3375 // transport 3376 if (typeof define === 'function' && define.amd) { 3377 // AMD 3378 define(UNCODE); 3379 } else { 3380 // browser global 3381 window.UNCODE = UNCODE; 3382 } 3383 3384 UNCODE.check_webp_support = function(feature, callback) { 3385 // https://developers.google.com/speed/webp/faq#in_your_own_javascript 3386 var kTestImages = { 3387 lossy: "UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", 3388 lossless: "UklGRhoAAABXRUJQVlA4TA0AAAAvAAAAEAcQERGIiP4HAA==", 3389 alpha: "UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAARBxAR/Q9ERP8DAABWUDggGAAAABQBAJ0BKgEAAQAAAP4AAA3AAP7mtQAAAA==", 3390 // animation: "UklGRlIAAABXRUJQVlA4WAoAAAASAAAAAAAAAAAAQU5JTQYAAAD/////AABBTk1GJgAAAAAAAAAAAAAAAAAAAGQAAABWUDhMDQAAAC8AAAAQBxAREYiI/gcA" 3391 }; 3392 var img = new Image(); 3393 img.onload = function () { 3394 var result = (img.width > 0) && (img.height > 0); 3395 callback(feature, result); 3396 }; 3397 img.onerror = function () { 3398 callback(feature, false); 3399 }; 3400 img.src = "data:image/webp;base64," + kTestImages[feature]; 3401 } 3402 3403 UNCODE.check_webp_support('lossy', function (feature, isSupported) { 3404 if (isSupported) { 3405 UNCODE.webp_lossy_supported = true; 3406 if (localStorageAvailable()) { 3407 localStorage.setItem('webp_lossy_supported', true); 3408 } 3409 } 3410 }); 3411 3412 UNCODE.check_webp_support('lossless', function (feature, isSupported) { 3413 if (isSupported) { 3414 UNCODE.webp_lossless_supported = true; 3415 if (localStorageAvailable()) { 3416 localStorage.setItem('webp_lossless_supported', true); 3417 } 3418 } 3419 }); 3420 3421 UNCODE.adaptive = function() { 3422 if (SiteParameters.dynamic_srcset_active === '1') { 3423 return; 3424 } 3425 3426 var images = new Array(), 3427 getImages = document.querySelectorAll('.adaptive-async:not(.adaptive-fetching)'); 3428 for (var i = 0; i < getImages.length; i++) { 3429 var imageObj = {}, 3430 el = getImages[i]; 3431 classie.addClass(el, 'adaptive-fetching'); 3432 imageObj.unique = el.getAttribute('data-uniqueid'); 3433 imageObj.url = el.getAttribute('data-guid'); 3434 imageObj.path = el.getAttribute('data-path'); 3435 imageObj.singlew = el.getAttribute('data-singlew'); 3436 imageObj.singleh = el.getAttribute('data-singleh'); 3437 imageObj.origwidth = el.getAttribute('data-width'); 3438 imageObj.origheight = el.getAttribute('data-height'); 3439 imageObj.crop = el.getAttribute('data-crop'); 3440 imageObj.fixed = el.getAttribute('data-fixed') == undefined ? null : el.getAttribute('data-fixed'); 3441 imageObj.screen = window.uncodeScreen; 3442 imageObj.images = window.uncodeImages; 3443 images.push(imageObj); 3444 } 3445 3446 var post_data = { 3447 images: JSON.stringify(images), 3448 action: 'get_adaptive_async', 3449 ai_breakpoints: SiteParameters.ai_breakpoints, 3450 resize_quality: SiteParameters.resize_quality, 3451 register_metadata: SiteParameters.register_metadata, 3452 nonce_adaptive_images: SiteParameters.nonce_adaptive_images 3453 }; 3454 3455 if (images.length > 0) { 3456 var xhr = new XMLHttpRequest(); 3457 xhr.open('POST', SiteParameters.ajax_url, true); 3458 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); 3459 xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 3460 3461 xhr.onreadystatechange = function() { 3462 if (xhr.readyState == XMLHttpRequest.DONE) { 3463 if (xhr.status == 200 && xhr.responseText) { 3464 var jsonResponse = JSON.parse(xhr.responseText); 3465 3466 if (jsonResponse.success && jsonResponse.data.images) { 3467 var images = jsonResponse.data.images; 3468 3469 for (var i = 0; i < images.length; i++) { 3470 var val = images[i]; 3471 var processedImageID = val.id; 3472 var processedImageUniqueID = val.unique; 3473 var processedImageisNew = val.new_crop === true ? true : false;
3474 var getImage = document.querySelectorAll('[data-uniqueid="'+processedImageUniqueID+'"]'); 3475 3476 for (var j = 0; j < getImage.length; j++) { 3477 var attrScr = getImage[j].getAttribute('src'), 3478 replaceImg = new Image(); 3479 replaceImg.source = attrScr; 3480 replaceImg.el = getImage[j]; 3481 3482 classie.removeClass(getImage[j], 'adaptive-async'); 3483 classie.removeClass(getImage[j], 'adaptive-fetching'); 3484 3485 replaceImg.onload = function () { 3486 3487 var _this = this, 3488 parentNode = (_this.el).parentNode, 3489 placeH; 3490 3491 //Workaround for lazy-load flickering on Firefox 3492 if ( typeof parentNode.prepend == 'undefined') { 3493 if (_this.source !== null) { 3494 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3495 (_this.el).lazySrc = _this.src; 3496 3497 if (classie.hasClass((_this.el), 'lazyloaded') || classie.hasClass((_this.el), 'lazyloading')) { 3498 (_this.el).src = _this.src; 3499 (_this.el).removeAttribute('data-lazy-src'); 3500 } 3501 } else { 3502 (_this.el).src = _this.src; 3503 } 3504 } else { 3505 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3506 (_this.el).dataset.bg = _this.src; 3507 3508 if (classie.hasClass((_this.el), 'lazyloaded') || classie.hasClass((_this.el), 'lazyloading')) { 3509 (_this.el).style.backgroundImage = 'url("'+_this.src+'")'; 3510 (_this.el).removeAttribute('data-bg'); 3511 } 3512 } else { 3513 (_this.el).style.backgroundImage = 'url("'+_this.src+'")'; 3514 } 3515 } 3516 3517 classie.addClass(_this.el, 'async-done'); 3518 } else { 3519 if (_this.source !== null) { 3520 placeH = document.createElement("IMG"); 3521 placeH.setAttribute('class', 'placeH'); 3522 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3523 placeH.dataset.lazySrc = _this.src; 3524 3525 if (classie.hasClass(placeH, 'lazyloaded') || classie.hasClass(placeH, 'lazyloading')) { 3526 placeH.src = _this.src; 3527 placeH.removeAttribute('data-lazy-src'); 3528 } 3529 } else { 3530 placeH.src = _this.src; 3531 } 3532 placeH.style.position = 'absolute'; 3533 placeH.style.opacity = '0'; 3534 } else { 3535 placeH = document.createElement("DIV"); 3536 placeH.setAttribute('style', _this.el.getAttribute('style')); 3537 placeH.setAttribute('class', 'placeH ' + _this.el.getAttribute('class')); 3538 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3539 placeH.dataset.bg = _this.src; 3540 3541 if (classie.hasClass(placeH, 'lazyloaded') || classie.hasClass(placeH, 'lazyloading')) { 3542 placeH.style.backgroundImage = 'url("'+_this.src+'")'; 3543 placeH.removeAttribute('data-bg'); 3544 } 3545 } else { 3546 placeH.style.backgroundImage = 'url("'+_this.src+'")'; 3547 } 3548 placeH.style.backgroundSize = 'cover'; 3549 placeH.style.backgroundPosition = 'center'; 3550 placeH.style.position = 'absolute'; 3551 placeH.style.top = '0'; 3552 placeH.style.width = '100%'; 3553 placeH.style.height = '100%'; 3554 } 3555 3556 if ( !classie.hasClass( _this.el, 'box-wrapper') ) { 3557 parentNode.prepend(placeH); 3558 } 3559 3560 requestTimeout(function(){ 3561 if (_this.source !== null) { 3562 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3563 (_this.el).dataset.lazySrc = _this.src; 3564 3565 if (classie.hasClass(_this.el, 'lazyloaded') || classie.hasClass(_this.el, 'lazyloading')) { 3566 (_this.el).src = _this.src; 3567 (_this.el).removeAttribute('data-lazy-src'); 3568 } 3569 } else { 3570 (_this.el).src = _this.src; 3571 } 3572 } else { 3573 if (SiteParameters.lazyload_type === 'rocket' && window.lazyLoadOptions) { 3574 (_this.el).dataset.bg = _this.src; 3575 3576 if (classie.hasClass(_this.el, 'lazyloaded') || classie.hasClass(_this.el, 'lazyloading')) { 3577 (_this.el).style.backgroundImage = 'url("'+_this.src+'")'; 3578 (_this.el).removeAttribute('data-bg'); 3579 } 3580 } else { 3581 (_this.el).style.backgroundImage = 'url("'+_this.src+'")'; 3582 } 3583 } 3584 if ( !classie.hasClass( _this.el, 'box-wrapper') ) { 3585 parentNode.removeChild(placeH); 3586 } 3587 classie.addClass(_this.el, 'async-done'); 3588 }, 250); 3589 } 3590 } 3591 replaceImg.src = val.url; 3592 } 3593 3594 if (processedImageisNew && SiteParameters.optimize_shortpixel_image == true) { 3595 UNCODE.process_shortpixel_image(processedImageID); 3596 } 3597 } 3598 3599 } else { 3600 if (SiteParameters.enable_debug == true) { 3601 // This console log is disabled by default 3602 // So nothing is printed in a typical installation 3603 // 3604 // It can be enabled for debugging purposes setting 3605 // the 'uncode_enable_debug_on_js_scripts' filter to true 3606 console.log('There was an error: bad response'); 3607 } 3608 } 3609 3610 } else if (xhr.status == 400) { 3611 if (SiteParameters.enable_debug == true) { 3612 // This console log is disabled by default 3613 // So nothing is printed in a typical installation 3614 // 3615 // It can be enabled for debugging purposes setting 3616 // the 'uncode_enable_debug_on_js_scripts' filter to true 3617 console.log('There was an error 400'); 3618 } 3619 } else { 3620 if (SiteParameters.enable_debug == true) { 3621 // This console log is disabled by default 3622 // So nothing is printed in a typical installation 3623 // 3624 // It can be enabled for debugging purposes setting 3625 // the 'uncode_enable_debug_on_js_scripts' filter to true 3626 console.log('Something else other than 200 was returned'); 3627 } 3628 } 3629 } 3630 } 3631 3632 // Serialize our data 3633 var queryString = "", 3634 arrayLength = Object.keys(post_data).length, 3635 arrayCounter = 0; 3636 3637 for (var key in post_data) { 3638 queryString += key + "=" + post_data[key]; 3639 3640 if (arrayCounter < arrayLength - 1) { 3641 queryString += "&"; 3642 } 3643 3644 arrayCounter++; 3645 } 3646 3647 xhr.send(queryString); 3648 } 3649 }; 3650 3651 UNCODE.adaptive_srcset_replace_bg = function(currentRow) { 3652 if (currentRow === null) { 3653 return; 3654 } 3655
3656 var mobileBreakpoint = SiteParameters.dynamic_srcset_bg_mobile_breakpoint ? parseInt(SiteParameters.dynamic_srcset_bg_mobile_breakpoint, 10) : 570; 3657 var images = currentRow.querySelectorAll('.srcset-bg-async'); 3658 3659 for (var i = 0; i < images.length; i++) { 3660 var el = images[i]; 3661 var bg_url = el.dataset.backgroundImage; 3662 var mobile_bg_url = el.dataset.mobileBackgroundImage; 3663 3664 if (SiteParameters.activate_webp && el.dataset.backgroundImageWebp) { 3665 if ((el.dataset.mime === 'png' && UNCODE.webp_lossless_supported) || (el.dataset.mime === 'jpeg' && UNCODE.webp_lossy_supported)) { 3666 bg_url = el.dataset.backgroundImageWebp; 3667 el.dataset.backgroundImage = bg_url; 3668 el.removeAttribute('data-background-image-webp'); 3669 } 3670 } 3671 3672 if (SiteParameters.activate_webp && el.dataset.mobileBackgroundImageWebp && mobile_bg_url) { 3673 if ((el.dataset.mime === 'png' && UNCODE.webp_lossless_supported) || (el.dataset.mime === 'jpeg' && UNCODE.webp_lossy_supported)) { 3674 mobile_bg_url = el.dataset.mobileBackgroundImageWebp; 3675 el.dataset.mobileBackgroundImage = mobile_bg_url; 3676 el.removeAttribute('data-mobile-background-image-webp'); 3677 } 3678 } 3679 3680 if (screenInfo.width <= mobileBreakpoint && mobile_bg_url) { 3681 el.style.backgroundImage = 'url("' + mobile_bg_url + '")'; 3682 } else { 3683 el.style.backgroundImage = 'url("' + bg_url + '")'; 3684 } 3685 3686 classie.addClass(el, 'srcset-bg-async'); 3687 } 3688 } 3689 3690 UNCODE.adaptive_srcset_bg = function() { 3691 var mobileSize = SiteParameters.dynamic_srcset_bg_mobile_size ? parseInt(SiteParameters.dynamic_srcset_bg_mobile_size, 10) : false; 3692 3693 if (!(mobileSize > 0)) { 3694 return; 3695 } 3696 3697 var images = new Array(); 3698 var getImages = document.querySelectorAll('.srcset-bg-generate-img:not(.adaptive-fetching)'); 3699 3700 for (var i = 0; i < getImages.length; i++) { 3701 var imageObj = {}; 3702 var el = getImages[i]; 3703 3704 classie.addClass(el, 'srcset-bg-fetching'); 3705 imageObj.unique = el.getAttribute('data-uniqueid'); 3706 imageObj.url = el.getAttribute('data-guid'); 3707 imageObj.path = el.getAttribute('data-path'); 3708 imageObj.origwidth = el.getAttribute('data-width'); 3709 imageObj.origheight = el.getAttribute('data-height'); 3710 3711 images.push(imageObj); 3712 } 3713 3714 if (images.length > 0) { 3715 var post_data = { 3716 images: JSON.stringify(images), 3717 action: 'regenerate_srcset_bg_async', 3718 resize_quality: SiteParameters.resize_quality, 3719 mobile_size: mobileSize, 3720 nonce_srcset_async: SiteParameters.nonce_srcset_async 3721 }; 3722 3723 var xhr = new XMLHttpRequest(); 3724 xhr.open('POST', SiteParameters.ajax_url, true); 3725 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); 3726 xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 3727 3728 xhr.onreadystatechange = function() { 3729 if (xhr.readyState == XMLHttpRequest.DONE) { 3730 if (xhr.status == 200 && xhr.responseText) { 3731 var jsonResponse = JSON.parse(xhr.responseText); 3732 3733 if (jsonResponse.success && jsonResponse.data.images) { 3734 var processedImages = jsonResponse.data.images; 3735 3736 for (var i = 0; i < processedImages.length; i++) { 3737 var processedImageID = processedImages[i].id; 3738 var processedImageUniqueID = processedImages[i].unique; 3739 var processedImageisNew = processedImages[i].new_crop === true ? true : false; 3740 var getImage = document.querySelectorAll('[data-uniqueid="'+processedImageUniqueID+'"]'); 3741 3742 for (var j = 0; j < getImage.length; j++) { 3743 classie.removeClass(getImage[j], 'srcset-bg-fetching'); 3744 classie.addClass(getImage[j], 'srcset-bg-async-done'); 3745 } 3746 3747 if (processedImageisNew && SiteParameters.optimize_shortpixel_image == true) { 3748 UNCODE.process_shortpixel_image(processedImageID); 3749 } 3750 } 3751 } else { 3752 if (SiteParameters.enable_debug == true) { 3753 // This console log is disabled by default 3754 // So nothing is printed in a typical installation 3755 // 3756 // It can be enabled for debugging purposes setting 3757 // the 'uncode_enable_debug_on_js_scripts' filter to true 3758 if (jsonResponse.success == false && jsonResponse.data.message) { 3759 console.log('There was an error: ' + jsonResponse.data.message); 3760 } else { 3761 console.log('There was an error: bad response'); 3762 } 3763 } 3764 } 3765 3766 } else if (xhr.status == 400) { 3767 if (SiteParameters.enable_debug == true) { 3768 // This console log is disabled by default 3769 // So nothing is printed in a typical installation 3770 // 3771 // It can be enabled for debugging purposes setting 3772 // the 'uncode_enable_debug_on_js_scripts' filter to true 3773 console.log('There was an error 400'); 3774 } 3775 } else { 3776 if (SiteParameters.enable_debug == true) { 3777 // This console log is disabled by default 3778 // So nothing is printed in a typical installation 3779 // 3780 // It can be enabled for debugging purposes setting 3781 // the 'uncode_enable_debug_on_js_scripts' filter to true 3782 console.log('Something else other than 200 was returned'); 3783 } 3784 } 3785 } 3786 } 3787 3788 // Serialize our data 3789 var queryString = "", 3790 arrayLength = Object.keys(post_data).length, 3791 arrayCounter = 0; 3792 3793 for (var key in post_data) { 3794 queryString += key + "=" + post_data[key]; 3795 3796 if (arrayCounter < arrayLength - 1) { 3797 queryString += "&"; 3798 } 3799 3800 arrayCounter++; 3801 } 3802 3803 xhr.send(queryString); 3804 } 3805 } 3806
3807 UNCODE.refresh_dynamic_srcset_size = function(container) { 3808 var parentSelector = container ? container[0] : document; 3809 // If 'container' is false, we assume that we are resizing generic images 3810 var images = container ? parentSelector.querySelectorAll('.srcset-auto') : parentSelector.querySelectorAll('.srcset-auto:not(.srcset-on-layout)'); 3811 3812 for (var i = 0; i < images.length; i++) { 3813 // Update srcset/sizes attributes 3814 UNCODE.set_dynamic_srcset_size(images[i]); 3815 } 3816 } 3817 3818 UNCODE.set_dynamic_srcset_size = function(el) { 3819 if (el.nodeName === 'PICTURE') { 3820 var picture_imgs = el.getElementsByTagName('img'); 3821 var picture_sources = el.getElementsByTagName('source'); 3822 if (picture_imgs.length > 0) { 3823 var picture_img = picture_imgs[0]; 3824 } 3825 if (picture_sources.length > 0 && picture_imgs.length > 0) { 3826 var picture_source = picture_sources[0]; 3827 var parent_width = el.clientWidth; 3828 var parent_height = el.clientHeight; 3829 var picture_img_width = parseInt(picture_img.getAttribute('width'), 10); 3830 var picture_img_height = parseInt(picture_img.getAttribute('height'), 10); 3831 var final_width = (picture_img_width * parent_height) / picture_img_height; 3832 picture_source.sizes = final_width + 'px'; 3833 classie.addClass(picture_source, 'srcset-sizes-done'); 3834 if (picture_source.dataset.srcset) { 3835 if (SiteParameters.activate_webp && picture_source.dataset.srcsetWebp && ((el.dataset.mime === 'png' && UNCODE.webp_lossless_supported) || (el.dataset.mime === 'jpeg' && UNCODE.webp_lossy_supported))) { 3836 picture_source.srcset = picture_source.dataset.srcsetWebp; 3837 picture_source.removeAttribute('data-srcset-webp'); 3838 } else { 3839 picture_source.srcset = picture_source.dataset.srcset; 3840 } 3841 picture_source.removeAttribute('data-srcset'); 3842 var $waitingThumb = getClosest( picture_source, 'srcset-lazy-animations'); 3843 if ( $waitingThumb != null ) { 3844 picture_img.onload = function(){ 3845 classie.removeClass( $waitingThumb, 'srcset-lazy-animations'); 3846 }; 3847 } 3848 } 3849 } 3850 } else { 3851 if (typeof el.parentNode !== 'undefined') { 3852 var parent_width = el.parentNode.parentElement.clientWidth; 3853 el.sizes = parent_width + 'px'; 3854 classie.addClass(el, 'srcset-sizes-done'); 3855 if (el.dataset.srcset) { 3856 if (SiteParameters.activate_webp && el.dataset.srcsetWebp && ((el.dataset.mime === 'png' && UNCODE.webp_lossless_supported) || (el.dataset.mime === 'jpeg' && UNCODE.webp_lossy_supported))) { 3857 el.srcset = el.dataset.srcsetWebp; 3858 el.removeAttribute('data-srcset-webp'); 3859 } else { 3860 el.srcset = el.dataset.srcset; 3861 } 3862 el.removeAttribute('data-srcset'); 3863 var $waitingThumb = getClosest( el, 'srcset-lazy-animations'); 3864 if ( $waitingThumb != null ) { 3865 el.onload = function(){ 3866 classie.removeClass( $waitingThumb, 'srcset-lazy-animations'); 3867 }; 3868 } 3869 } 3870 } 3871 } 3872 }; 3873 3874 UNCODE.adaptive_srcset = function(container) { 3875 var images = new Array(); 3876 var parentSelector = container ? container[0] : document; 3877 // If 'container' is false, we assume that this is a call on window load 3878 var isLoadingResize = container ? false : true; 3879 var getImages = parentSelector.querySelectorAll('.srcset-async:not(.srcset-fetching)'); 3880 var limit = SiteParameters.dynamic_srcset_bunch_limit ? parseInt(SiteParameters.dynamic_srcset_bunch_limit, 10) : 1; 3881 3882 for (var i = 0; i < getImages.length; i++) { 3883 var imageObj = {}; 3884 var el = getImages[i]; 3885 var missing_breakpoints = el.getAttribute('data-no-bp'); 3886 3887 if (isLoadingResize) { 3888 // Update srcset/sizes attributes 3889 // But skip images that are processed on other events 3890 // (isotope.onLayout for example) to avoid double calls 3891 if (!classie.hasClass(el, 'srcset-on-layout')) { 3892 UNCODE.set_dynamic_srcset_size(el); 3893 } 3894 } 3895 3896 if (missing_breakpoints) { 3897 classie.addClass(el, 'srcset-fetching'); 3898 imageObj.unique = el.getAttribute('data-uniqueid'); 3899 imageObj.url = el.getAttribute('data-guid'); 3900 imageObj.path = el.getAttribute('data-path'); 3901 imageObj.singlew = el.getAttribute('data-singlew'); 3902 imageObj.singleh = el.getAttribute('data-singleh'); 3903 imageObj.origwidth = el.getAttribute('data-width'); 3904 imageObj.origheight = el.getAttribute('data-height'); 3905 imageObj.crop = el.getAttribute('data-crop'); 3906 imageObj.fixed = el.getAttribute('data-fixed') == undefined ? null : el.getAttribute('data-fixed'); 3907 imageObj.missingbp = missing_breakpoints; 3908 3909 images.push(imageObj); 3910 } else { 3911 classie.removeClass(el, 'srcset-async'); 3912 } 3913 } 3914 3915 while (images.length > 0) { 3916 if (images.length >= limit) { 3917 var bunch_images = new Array(); 3918 for (var i = limit - 1; i >= 0; i--) { 3919 bunch_images.push(images[i]); 3920 images.splice(i, 1); 3921 } 3922 UNCODE.adaptive_srcset_async(parentSelector, bunch_images); 3923 } else { 3924 UNCODE.adaptive_srcset_async(parentSelector, images); 3925 break; 3926 } 3927 } 3928 }; 3929 3930 UNCODE.adaptive_srcset_async = function(parentSelector, images) { 3931 var post_data = { 3932 images: JSON.stringify(images), 3933 action: 'regenerate_srcset_async', 3934 resize_quality: SiteParameters.resize_quality, 3935 nonce_srcset_async: SiteParameters.nonce_srcset_async 3936 }; 3937 3938 var xhr = new XMLHttpRequest(); 3939 xhr.open('POST', SiteParameters.ajax_url, true); 3940 xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); 3941 xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); 3942 3943 xhr.onreadystatechange = function() { 3944 if (xhr.readyState == XMLHttpRequest.DONE) { 3945 if (xhr.status == 200 && xhr.responseText) { 3946 var jsonResponse = JSON.parse(xhr.responseText); 3947 3948 if (jsonResponse.success && jsonResponse.data.images) { 3949 var processedImages = jsonResponse.data.images; 3950 3951 for (var i = 0; i < processedImages.length; i++) { 3952 var processedImageID = processedImages[i].id; 3953 var processedImageUniqueID = processedImages[i].unique; 3954 var processedImageisNew = processedImages[i].new_crop === true ? true : false;
3955 var getImage = parentSelector.querySelectorAll('[data-uniqueid="'+processedImageUniqueID+'"]'); 3956 3957 for (var j = 0; j < getImage.length; j++) { 3958 classie.removeClass(getImage[j], 'srcset-async'); 3959 classie.removeClass(getImage[j], 'srcset-fetching'); 3960 classie.addClass(getImage[j], 'srcset-async-done'); 3961 } 3962 3963 if (processedImageisNew && SiteParameters.optimize_shortpixel_image == true) { 3964 UNCODE.process_shortpixel_image(processedImageID); 3965 } 3966 } 3967 } else { 3968 if (SiteParameters.enable_debug == true) { 3969 // This console log is disabled by default 3970 // So nothing is printed in a typical installation 3971 // 3972 // It can be enabled for debugging purposes setting 3973 // the 'uncode_enable_debug_on_js_scripts' filter to true 3974 if (jsonResponse.success == false && jsonResponse.data.message) { 3975 console.log('There was an error: ' + jsonResponse.data.message); 3976 } else { 3977 console.log('There was an error: bad response'); 3978 } 3979 } 3980 } 3981 3982 } else if (xhr.status == 400) { 3983 if (SiteParameters.enable_debug == true) { 3984 // This console log is disabled by default 3985 // So nothing is printed in a typical installation 3986 // 3987 // It can be enabled for debugging purposes setting 3988 // the 'uncode_enable_debug_on_js_scripts' filter to true 3989 console.log('There was an error 400'); 3990 } 3991 } else { 3992 if (SiteParameters.enable_debug == true) { 3993 // This console log is disabled by default 3994 // So nothing is printed in a typical installation 3995 // 3996 // It can be enabled for debugging purposes setting 3997 // the 'uncode_enable_debug_on_js_scripts' filter to true 3998 console.log('Something else other than 200 was returned'); 3999 } 4000 } 4001 } 4002 } 4003 4004 // Serialize our data 4005 var queryString = "", 4006 arrayLength = Object.keys(post_data).length, 4007 arrayCounter = 0; 4008 4009 for (var key in post_data) { 4010 queryString += key + "=" + post_data[key]; 4011 4012 if (arrayCounter < arrayLength - 1) { 4013 queryString += "&"; 4014 } 4015 4016 arrayCounter++; 4017 } 4018 4019 xhr.send(queryString); 4020 }; 4021 4022})(window); 4023 4024/** 4025 * vivus - JavaScript library to make drawing animation on SVG 4026 * @version v0.4.4 4027 * @link https://github.com/maxwellito/vivus 4028 * @license MIT 4029 */ 4030 4031'use strict'; 4032 4033(function () { 4034 4035 'use strict'; 4036 4037/** 4038 * Pathformer 4039 * Beta version 4040 * 4041 * Take any SVG version 1.1 and transform 4042 * child elements to 'path' elements 4043 * 4044 * This code is purely forked from 4045 * https://github.com/Waest/SVGPathConverter 4046 */ 4047 4048/** 4049 * Class constructor 4050 * 4051 * @param {DOM|String} element Dom element of the SVG or id of it 4052 */ 4053function Pathformer(element) { 4054 // Test params 4055 if (typeof element === 'undefined') { 4056 throw new Error('Pathformer [constructor]: "element" parameter is required'); 4057 } 4058 4059 // Set the element 4060 if (element.constructor === String) { 4061 element = document.getElementById(element); 4062 if (!element) { 4063 throw new Error('Pathformer [constructor]: "element" parameter is not related to an existing ID'); 4064 } 4065 } 4066 if (element instanceof window.SVGElement || 4067 element instanceof window.SVGGElement || 4068 /^svg$/i.test(element.nodeName)) { 4069 this.el = element; 4070 } else { 4071 throw new Error('Pathformer [constructor]: "element" parameter must be a string or a SVGelement'); 4072 } 4073 4074 // Start 4075 this.scan(element); 4076} 4077 4078/** 4079 * List of tags which can be transformed 4080 * to path elements 4081 * 4082 * @type {Array} 4083 */ 4084Pathformer.prototype.TYPES = ['line', 'ellipse', 'circle', 'polygon', 'polyline', 'rect']; 4085 4086/** 4087 * List of attribute names which contain 4088 * data. This array list them to check if 4089 * they contain bad values, like percentage. 4090 * 4091 * @type {Array} 4092 */ 4093Pathformer.prototype.ATTR_WATCH = ['cx', 'cy', 'points', 'r', 'rx', 'ry', 'x', 'x1', 'x2', 'y', '
vendor: 12,756 bytes, lines 4093-4494
4093y1', 'y2']; 4094 4095/** 4096 * Finds the elements compatible for transform 4097 * and apply the liked method 4098 * 4099 * @param {object} options Object from the constructor 4100 */ 4101Pathformer.prototype.scan = function (svg) { 4102 var fn, element, pathData, pathDom, 4103 elements = svg.querySelectorAll(this.TYPES.join(',')); 4104 4105 for (var i = 0; i < elements.length; i++) { 4106 element = elements[i]; 4107 fn = this[element.tagName.toLowerCase() + 'ToPath']; 4108 pathData = fn(this.parseAttr(element.attributes)); 4109 pathDom = this.pathMaker(element, pathData); 4110 element.parentNode.replaceChild(pathDom, element); 4111 } 4112}; 4113 4114 4115/** 4116 * Read `line` element to extract and transform 4117 * data, to make it ready for a `path` object. 4118 * 4119 * @param {DOMelement} element Line element to transform 4120 * @return {object} Data for a `path` element 4121 */ 4122Pathformer.prototype.lineToPath = function (element) { 4123 var newElement = {}, 4124 x1 = element.x1 || 0, 4125 y1 = element.y1 || 0, 4126 x2 = element.x2 || 0, 4127 y2 = element.y2 || 0; 4128 4129 newElement.d = 'M' + x1 + ',' + y1 + 'L' + x2 + ',' + y2; 4130 return newElement; 4131}; 4132 4133/** 4134 * Read `rect` element to extract and transform 4135 * data, to make it ready for a `path` object. 4136 * The radius-border is not taken in charge yet. 4137 * (your help is more than welcomed) 4138 * 4139 * @param {DOMelement} element Rect element to transform 4140 * @return {object} Data for a `path` element 4141 */ 4142Pathformer.prototype.rectToPath = function (element) { 4143 var newElement = {}, 4144 x = parseFloat(element.x) || 0, 4145 y = parseFloat(element.y) || 0, 4146 width = parseFloat(element.width) || 0, 4147 height = parseFloat(element.height) || 0; 4148 4149 if (element.rx || element.ry) { 4150 var rx = parseInt(element.rx, 10) || -1, 4151 ry = parseInt(element.ry, 10) || -1; 4152 rx = Math.min(Math.max(rx < 0 ? ry : rx, 0), width/2); 4153 ry = Math.min(Math.max(ry < 0 ? rx : ry, 0), height/2); 4154 4155 newElement.d = 'M ' + (x + rx) + ',' + y + ' ' + 4156 'L ' + (x + width - rx) + ',' + y + ' ' + 4157 'A ' + rx + ',' + ry + ',0,0,1,' + (x + width) + ',' + (y + ry) + ' ' + 4158 'L ' + (x + width) + ',' + (y + height - ry) + ' ' + 4159 'A ' + rx + ',' + ry + ',0,0,1,' + (x + width - rx) + ',' + (y + height) + ' ' + 4160 'L ' + (x + rx) + ',' + (y + height) + ' ' + 4161 'A ' + rx + ',' + ry + ',0,0,1,' + x + ',' + (y + height - ry) + ' ' + 4162 'L ' + x + ',' + (y + ry) + ' ' + 4163 'A ' + rx + ',' + ry + ',0,0,1,' + (x + rx) + ',' + y; 4164 } 4165 else { 4166 newElement.d = 'M' + x + ' ' + y + ' ' + 4167 'L' + (x + width) + ' ' + y + ' ' + 4168 'L' + (x + width) + ' ' + (y + height) + ' ' + 4169 'L' + x + ' ' + (y + height) + ' Z'; 4170 } 4171 return newElement; 4172}; 4173 4174/** 4175 * Read `polyline` element to extract and transform 4176 * data, to make it ready for a `path` object. 4177 * 4178 * @param {DOMelement} element Polyline element to transform 4179 * @return {object} Data for a `path` element 4180 */ 4181Pathformer.prototype.polylineToPath = function (element) { 4182 var newElement = {}, 4183 points = element.points.trim().split(' '), 4184 i, path; 4185 4186 // Reformatting if points are defined without commas 4187 if (element.points.indexOf(',') === -1) { 4188 var formattedPoints = []; 4189 for (i = 0; i < points.length; i+=2) { 4190 formattedPoints.push(points[i] + ',' + points[i+1]); 4191 } 4192 points = formattedPoints; 4193 } 4194 4195 // Generate the path.d value 4196 path = 'M' + points[0]; 4197 for(i = 1; i < points.length; i++) { 4198 if (points[i].indexOf(',') !== -1) { 4199 path += 'L' + points[i]; 4200 } 4201 } 4202 newElement.d = path; 4203 return newElement; 4204}; 4205 4206/** 4207 * Read `polygon` element to extract and transform 4208 * data, to make it ready for a `path` object. 4209 * This method rely on polylineToPath, because the 4210 * logic is similar. The path created is just closed, 4211 * so it needs an 'Z' at the end. 4212 * 4213 * @param {DOMelement} element Polygon element to transform 4214 * @return {object} Data for a `path` element 4215 */ 4216Pathformer.prototype.polygonToPath = function (element) { 4217 var newElement = Pathformer.prototype.polylineToPath(element); 4218 4219 newElement.d += 'Z'; 4220 return newElement; 4221}; 4222 4223/** 4224 * Read `ellipse` element to extract and transform 4225 * data, to make it ready for a `path` object. 4226 * 4227 * @param {DOMelement} element ellipse element to transform 4228 * @return {object} Data for a `path` element 4229 */ 4230Pathformer.prototype.ellipseToPath = function (element) { 4231 var newElement = {}, 4232 rx = parseFloat(element.rx) || 0, 4233 ry = parseFloat(element.ry) || 0, 4234 cx = parseFloat(element.cx) || 0, 4235 cy = parseFloat(element.cy) || 0, 4236 startX = cx - rx, 4237 startY = cy, 4238 endX = parseFloat(cx) + parseFloat(rx), 4239 endY = cy; 4240 4241 newElement.d = 'M' + startX + ',' + startY + 4242 'A' + rx + ',' + ry + ' 0,1,1 ' + endX + ',' + endY + 4243 'A' + rx + ',' + ry + ' 0,1,1 ' + startX + ',' + endY; 4244 return newElement; 4245}; 4246 4247/** 4248 * Read `circle` element to extract and transform 4249 * data, to make it ready for a `path` object. 4250 * 4251 * @param {DOMelement} element Circle element to transform 4252 * @return {object} Data for a `path` element 4253 */ 4254Pathformer.prototype.circleToPath = function (element) { 4255 var newElement = {}, 4256 r = parseFloat(element.r) || 0, 4257 cx = parseFloat(element.cx) || 0, 4258 cy = parseFloat(element.cy) || 0, 4259 startX = cx - r, 4260 startY = cy, 4261 endX = parseFloat(cx) + parseFloat(r), 4262 endY = cy; 4263 4264 newElement.d = 'M' + startX + ',' + startY + 4265 'A' + r + ',' + r + ' 0,1,1 ' + endX + ',' + endY + 4266 'A' + r + ',' + r + ' 0,1,1 ' + startX + ',' + endY; 4267 return newElement; 4268}; 4269 4270/** 4271 * Create `path` elements form original element 4272 * and prepared objects 4273 * 4274 * @param {DOMelement} element Original element to transform 4275 * @param {object} pathData Path data (from `toPath` methods) 4276 * @return {DOMelement} Path element 4277 */ 4278Pathformer.prototype.pathMaker = function (element, pathData) { 4279 var i, attr, pathTag = document.createElementNS('http://www.w3.org/2000/svg','path'); 4280 for(i = 0; i < element.attributes.length; i++) { 4281 attr = element.attributes[i]; 4282 if (this.ATTR_WATCH.indexOf(attr.name) === -1) { 4283 pathTag.setAttribute(attr.name, attr.value); 4284 } 4285 } 4286 for(i in pathData) { 4287 pathTag.setAttribute(i, pathData[i]); 4288 } 4289 return pathTag; 4290}; 4291 4292/** 4293 * Parse attributes of a DOM element to 4294 * get an object of attribute => value 4295 * 4296 * @param {NamedNodeMap} attributes Attributes object from DOM element to parse 4297 * @return {object} Object of attributes 4298 */ 4299Pathformer.prototype.parseAttr = function (element) { 4300 var attr, output = {}; 4301 for (var i = 0; i < element.length; i++) { 4302 attr = element[i]; 4303 // Check if no data attribute contains '%', or the transformation is impossible 4304 if (this.ATTR_WATCH.indexOf(attr.name) !== -1 && attr.value.indexOf('%') !== -1) { 4305 throw new Error('Pathformer [parseAttr]: a SVG shape got values in percentage. This cannot be transformed into \'path\' tags. Please use \'viewBox\'.'); 4306 } 4307 output[attr.name] = attr.value; 4308 } 4309 return output; 4310}; 4311 4312 'use strict'; 4313 4314var setupEnv, requestAnimFrame, cancelAnimFrame, parsePositiveInt; 4315 4316/** 4317 * Vivus 4318 * Beta version 4319 * 4320 * Take any SVG and make the animation 4321 * to give give the impression of live drawing 4322 * 4323 * This in more than just inspired from codrops 4324 * At that point, it's a pure fork. 4325 */ 4326 4327/** 4328 * Class constructor 4329 * option structure 4330 * type: 'delayed'|'sync'|'oneByOne'|'script' (to know if the items must be drawn synchronously or not, default: delayed) 4331 * duration: <int> (in frames) 4332 * start: 'inViewport'|'manual'|'autostart' (start automatically the animation, default: inViewport) 4333 * delay: <int> (delay between the drawing of first and last path) 4334 * dashGap <integer> whitespace extra margin between dashes 4335 * pathTimingFunction <function> timing animation function for each path element of the SVG 4336 * animTimingFunction <function> timing animation function for the complete SVG 4337 * forceRender <boolean> force the browser to re-render all updated path items 4338 * selfDestroy <boolean> removes all extra styling on the SVG, and leaves it as original 4339 * 4340 * The attribute 'type' is by default on 'delayed'. 4341 * - 'delayed' 4342 * all paths are draw at the same time but with a 4343 * little delay between them before start 4344 * - 'sync' 4345 * all path are start and finish at the same time 4346 * - 'oneByOne' 4347 * only one path is draw at the time 4348 * the end of the first one will trigger the draw 4349 * of the next one 4350 * 4351 * All these values can be overwritten individually 4352 * for each path item in the SVG 4353 * The value of frames will always take the advantage of 4354 * the duration value. 4355 * If you fail somewhere, an error will be thrown. 4356 * Good luck. 4357 * 4358 * @constructor 4359 * @this {Vivus} 4360 * @param {DOM|String} element Dom element of the SVG or id of it 4361 * @param {Object} options Options about the animation 4362 * @param {Function} callback Callback for the end of the animation 4363 */ 4364function Vivus (element, options, callback) { 4365 4366 setupEnv(); 4367 4368 // Setup 4369 this.isReady = false; 4370 this.setElement(element, options); 4371 this.setOptions(options); 4372 this.setCallback(callback); 4373 4374 if (this.isReady) { 4375 this.init(); 4376 } 4377} 4378 4379/** 4380 * Timing functions 4381 ************************************** 4382 * 4383 * Default functions to help developers. 4384 * It always take a number as parameter (between 0 to 1) then 4385 * return a number (between 0 and 1) 4386 */ 4387Vivus.LINEAR = function (x) {return x;}; 4388Vivus.EASE = function (x) {return -Math.cos(x * Math.PI) / 2 + 0.5;}; 4389Vivus.EASE_OUT = function (x) {return 1 - Math.pow(1-x, 3);}; 4390Vivus.EASE_IN = function (x) {return Math.pow(x, 3);}; 4391Vivus.EASE_OUT_BOUNCE = function (x) { 4392 var base = -Math.cos(x * (0.5 * Math.PI)) + 1, 4393 rate = Math.pow(base,1.5), 4394 rateR = Math.pow(1 - x, 2), 4395 progress = -Math.abs(Math.cos(rate * (2.5 * Math.PI) )) + 1; 4396 return (1- rateR) + (progress * rateR); 4397}; 4398 4399 4400/** 4401 * Setters 4402 ************************************** 4403 */ 4404 4405/** 4406 * Check and set the element in the instance 4407 * The method will not return anything, but will throw an 4408 * error if the parameter is invalid 4409 * 4410 * @param {DOM|String} element SVG Dom element or id of it 4411 */ 4412Vivus.prototype.setElement = function (element, options) { 4413 var onLoad, self; 4414 4415 // Basic check 4416 if (typeof element === 'undefined') { 4417 throw new Error('Vivus [constructor]: "element" parameter is required'); 4418 } 4419 4420 // Set the element 4421 if (element.constructor === String) { 4422 element = document.getElementById(element); 4423 if (!element) { 4424 throw new Error('Vivus [constructor]: "element" parameter is not related to an existing ID'); 4425 } 4426 } 4427 this.parentEl = element; 4428 4429 // Load the SVG with XMLHttpRequest and extract the SVG 4430 if (options && options.file) { 4431 var self = this; 4432 onLoad = function (e) { 4433 var domSandbox = document.createElement('div'); 4434 domSandbox.innerHTML = this.responseText; 4435 4436 var svgTag = domSandbox.querySelector('svg'); 4437 if (!svgTag) { 4438 throw new Error('Vivus [load]: Cannot find the SVG in the loaded file : ' + options.file); 4439 } 4440 4441 self.el = svgTag 4442 self.el.setAttribute('width', '100%'); 4443 self.el.setAttribute('height', '100%'); 4444 self.parentEl.appendChild(self.el) 4445 self.isReady = true; 4446 self.init(); 4447 self = null; 4448 } 4449 4450 var oReq = new window.XMLHttpRequest(); 4451 oReq.addEventListener('load', onLoad); 4452 oReq.open('GET', options.file); 4453 oReq.send(); 4454 return; 4455 } 4456 4457 switch (element.constructor) { 4458 case window.SVGSVGElement: 4459 case window.SVGElement: 4460 case window.SVGGElement: 4461 this.el = element; 4462 this.isReady = true; 4463 break; 4464 4465 case window.HTMLObjectElement: 4466 self = this; 4467 onLoad = function (e) { 4468 if (self.isReady) { 4469 return; 4470 } 4471 self.el = element.contentDocument && element.contentDocument.querySelector('svg'); 4472 if (!self.el && e) { 4473 throw new Error('Vivus [constructor]: object loaded does not contain any SVG'); 4474 } 4475 else if (self.el) { 4476 if (element.getAttribute('built-by-vivus')) { 4477 self.parentEl.insertBefore(self.el, element); 4478 self.parentEl.removeChild(element); 4479 self.el.setAttribute('width', '100%'); 4480 self.el.setAttribute('height', '100%'); 4481 } 4482 self.isReady = true; 4483 self.init(); 4484 self = null; 4485 } 4486 }; 4487 4488 if (!onLoad()) { 4489 element.addEventListener('load', onLoad); 4490 } 4491 break; 4492 4493 default: 4494 throw new Error('Vivus [constructor]: "element" parameter is not val
4494id (or miss the "file" attribute)'); 4495 } 4496}; 4497 4498/** 4499 * Set up user option to the instance 4500 * The method will not return anything, but will throw an 4501 * error if the parameter is invalid 4502 * 4503 * @param {object} options Object from the constructor 4504 */ 4505Vivus.prototype.setOptions = function (options) { 4506 var allowedTypes = ['delayed', 'sync', 'async', 'nsync', 'oneByOne', 'scenario', 'scenario-sync']; 4507 var allowedStarts = ['inViewport', 'manual', 'autostart']; 4508 4509 // Basic check 4510 if (options !== undefined && options.constructor !== Object) { 4511 throw new Error('Vivus [constructor]: "options" parameter must be an object'); 4512 } 4513 else { 4514 options = options || {}; 4515 } 4516 4517 // Set the animation type 4518 if (options.type && allowedTypes.indexOf(options.type) === -1) { 4519 throw new Error('Vivus [constructor]: ' + options.type + ' is not an existing animation `type`'); 4520 } 4521 else { 4522 this.type = options.type || allowedTypes[0]; 4523 } 4524 4525 // Set the start type 4526 if (options.start && allowedStarts.indexOf(options.start) === -1) { 4527 throw new Error('Vivus [constructor]: ' + options.start + ' is not an existing `start` option'); 4528 } 4529 else { 4530 this.start = options.start || allowedStarts[0]; 4531 } 4532 4533 this.isIE = (window.navigator.userAgent.indexOf('MSIE') !== -1 || window.navigator.userAgent.indexOf('Trident/') !== -1 || window.navigator.userAgent.indexOf('Edge/') !== -1 ); 4534 this.duration = parsePositiveInt(options.duration, 120); 4535 this.delay = parsePositiveInt(options.delay, null); 4536 //Uncode addition 4537 this.delayStart = parsePositiveInt(options.delayStart, null); 4538 //#END 4539 this.dashGap = parsePositiveInt(options.dashGap, 1); 4540 this.forceRender = options.hasOwnProperty('forceRender') ? !!options.forceRender : this.isIE; 4541 this.reverseStack = !!options.reverseStack; 4542 this.selfDestroy = !!options.selfDestroy; 4543 this.onReady = options.onReady; 4544 this.map = []; 4545 this.frameLength = this.currentFrame = this.delayUnit = this.speed = this.handle = null; 4546 4547 this.ignoreInvisible = options.hasOwnProperty('ignoreInvisible') ? !!options.ignoreInvisible : false; 4548 4549 this.animTimingFunction = options.animTimingFunction || Vivus.LINEAR; 4550 this.pathTimingFunction = options.pathTimingFunction || Vivus.LINEAR; 4551 4552 if (this.delay >= this.duration) { 4553 throw new Error('Vivus [constructor]: delay must be shorter than duration'); 4554 } 4555}; 4556 4557/** 4558 * Set up callback to the instance 4559 * The method will not return enything, but will throw an 4560 * error if the parameter is invalid 4561 * 4562 * @param {Function} callback Callback for the animation end 4563 */ 4564Vivus.prototype.setCallback = function (callback) { 4565 // Basic check 4566 if (!!callback && callback.constructor !== Function) { 4567 throw new Error('Vivus [constructor]: "callback" parameter must be a function'); 4568 } 4569 this.callback = callback || function () {}; 4570}; 4571 4572 4573/** 4574 * Core 4575 ************************************** 4576 */ 4577 4578/** 4579 * Map the svg, path by path. 4580 * The method return nothing, it just fill the 4581 * `map` array. Each item in this array represent 4582 * a path element from the SVG, with informations for 4583 * the animation. 4584 * 4585 * ``` 4586 * [ 4587 * { 4588 * el: <DOMobj> the path element 4589 * length: <number> length of the path line 4590 * startAt: <number> time start of the path animation (in frames) 4591 * duration: <number> path animation duration (in frames) 4592 * }, 4593 * ... 4594 * ] 4595 * ``` 4596 * 4597 */ 4598Vivus.prototype.mapping = function () { 4599 var i, paths, path, pAttrs, pathObj, totalLength, lengthMeter, timePoint; 4600 timePoint = totalLength = lengthMeter = 0; 4601 paths = this.el.querySelectorAll('path'); 4602 4603 for (i = 0; i < paths.length; i++) { 4604 path = paths[i]; 4605 if (this.isInvisible(path)) { 4606 continue; 4607 } 4608 pathObj = { 4609 el: path, 4610 length: Math.ceil(path.getTotalLength()) 4611 }; 4612 // Test if the path length is correct 4613 if (isNaN(pathObj.length)) { 4614 if (window.console && console.warn) { 4615 console.warn('Vivus [mapping]: cannot retrieve a path element length', path); 4616 } 4617 continue; 4618 } 4619 this.map.push(pathObj); 4620 path.style.strokeDasharray = pathObj.length + ' ' + (pathObj.length + this.dashGap * 2); 4621 path.style.strokeDashoffset = pathObj.length + this.dashGap; 4622 pathObj.length += this.dashGap; 4623 totalLength += pathObj.length; 4624 4625 this.renderPath(i); 4626 } 4627 4628 totalLength = totalLength === 0 ? 1 : totalLength; 4629 this.delay = this.delay === null ? this.duration / 3 : this.delay; 4630 this.delayUnit = this.delay / (paths.length > 1 ? paths.length - 1 : 1); 4631 4632 // Reverse stack if asked 4633 if (this.reverseStack) { 4634 this.map.reverse(); 4635 } 4636 4637 for (i = 0; i < this.map.length; i++) { 4638 pathObj = this.map[i]; 4639 4640 switch (this.type) { 4641 case 'delayed': 4642 pathObj.startAt = this.delayUnit * i; 4643 pathObj.duration = this.duration - this.delay; 4644 break; 4645 4646 case 'oneByOne': 4647 pathObj.startAt = lengthMeter / totalLength * this.duration; 4648 pathObj.duration = pathObj.length / totalLength * this.duration; 4649 break; 4650 4651 case 'sync': 4652 case 'async': 4653 case 'nsync': 4654 pathObj.startAt = 0; 4655 pathObj.duration = this.duration; 4656 break; 4657 4658 case 'scenario-sync': 4659 path = pathObj.el; 4660 pAttrs = this.parseAttr(path); 4661 pathObj.startAt = timePoint + (parsePositiveInt(pAttrs['data-delay'], this.delayUnit) || 0); 4662 pathObj.duration = parsePositiveInt(pAttrs['data-duration'], this.duration); 4663 timePoint = pAttrs['data-async'] !== undefined ? pathObj.startAt : pathObj.startAt + pathObj.duration; 4664 this.frameLength = Math.max(this.frameLength, (pathObj.startAt + pathObj.duration)); 4665 break; 4666 4667 case 'scenario': 4668 path = pathObj.el; 4669 pAttrs = this.parseAttr(path); 4670 pathObj.startAt = parsePositiveInt(pAttrs['data-start'], this.delayUnit) || 0; 4671 pathObj.duration = parsePositiveInt(pAttrs['data-duration'], this.duration); 4672 this.frameLength = Math.max(this.frameLength, (pathObj.startAt + pathObj.duration)); 4673 break; 4674 } 4675 lengthMeter += pathObj.length; 4676 this.frameLength = this.frameLength || this.duration; 4677 } 4678}; 4679 4680/** 4681 * Interval method to draw the SVG from current 4682 * position of the animation. It update the value of 4683 * `currentFrame` and re-trace the SVG. 4684 * 4685 * It use this.handle to store the requestAnimationFrame 4686 * and clear it one the animation is stopped. So this 4687 * attribute can be used to know if the animation is 4688 * playing. 4689 * 4690 * Once the animation at the end, this method will 4691 * trigger the Vivus callback. 4692 * 4693 */ 4694Vivus.prototype.drawer = function () { 4695 var self = this; 4696 this.currentFrame += this.speed; 4697 4698 if (this.currentFrame <= 0) { 4699 this.stop(); 4700 this.reset(); 4701 } else if (this.currentFrame >= this.frameLength) { 4702 this.stop(); 4703 this.currentFrame = this.frameLength; 4704 this.trace();
vendor: 5,092 bytes, lines 4705-4891
4705 if (this.selfDestroy) { 4706 this.destroy(); 4707 } 4708 } else { 4709 this.trace(); 4710 this.handle = requestAnimFrame(function () { 4711 self.drawer(); 4712 }); 4713 return; 4714 } 4715 4716 this.callback(this); 4717 if (this.instanceCallback) { 4718 this.instanceCallback(this); 4719 this.instanceCallback = null; 4720 } 4721}; 4722 4723/** 4724 * Draw the SVG at the current instant from the 4725 * `currentFrame` value. Here is where most of the magic is. 4726 * The trick is to use the `strokeDashoffset` style property. 4727 * 4728 * For optimisation reasons, a new property called `progress` 4729 * is added in each item of `map`. This one contain the current 4730 * progress of the path element. Only if the new value is different 4731 * the new value will be applied to the DOM element. This 4732 * method save a lot of resources to re-render the SVG. And could 4733 * be improved if the animation couldn't be played forward. 4734 * 4735 */ 4736Vivus.prototype.trace = function () { 4737 var i, progress, path, currentFrame; 4738 currentFrame = this.animTimingFunction(this.currentFrame / this.frameLength) * this.frameLength; 4739 for (i = 0; i < this.map.length; i++) { 4740 path = this.map[i]; 4741 progress = (currentFrame - path.startAt) / path.duration; 4742 progress = this.pathTimingFunction(Math.max(0, Math.min(1, progress))); 4743 if (path.progress !== progress) { 4744 path.progress = progress; 4745 path.el.style.strokeDashoffset = Math.floor(path.length * (1 - progress)); 4746 this.renderPath(i); 4747 } 4748 } 4749}; 4750 4751/** 4752 * Method forcing the browser to re-render a path element 4753 * from it's index in the map. Depending on the `forceRender` 4754 * value. 4755 * The trick is to replace the path element by it's clone. 4756 * This practice is not recommended because it's asking more 4757 * ressources, too much DOM manupulation.. 4758 * but it's the only way to let the magic happen on IE. 4759 * By default, this fallback is only applied on IE. 4760 * 4761 * @param {Number} index Path index 4762 */ 4763Vivus.prototype.renderPath = function (index) { 4764 if (this.forceRender && this.map && this.map[index]) { 4765 var pathObj = this.map[index], 4766 newPath = pathObj.el.cloneNode(true); 4767 pathObj.el.parentNode.replaceChild(newPath, pathObj.el); 4768 pathObj.el = newPath; 4769 } 4770}; 4771 4772/** 4773 * When the SVG object is loaded and ready, 4774 * this method will continue the initialisation. 4775 * 4776 * This this mainly due to the case of passing an 4777 * object tag in the constructor. It will wait 4778 * the end of the loading to initialise. 4779 * 4780 */ 4781Vivus.prototype.init = function () { 4782 // Set object variables 4783 this.frameLength = 0; 4784 this.currentFrame = 0; 4785 this.map = []; 4786 4787 // Start 4788 new Pathformer(this.el); 4789 this.mapping(); 4790 this.starter(); 4791 4792 if (this.onReady) { 4793 this.onReady(this); 4794 } 4795}; 4796 4797/** 4798 * Trigger to start of the animation. 4799 * Depending on the `start` value, a different script 4800 * will be applied. 4801 * 4802 * If the `start` value is not valid, an error will be thrown. 4803 * Even if technically, this is impossible. 4804 * 4805 */ 4806Vivus.prototype.starter = function () { 4807 switch (this.start) { 4808 case 'manual': 4809 return; 4810 4811 case 'autostart': 4812 this.play(); 4813 break; 4814 4815 case 'inViewport': 4816 var self = this, 4817 listener = function () { 4818 if (self.isInViewport(self.parentEl, 1)) { 4819 self.play(); 4820 window.removeEventListener('scroll', listener); 4821 //Uncode addition 4822 window.removeEventListener('fp-slide-changed', listener); 4823 window.removeEventListener('fp-slide-scroll', listener); 4824 //#END 4825 } 4826 }; 4827 window.addEventListener('scroll', listener); 4828 //Uncode addition 4829 window.addEventListener('fp-slide-changed', listener); 4830 window.addEventListener('fp-slide-scroll', listener); 4831 //#END 4832 listener(); 4833 break; 4834 } 4835}; 4836 4837 4838/** 4839 * Controls 4840 ************************************** 4841 */ 4842 4843/** 4844 * Get the current status of the animation between 4845 * three different states: 'start', 'progress', 'end'. 4846 * @return {string} Instance status 4847 */ 4848Vivus.prototype.getStatus = function () { 4849 return this.currentFrame === 0 ? 'start' : this.currentFrame === this.frameLength ? 'end' : 'progress'; 4850}; 4851 4852/** 4853 * Reset the instance to the initial state : undraw 4854 * Be careful, it just reset the animation, if you're 4855 * playing the animation, this won't stop it. But just 4856 * make it start from start. 4857 * 4858 */ 4859Vivus.prototype.reset = function () { 4860 return this.setFrameProgress(0); 4861}; 4862 4863/** 4864 * Set the instance to the final state : drawn 4865 * Be careful, it just set the animation, if you're 4866 * playing the animation on rewind, this won't stop it. 4867 * But just make it start from the end. 4868 * 4869 */ 4870Vivus.prototype.finish = function () { 4871 return this.setFrameProgress(1); 4872}; 4873 4874/** 4875 * Set the level of progress of the drawing. 4876 * 4877 * @param {number} progress Level of progress to set 4878 */ 4879Vivus.prototype.setFrameProgress = function (progress) { 4880 progress = Math.min(1, Math.max(0, progress)); 4881 this.currentFrame = Math.round(this.frameLength * progress); 4882 this.trace(); 4883 return this; 4884}; 4885 4886/** 4887 * Play the animation at the desired speed. 4888 * Speed must be a valid number (no zero). 4889 * By default, the speed value is 1. 4890 * But a negative value is accepted to go forward. 4891 *
4892 * And works with float too. 4893 * But don't forget we are in JavaScript, se be nice 4894 * with him and give him a 1/2^x value. 4895 * 4896 * @param {number} speed Animation speed [optional] 4897 */ 4898Vivus.prototype.play = function (speed, callback) { 4899 this.instanceCallback = null; 4900 4901 if (speed && typeof speed === 'function') { 4902 this.instanceCallback = speed; // first parameter is actually the callback function 4903 speed = null; 4904 } 4905 else if (speed && typeof speed !== 'number') { 4906 throw new Error('Vivus [play]: invalid speed'); 4907 } 4908 // if the first parameter wasn't the callback, check if the seconds was 4909 if (callback && typeof(callback) === 'function' && !this.instanceCallback) { 4910 this.instanceCallback = callback; 4911 } 4912 4913 4914 this.speed = speed || 1; 4915 //Uncode addition 4916 if (!this.handle) { 4917 var $this = this, 4918 delay = (this.delayStart != null) ? this.delayStart : 0; 4919 setTimeout(function() { 4920 $this.drawer(); 4921 }, delay); 4922 } 4923 //#END 4924 return this; 4925}; 4926 4927/** 4928 * Stop the current animation, if on progress. 4929 * Should not trigger any error. 4930 * 4931 */ 4932Vivus.prototype.stop = function () { 4933 if (this.handle) { 4934 cancelAnimFrame(this.handle); 4935 this.handle = null; 4936 } 4937 return this; 4938}; 4939 4940/** 4941 * Destroy the instance. 4942 * Remove all bad styling attributes on all 4943 * path tags 4944 * 4945 */ 4946Vivus.prototype.destroy = function () { 4947 this.stop(); 4948 var i, path; 4949 for (i = 0; i < this.map.length; i++) { 4950 path = this.map[i]; 4951 path.el.style.strokeDashoffset = null; 4952 path.el.style.strokeDasharray = null; 4953 this.renderPath(i); 4954 } 4955}; 4956 4957 4958/** 4959 * Utils methods 4960 * include methods from Codrops 4961 ************************************** 4962 */ 4963 4964/** 4965 * Method to best guess if a path should added into 4966 * the animation or not. 4967 * 4968 * 1. Use the `data-vivus-ignore` attribute if set 4969 * 2. Check if the instance must ignore invisible paths 4970 * 3. Check if the path is visible 4971 * 4972 * For now the visibility checking is unstable. 4973 * It will be used for a beta phase. 4974 * 4975 * Other improvments are planned. Like detecting 4976 * is the path got a stroke or a valid opacity. 4977 */ 4978Vivus.prototype.isInvisible = function (el) { 4979 var rect, 4980 ignoreAttr = el.getAttribute('data-ignore'); 4981 4982 if (ignoreAttr !== null) { 4983 return ignoreAttr !== 'false'; 4984 } 4985 4986 if (this.ignoreInvisible) { 4987 rect = el.getBoundingClientRect(); 4988 return !rect.width && !rect.height; 4989 } 4990 else { 4991 return false; 4992 } 4993}; 4994 4995/** 4996 * Parse attributes of a DOM element to 4997 * get an object of {attributeName => attributeValue} 4998 * 4999 * @param {object} element DOM element to parse 5000 * @return {object} Object of attributes 5001 */ 5002Vivus.prototype.parseAttr = function (element) { 5003 var attr, output = {}; 5004 if (element && element.attributes) { 5005 for (var i = 0; i < element.attributes.length; i++) { 5006 attr = element.attributes[i]; 5007 output[attr.name] = attr.value; 5008 } 5009 } 5010 return output; 5011}; 5012 5013/** 5014 * Reply if an element is in the page viewport 5015 * 5016 * @param {object} el Element to observe 5017 * @param {number} h Percentage of height 5018 * @return {boolean} 5019 */ 5020Vivus.prototype.isInViewport = function (el, h) { 5021 var scrolled = this.scrollY(), 5022 viewed = scrolled + this.getViewportH(), 5023 elBCR = el.getBoundingClientRect(), 5024 elHeight = elBCR.height, 5025 elTop = scrolled + elBCR.top, 5026 elBottom = elTop + elHeight; 5027 5028 // if 0, the element is considered in the viewport as soon as it enters. 5029 // if 1, the element is considered in the viewport only when it's fully inside 5030 // value in percentage (1 >= h >= 0) 5031 h = h || 0; 5032 5033 return (elTop + elHeight * h) <= viewed && (elBottom) >= scrolled; 5034}; 5035 5036 5037/** 5038 * Get the viewport height in pixels 5039 * 5040 * @return {integer} Viewport height 5041 */ 5042Vivus.prototype.getViewportH = function () { 5043 var client = this.docElem.clientHeight, 5044 inner = window.innerHeight; 5045 5046 if (client < inner) { 5047 return inner; 5048 } 5049 else { 5050 return client; 5051 } 5052}; 5053 5054/** 5055 * Get the page Y offset 5056 * 5057 * @return {integer} Page Y offset 5058 */ 5059Vivus.prototype.scrollY = function () { 5060 return window.pageYOffset || this.docElem.scrollTop; 5061}; 5062 5063setupEnv = function () { 5064 5065 if (Vivus.prototype.docElem) { 5066 return; 5067 } 5068 5069 /** 5070 * Alias for document element 5071 * 5072 * @type {DOMelement} 5073 */ 5074 Vivus.prototype.docElem = window.document.documentElement; 5075 5076 /** 5077 * Alias for `requestAnimationFrame` or 5078 * `setTimeout` function for deprecated browsers. 5079 * 5080 */ 5081 requestAnimFrame = (function () { 5082 return ( 5083 window.requestAnimationFrame || 5084 window.webkitRequestAnimationFrame || 5085 window.mozRequestAnimationFrame || 5086 window.oRequestAnimationFrame || 5087 window.msRequestAnimationFrame || 5088 function(/* function */ callback){ 5089 return window.setTimeout(callback, 1000 / 60); 5090 } 5091 ); 5092 })(); 5093 5094 /** 5095 * Alias for `cancelAnimationFrame` or 5096 * `cancelTimeout` function for deprecated browsers. 5097 * 5098 */ 5099 cancelAnimFrame = (function () { 5100 return ( 5101 window.cancelAnimationFrame || 5102 window.webkitCancelAnimationFrame || 5103 window.mozCancelAnimationFrame || 5104 window.oCancelAnimationFrame || 5105 window.msCancelAnimationFrame || 5106 function(id){ 5107 return window.clearTimeout(id); 5108 } 5109 ); 5110 })(); 5111}; 5112 5113/** 5114 * Parse string to integer. 5115 * If the number is not positive or null 5116 * the method will return the default value 5117 * or 0 if undefined 5118 * 5119 * @param {string} value String to parse 5120 * @param {*}
5120 defaultValue Value to return if the result parsed is invalid 5121 * @return {number} 5122 * 5123 */ 5124parsePositiveInt = function (value, defaultValue) { 5125 var output = parseInt(value, 10); 5126 return (output >= 0) ? output : defaultValue; 5127}; 5128 5129 5130 if (typeof define === 'function' && define.amd) { 5131 // AMD. Register as an anonymous module. 5132 define([], function() { 5133 return Vivus; 5134 }); 5135 } else if (typeof exports === 'object') { 5136 // Node. Does not work with strict CommonJS, but 5137 // only CommonJS-like environments that support module.exports, 5138 // like Node. 5139 module.exports = Vivus; 5140 } else { 5141 // Browser globals 5142 window.Vivus = Vivus; 5143 } 5144 5145}()); 5146 5147(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); 5148iNoBounce.disable(); 5149 5150/* 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)}} 5151function 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)})}; 5152function 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,
5152window.Promise.race=x,window.Promise.all=w,window.Promise.prototype.then=n.prototype.c,window.Promise.prototype["catch"]=n.prototype.g);}()); 5153 5154(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;"; 5155this.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)} 5156function 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} 5157function 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(" ")} 5158B.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)}, 5159b)}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(""+ 5160n+"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();
5160A(e,function(a){f=a;v()});u(e, 5161L(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.