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 17var uaInfo = { 18 ua: '', 19 is: function(t) { 20 return RegExp(t, "i").test(uaInfo.ua); 21 }, 22 version: function(p, n) { 23 n = n.replace(".", "_"); 24 var i = n.indexOf('_'), 25 ver = ""; 26 while (i > 0) { 27 ver += " " + p + n.substring(0, i); 28 i = n.indexOf('_', i + 1); 29 } 30 ver += " " + p + n; 31 return ver; 32 }, 33 getBrowser: function() { 34 var g = 'gecko', 35 w = 'webkit', 36 c = 'chrome', 37 f = 'firefox', 38 s = 'safari', 39 o = 'opera', 40 a = 'android', 41 bb = 'blackberry', 42 dv = 'device_', 43 ua = uaInfo.ua, 44 is = uaInfo.is; 45 return [ 46 (!(/opera|webtv/i.test(ua)) && /msie\s(\d+)/.test(ua)) ? ('ie ie' + (/trident\/4\.0/.test(ua) ? '8' : RegExp.$1)) 47 : is('edge\/') ? 'edge ie' + (/edge\/(\d+)\.(\d+)/.test(ua) ? RegExp.$1 + ' ie' + RegExp.$1 + '_' + RegExp.$2 : '') // IE Edge 48 : is('trident\/') ? 'ie ie'+ (/trident\/.+rv:(\d+)/i.test(ua) ? RegExp.$1 : '') //ie11+ 49 : is('firefox/') ? g + " " + f + (/firefox\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) ? ' ' + f + RegExp.$2 + ' ' + f + RegExp.$2 + "_" + RegExp.$4 : '') 50 : is('gecko/') ? g 51 : 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 : '')) 52 : is('konqueror') ? 'konqueror' 53 : 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 54 : 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 55 : is('chrome') ? w + ' ' + c + (/chrome\/((\d+)(\.(\d+))(\.\d+)*)/.test(ua) ? ' ' + c + RegExp.$2 + ((RegExp.$4 > 0) ? ' ' + c + RegExp.$2 + "_" + RegExp.$4 : '') : '') 56 : is('iron') ? w + ' iron' 57 : 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 58 : is('mozilla/') ? g : '' 59 ]; 60 }, 61 getPlatform : function() { 62 var wp = 'winphone', 63 a = 'android', 64 bb = 'blackberry', 65 dv = 'device_', 66 67 ua = uaInfo.ua, 68 version = uaInfo.version, 69 is = uaInfo.is; 70 71 return [ 72 is('j2me') ? 'j2me' 73 :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 74 :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 75 :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 76 :is('ipad|ipod|iphone') ? ( 77 (/CPU( iPhone)? OS (\d+[_|\.]\d+([_|\.]\d+)*)/i.test(ua) ? 'ios' + version('ios', RegExp.$2) : '') + ' ' + (/(ip(ad|od|hone))/gi.test(ua) ? RegExp.$1 : "")) //'iphone' 78 //:is('ipod')?'ipod' 79 //:is('ipad')?'ipad' 80 :is('playbook') ? 'playbook' 81 :is('kindle|silk') ? 'kindle' 82 :is('playbook') ? 'playbook' 83 :is('mac') ? 'mac' + (/mac os x ((\d+)[.|_](\d+))/.test(ua) ? (' mac'
83+ (RegExp.$2) + ' mac' + (RegExp.$1).replace('.', "_")) : '') 84 :is('win') ? 'win' + (is('windows nt 10.0') ? ' win10' 85 :is('windows nt 6.3') ? ' win8_1' 86 :is('windows nt 6.2') ? ' win8' 87 :is('windows nt 6.1') ? ' win7' 88 :is('windows nt 6.0') ? ' vista' 89 :is('windows nt 5.2') || is('windows nt 5.1') ? ' win_xp' 90 :is('windows nt 5.0') ? ' win_2k' 91 :is('windows nt 4.0') || is('WinNT4.0') ? ' win_nt' : '') 92 :is('freebsd') ? 'freebsd' 93 :is('x11|linux') ? 'linux' : '' 94 ]; 95 }, 96 getMobile: function() { 97 var is = uaInfo.is; 98 return [ 99 is("android|mobi|mobile|j2me|iphone|ipod|ipad|blackberry|playbook|kindle|silk") ? 'mobile' : '' 100 ]; 101 }, 102 getIpadApp: function() { 103 var is = uaInfo.is; 104 return [ 105 (is('ipad|iphone|ipod') && !is('safari')) ? 'ipad_app' : '' 106 ]; 107 }, 108 getLang: function() { 109 var ua = uaInfo.ua; 110 return [/[; |\[](([a-z]{2})(\-[a-z]{2})?)[)|;|\]]/i.test(ua) ? ('lang_' + RegExp.$2).replace("-", "_") + (RegExp.$3 != '' ? (' ' + 'lang_' + RegExp.$1).replace("-", "_") : '') : '']; 111 } 112} 113var screenInfo = { 114 width: (window.outerWidth || document.documentElement.clientWidth) - 15, 115 height: window.outerHeight || document.documentElement.clientHeight, 116 screens: [0, 768, 980, 1200], 117 screenSize: function() { 118 screenInfo.width = (window.outerWidth || document.documentElement.clientWidth) - 15; 119 screenInfo.height = window.outerHeight || document.documentElement.clientHeight; 120 var screens = screenInfo.screens, 121 i = screens.length, 122 arr = [], 123 maxw, 124 minw; 125 while (i--) { 126 if (screenInfo.width >= screens[i]) { 127 if (i) { 128 arr.push("minw_" + screens[(i)]); 129 } 130 if (i <= 2) { 131 arr.push("maxw_" + (screens[(i) + 1] - 1)); 132 } 133 break; 134 } 135 } 136 return arr; 137 }, 138 getOrientation: function() { 139 return screenInfo.width < screenInfo.height ? ["orientation_portrait"] : ["orientation_landscape"]; 140 }, 141 getInfo: function() { 142 var arr = []; 143 arr = arr.concat(screenInfo.screenSize()); 144 arr = arr.concat(screenInfo.getOrientation()); 145 return arr; 146 }, 147 getPixelRatio: function() { 148 var arr = [], 149 pixelRatio = window.devicePixelRatio ? window.devicePixelRatio : 1; 150 if (pixelRatio > 1) { 151 arr.push('retina_' + parseInt(pixelRatio) + 'x'); 152 arr.push('hidpi'); 153 } else { 154 arr.push('no-hidpi'); 155 } 156 return arr; 157 } 158} 159var dataUriInfo = { 160 data: new Image(), 161 div: document.createElement("div"), 162 isIeLessThan9: false, 163 getImg: function() { 164 dataUriInfo.data.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; 165 dataUriInfo.div.innerHTML = "<!--[if lt IE 9]><i></i><![endif]-->"; 166 dataUriInfo.isIeLessThan9 = dataUriInfo.div.getElementsByTagName("i").length == 1; 167 return dataUriInfo.data; 168 }, 169 checkSupport: function() { 170 if (dataUriInfo.data.width != 1 || dataUriInfo.data.height != 1 || dataUriInfo.isIeLessThan9) { 171 return ["no-datauri"]; 172 } else { 173 return ["datauri"]; 174 } 175 } 176} 177 178function css_browser_selector(u, ns) { 179 var html = document.documentElement, 180 b = [] 181 ns = ns ? ns : ""; 182 /* ua */ 183 uaInfo.ua = u.toLowerCase(); 184 var browser = uaInfo.getBrowser(); 185 if (browser == 'gecko') browser = (!(window.ActiveXObject) && "ActiveXObject" in window) ? 'ie ie11' : browser; 186 var pattTouch = /no-touch/g; 187 if (pattTouch.test(html.className)) b = b.concat('no-touch'); 188 else b = b.concat('touch'); 189 var pattAdmin = /admin-mode/g; 190 if (pattAdmin.test(html.className)) b = b.concat('admin-mode'); 191 b = b.concat(browser); 192 b = b.concat(uaInfo.getPlatform()); 193 b = b.concat(uaInfo.getMobile()); 194 b = b.concat(uaInfo.getIpadApp()); 195 b = b.concat(uaInfo.getLang()); 196 /* js */ 197 b = b.concat(['js']); 198 /* pixel ratio */ 199 b = b.concat(screenInfo.getPixelRatio()); 200 /* screen */ 201 b = b.concat(screenInfo.getInfo()); 202 var updateScreen = function() { 203 html.className = html.className.replace(/ ?orientation_\w+/g, "").replace(/ [min|max|cl]+[w|h]_\d+/g, ""); 204 html.className = html.className + ' ' + screenInfo.getInfo().join(' '); 205 } 206 window.addEventListener('resize', updateScreen); 207 window.addEventListener('orientationchange', updateScreen); 208 /* dataURI */ 209 var data = dataUriInfo.getImg(); 210 data.onload = data.onerror = function() { 211 html.className += ' ' + dataUriInfo.checkSupport().join(' '); 212 }
213 /* removendo itens invalidos do array */ 214 b = b.filter(function(e) { 215 return e; 216 }); 217 /* prefixo do namespace */ 218 b[0] = ns ? ns + b[0] : b[0]; 219 html.className = b.join(' ' + ns); 220 return html.className; 221 } 222 // define css_browser_selector_ns before loading this script to assign a namespace 223var css_browser_selector_ns = css_browser_selector_ns || ""; 224// init 225css_browser_selector(navigator.userAgent, css_browser_selector_ns); 226/** 227 * skip-link-focus-fix.js 228 * 229 * Helps with accessibility for keyboard only users. 230 * 231 * Learn more: https://github.com/Automattic/_s/pull/136 232 */ 233(function() { 234 var is_webkit = navigator.userAgent.toLowerCase().indexOf('webkit') > -1, 235 is_opera = navigator.userAgent.toLowerCase().indexOf('opera') > -1, 236 is_ie = navigator.userAgent.toLowerCase().indexOf('msie') > -1; 237 if ((is_webkit || is_opera || is_ie) && document.getElementById && window.addEventListener) { 238 window.addEventListener('hashchange', function() { 239 var id = location.hash.substring(1), 240 element; 241 if (!(/^[A-z0-9_-]+$/.test(id))) { 242 return; 243 } 244 element = document.getElementById(id); 245 if (element) { 246 if (!(/^(?:a|select|input|button|textarea)$/i.test(element.tagName))) { 247 element.tabIndex = -1; 248 } 249 element.focus(); 250 } 251 }, false); 252 } 253})(); 254// Polyfill for creating CustomEvents on IE9/10/11 255// code pulled from: 256// https://github.com/d4tocchini/customevent-polyfill 257// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill 258try { 259 new CustomEvent("test"); 260} catch (e) { 261 var CustomEvent = function(event, params) { 262 var evt; 263 params = params || { 264 bubbles: false, 265 cancelable: false, 266 detail: undefined 267 }; 268 evt = document.createEvent("CustomEvent"); 269 evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); 270 return evt; 271 }; 272 CustomEvent.prototype = window.Event.prototype; 273 window.CustomEvent = CustomEvent; // expose definition to window 274} 275// Evento - v1.0.0 276// by Erik Royall <[email protected]> (http://erikroyall.github.io) 277// Dual licensed under MIT and GPL 278// Array.prototype.indexOf shim 279// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf 280Array.prototype.indexOf || (Array.prototype.indexOf = function(n) { 281 "use strict"; 282 if (null == this) throw new TypeError; 283 var t, e, o = Object(this), 284 r = o.length >>> 0; 285 if (0 === r) return -1; 286 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; 287 for (e = t >= 0 ? t : Math.max(r - Math.abs(t), 0); r > e; e++) 288 if (e in o && o[e] === n) return e; 289 return -1 290}); 291var evento = function(n) { 292 var t, e, o, r = n, 293 i = r.document, 294 f = {}; 295 return t = function() { 296 return "function" == typeof i.addEventListener ? function(n, t, e) { 297 n.addEventListener(t, e, !1), f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t].push(e) 298 } : "function" == typeof i.attachEvent ? function(n, t, e) { 299 n.attachEvent(t, e), f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t].push(e) 300 } : function(n, t, e) { 301 n["on" + t] = e, f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t].push(e) 302 } 303 }(), e = function() { 304 return "function" == typeof i.removeEventListener ? function(n, t, e) { 305 n.removeEventListener(t, e, !1), Helio.each(f[n][t], function(o) { 306 o === e && (f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t][f[n][t].indexOf(o)] = void 0) 307 }) 308 } : "function" == typeof i.detachEvent ? function(n, t, e) { 309 n.detachEvent(t, e), Helio.each(f[n][t], function(o) { 310 o === e && (f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t][f[n][t].indexOf(o)] = void 0) 311 }) 312 } : function(n, t, e) { 313 n["on" + t] = void 0, Helio.each(f[n][t], function(o) { 314 o === e && (f[n] = f[n] || {}, f[n][t] = f[n][t] || [], f[n][t][f[n][t].indexOf(o)] = void 0) 315 }) 316 } 317 }(), o = function(n, t) { 318 f[n] = f[n] || {}, f[n][t] = f[n][t] || []; 319 for (var e = 0, o = f[n][t].length; o > e; e += 1) f[n][t][e]() 320 }, { 321 add: t, 322 remove: e, 323 trigger: o, 324 _handlers: f 325 } 326}(this); 327/* 328 * OKVideo by OKFocus v2.3.2 329 * http://okfoc.us 330 * 331 * Copyright 2014, OKFocus 332 * Licensed under the MIT license. 333 * 334 */ 335var player, OKEvents, options, videoWidth, videoHeight, YTplayers, youtubePlayers = new Array(); 336// youtube player ready 337function onYouTubeIframeAPIReady() { 338 YTplayers = new Array(); 339 jQuery('.no-touch .uncode-video-container.video').each(function() { 340 var playerY; 341 if (jQuery(this).attr('data-provider') == 'youtube') { 342 var id = jQuery(this).attr('data-id'); 343 options = jQuery(window).data('okoptions-' + id); 344 options.time = jQuery(this).attr('data-t'); 345 playerY = new YT.Player('okplayer-' + id, { 346 videoId: options.video ? options.video.id : null, 347 playerVars: { 348 'autohide': 1, 349 'autoplay': 0, //options.autoplay,
350 'disablekb': options.keyControls, 351 'cc_load_policy': options.captions, 352 'controls': options.controls, 353 'enablejsapi': 1, 354 'fs': 0, 355 'modestbranding': 1, 356 'origin': window.location.origin || (window.location.protocol + '//' + window.location.hostname), 357 'iv_load_policy': options.annotations, 358 'loop': options.loop, 359 'showinfo': 0, 360 'rel': 0, 361 'wmode': 'opaque', 362 'hd': options.hd 363 }, 364 events: { 365 'onReady': OKEvents.yt.ready, 366 'onStateChange': OKEvents.yt.onStateChange, 367 'onError': OKEvents.yt.error 368 } 369 }); 370 YTplayers[id] = playerY; 371 playerY.videoId = id; 372 } 373 }); 374} 375// vimeo player ready 376function vimeoPlayerReady(id) { 377 options = jQuery(window).data('okoptions-' + id); 378 var jIframe = options.jobject, 379 iframe = jIframe[0]; 380 jIframe.attr('src', jIframe.data('src')); 381 var playerV = $f(iframe); 382 // hide player until Vimeo hides controls... 383 playerV.addEvent('ready', function(e) { 384 OKEvents.v.onReady(iframe); 385 var carouselContainer = jQuery(iframe).closest('.owl-carousel'); 386 if (carouselContainer.length) { 387 UNCODE.owlPlayVideo(carouselContainer); 388 } 389 // "Do not try to add listeners or call functions before receiving this event." 390 if (OKEvents.utils.isMobile()) { 391 // mobile devices cannot listen for play event 392 OKEvents.v.onPlay(playerV); 393 } else { 394 playerV.addEvent('play', OKEvents.v.onPlay(playerV)); 395 playerV.addEvent('pause', OKEvents.v.onPause); 396 playerV.addEvent('finish', OKEvents.v.onFinish); 397 } 398 if (options.time != null) { 399 playerV.api('seekTo', (options.time).replace('t=', '')); 400 } 401 402 playerV.api('play'); 403 jQuery(iframe).css({ 404 visibility: 'visible', 405 opacity: 1 406 }); 407 408 }); 409} 410OKEvents = { 411 yt: { 412 ready: function(event) { 413 var id = event.target.videoId; 414 youtubePlayers[id] = event.target; 415 event.target.setVolume(options.volume); 416 if (options.autoplay === 1) { 417 if (options.playlist.list) { 418 player.loadPlaylist(options.playlist.list, options.playlist.index, options.playlist.startSeconds, options.playlist.suggestedQuality); 419 } else { 420 var inCarousel = jQuery('#okplayer-' + id).closest('.owl-item'); 421 if (!inCarousel.length || (inCarousel.length && inCarousel.hasClass('active'))) { 422 if (options.time != null) { 423 event.target.seekTo(parseInt(options.time)); 424 } 425 event.target.playVideo(); 426 } else { 427 event.target.pauseVideo(); 428 } 429 } 430 } 431 OKEvents.utils.isFunction(options.onReady) && options.onReady(event.target); 432 }, 433 onStateChange: function(event) { 434 var id = event.target.videoId; 435 switch (event.data) { 436 case -1: 437 OKEvents.utils.isFunction(options.unstarted) && options.unstarted(); 438 break; 439 case 0: 440 OKEvents.utils.isFunction(options.onFinished) && options.onFinished(); 441 options.loop && event.target.playVideo(); 442 break; 443 case 1: 444 OKEvents.utils.isFunction(options.onPlay) && options.onPlay(); 445 setTimeout(function() { 446 UNCODE.initVideoComponent(document.body, '.uncode-video-container.video, .uncode-video-container.self-video'); 447 jQuery('#okplayer-' + id).closest('.uncode-video-container').css('opacity', '1'); 448 }, 300); 449 break; 450 case 2: 451 OKEvents.utils.isFunction(options.onPause) && options.onPause(); 452 break; 453 case 3: 454 OKEvents.utils.isFunction(options.buffering) && options.buffering(); 455 break; 456 case 5: 457 OKEvents.utils.isFunction(options.cued) && options.cued(); 458 break; 459 default: 460 throw "OKVideo: received invalid data from YT player."; 461 } 462 }, 463 error: function(event) { 464 throw event; 465 } 466 }, 467 v: { 468 onReady: function(target) { 469 OKEvents.utils.isFunction(options.onReady) && options.onReady(target); 470 }, 471 onPlay: function(player) { 472 if (!OKEvents.utils.isMobile()) player.api('setVolume', options.volume); 473 OKEvents.utils.isFunction(options.onPlay) && options.onPlay(); 474 jQuery(player.element).closest('.uncode-video-container').css('opacity', '1'); 475 }, 476 onPause: function() { 477 OKEvents.utils.isFunction(options.onPause) && options.onPause(); 478 }, 479 onFinish: function() { 480 OKEvents.utils.isFunction(options.onFinish) && options.onFinish(); 481 } 482 }, 483 utils: { 484 isFunction: function(func) { 485 if (typeof func === 'function') { 486 return true; 487 } else { 488 return false;
489 } 490 }, 491 isMobile: function() { 492 if (navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/)) { 493 return true; 494 } else { 495 return false; 496 } 497 } 498 } 499}; 500// DOM class helper 501(function(window) { 502 'use strict'; 503 // class helper functions from bonzo https://github.com/ded/bonzo 504 function classReg(className) { 505 return new RegExp("(^|\\s+)" + className + "(\\s+|$)"); 506 } 507 // classList support for class management 508 // altho to be fair, the api sucks because it won't accept multiple classes at once 509 var hasClass, addClass, removeClass; 510 if ('classList' in document.documentElement) { 511 hasClass = function(elem, c) { 512 if (elem !== null) return elem.classList.contains(c); 513 }; 514 addClass = function(elem, c) { 515 if (elem !== null) elem.classList.add(c); 516 }; 517 removeClass = function(elem, c) { 518 if (elem !== null) elem.classList.remove(c); 519 }; 520 } else { 521 hasClass = function(elem, c) { 522 if (elem !== null) return classReg(c).test(elem.className); 523 }; 524 addClass = function(elem, c) { 525 if (!hasClass(elem, c)) { 526 if (elem !== null) elem.className = elem.className + ' ' + c; 527 } 528 }; 529 removeClass = function(elem, c) { 530 if (elem !== null) elem.className = elem.className.replace(classReg(c), ' '); 531 }; 532 } 533 534 function toggleClass(elem, c) { 535 var fn = hasClass(elem, c) ? removeClass : addClass; 536 fn(elem, c); 537 } 538 var classie = { 539 // full names 540 hasClass: hasClass, 541 addClass: addClass, 542 removeClass: removeClass, 543 toggleClass: toggleClass, 544 // short names 545 has: hasClass, 546 add: addClass, 547 remove: removeClass, 548 toggle: toggleClass 549 }; 550 // transport 551 if (typeof define === 'function' && define.amd) { 552 // AMD 553 define(classie); 554 } else { 555 // browser global 556 window.classie = classie; 557 } 558})(window); 559/* From Modernizr */ 560function whichTransitionEvent() { 561 var t; 562 var el = document.createElement('fakeelement'); 563 var transitions = { 564 'transition': 'transitionend', 565 'OTransition': 'oTransitionEnd', 566 'MozTransition': 'transitionend', 567 'WebkitTransition': 'webkitTransitionEnd' 568 } 569 for (t in transitions) { 570 if (el.style[t] !== undefined) { 571 return transitions[t]; 572 } 573 } 574 } 575/** 576 * Load utils - END 577 */ 578 579/** 580 * Start main js 581 */ 582(function(window, undefined) { 583 'use strict'; 584 // Init variables 585 var bodyTop, 586 scrollbarWidth = false, 587 noScroll = false, 588 boxEvent = new CustomEvent('boxResized'), 589 bodyBorder = 0, 590 adminBarHeight = 0, 591 boxWidth = 0, 592 boxLeft = 0, 593 parallaxRows, 594 parallaxCols, 595 parallaxHeaders, 596 headerWithOpacity, 597 speedDivider = SiteParameters.parallax_factor, 598 adminBar, 599 pageHeader, 600 masthead, 601 mastheadMobile, 602 menuwrapper, 603 menuhide, 604 menusticky, 605 menuHeight = 0, 606 menuMobileHeight = 0, 607 mainmenu = new Array(), 608 secmenu = new Array(),
609 secmenuHeight = 0, 610 transmenuHeight = 0, 611 header, 612 transmenuel, 613 logo, 614 logoel, 615 logolink, 616 logoMinScale, 617 lastScrollValue = 0, 618 wwidth = window.innerWidth || document.documentElement.clientWidth, 619 wheight = window.innerHeight || document.documentElement.clientHeight, 620 boxWrapper, 621 docheight = 0, 622 isMobile = classie.hasClass(document.documentElement, 'touch') ? true : false, 623 isIE = classie.hasClass(document.documentElement, 'ie') || classie.hasClass(document.documentElement, 'opera12') ? true : false, 624 isFF = classie.hasClass(document.documentElement, 'firefox') ? true : false, 625 transitionEvent = whichTransitionEvent(), 626 footerScroller = false, 627 mediaQuery = 959, 628 mediaQueryMobile = 569, 629 menuOpened = false, 630 overlayOpened = false, 631 menuMobileTriggerEvent = new CustomEvent('menuMobileTrigged'), 632 resizeTimer, 633 hidingTimer, 634 isSplitMenu = false, 635 mainNavMenu, 636 mainNavWrapper, 637 initBox = function() { 638 var bodyBorderDiv = document.querySelectorAll('.body-borders .top-border'); 639 if (bodyBorderDiv.length) { 640 bodyBorder = outerHeight(bodyBorderDiv[0]); 641 } else bodyBorder = 0; 642 UNCODE.bodyBorder = bodyBorder; 643 if (bodyBorder != 0) { 644 document.documentElement.style.marginTop = bodyBorder + 'px'; 645 wheight = (window.innerHeight || document.documentElement.clientHeight) - (bodyBorder * 2); 646 } 647 if (!isMobile && !scrollbarWidth) { 648 // Create the measurement node 649 var scrollDiv = document.createElement("div"); 650 scrollDiv.className = "scrollbar-measure"; 651 var dombody = document.body; 652 if (dombody != null) { 653 dombody.appendChild(scrollDiv); 654 // Get the scrollbar width 655 scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; 656 // Delete the DIV 657 dombody.removeChild(scrollDiv); 658 } 659 } 660 if (!isMobile) { 661 forEachElement('.box-container', function(el, i) { 662 if (!classie.hasClass(el, 'limit-width')) { 663 var elWidth = outerWidth(el), 664 newWidth = 12 * Math.ceil((wwidth - scrollbarWidth) / 12); 665 boxWidth = newWidth - (bodyBorder * 2); 666 boxLeft = (wwidth - boxWidth - scrollbarWidth) / 2; 667 el.style.width = boxWidth + 'px'; 668 el.style.marginLeft = boxLeft + 'px'; 669 if (mainmenu != undefined && mainmenu[0] != undefined) { 670 mainmenu[0].style.width = boxWidth + 'px'; 671 } 672 } 673 }); 674 } 675 }, 676 fixMenuHeight = function() { 677 if (!classie.hasClass(document.body, 'vmenu')) noScroll = true; 678 menuwrapper = document.querySelectorAll(".menu-wrapper"); 679 masthead = document.getElementById("masthead"); 680 if (classie.hasClass(document.body, 'hmenu-center-split')) { 681 mastheadMobile = new Array(document.getElementById("logo-container-mobile"), document.getElementById("main-logo").parentNode); 682 } else mastheadMobile = document.getElementById("logo-container-mobile"); 683 menuhide = document.querySelector('#masthead .menu-hide, .main-header .menu-hide, #masthead .menu-hide-vertical'); 684 menusticky = document.querySelectorAll('.menu-sticky, .menu-sticky-vertical'); 685 transmenuel = document.querySelectorAll('.menu-transparent:not(.vmenu-container)'); 686 var menuItemsButton = document.querySelectorAll('.menu-item-button .menu-btn-table'); 687 logo = document.querySelector('#main-logo'); 688 if (logo != undefined) logolink = (logo.firstElementChild || logo.firstChild); 689 if (logolink != undefined) logoMinScale = logolink.getAttribute("data-minheight"); 690 logoel = document.querySelectorAll('.menu-shrink .logo-container'); 691 mainmenu = document.querySelectorAll('.vmenu .vmenu-container, .menu-primary .menu-container'); 692 if (classie.hasClass(document.body, 'hmenu-center')) { 693 var mainmenucenter = document.querySelectorAll('.hmenu-center .menu-container-mobile'); 694 var first_array = Array.prototype.slice.call(mainmenu); 695 var second_array = Array.prototype.slice.call(mainmenucenter); 696 mainmenu = first_array.concat(second_array); 697 } 698 secmenu = document.querySelectorAll('.menu-secondary'); 699 calculateMenuHeight(true); 700 for (var k = 0;
700 k < menuItemsButton.length; k++) { 701 var a_item = menuItemsButton[k].parentNode, 702 buttonHeight = outerHeight(menuItemsButton[k]); 703 a_item.style.height = buttonHeight + 'px'; 704 } 705 if (classie.hasClass(document.body, 'hmenu-center-split')) { 706 mainNavMenu = document.querySelector('#masthead .navbar-main .menu-primary-inner'); 707 mainNavWrapper = document.querySelector('#masthead > .menu-container'); 708 isSplitMenu = true; 709 } 710 }, 711 calculateMenuHeight = function(first) { 712 menuHeight = transmenuHeight = secmenuHeight = 0; 713 714 if (mastheadMobile != null) { 715 if (mastheadMobile.length === 2) { 716 if (wwidth > mediaQuery) UNCODE.menuMobileHeight = outerHeight(mastheadMobile[1]); 717 else UNCODE.menuMobileHeight = outerHeight(mastheadMobile[0]); 718 } else UNCODE.menuMobileHeight = outerHeight(mastheadMobile); 719 } 720 721 if (wwidth > mediaQuery) { 722 for (var i = 0; i < mainmenu.length; i++) { 723 if (classie.hasClass(document.body, 'hmenu-center') && i === 1) continue; 724 if (!classie.hasClass(masthead, 'masthead-vertical')) { 725 menuHeight = menuHeight + outerHeight(mainmenu[i]); 726 } else menuHeight = 0; 727 728 if (isIE && first) { 729 getDivChildren(mainmenu[i], '.menu-horizontal-inner', function(innerMenu, i) { 730 innerMenu.style.height = menuHeight + 'px'; 731 }); 732 } 733 734 if (classie.hasClass(mainmenu[i].parentNode, 'menu-transparent')) { 735 transmenuHeight += menuHeight; 736 } 737 } 738 739 for (var j = 0; j < secmenu.length; j++) { 740 secmenuHeight += outerHeight(secmenu[j]); 741 } 742 menuHeight += secmenuHeight; 743 } else { 744 menuHeight = UNCODE.menuMobileHeight; 745 var search_box = document.querySelectorAll('.search-icon .drop-menu'); 746 for (var i = 0; i < search_box.length; i++) { 747 search_box[i].removeAttribute('style'); 748 } 749 } 750 751 if (classie.hasClass(document.documentElement, 'admin-mode')) { 752 adminBar = document.getElementById("wpadminbar"); 753 if (wwidth > 600) { 754 if (adminBar != null) adminBarHeight = outerHeight(adminBar); 755 else { 756 if (wwidth > 782) adminBarHeight = 32; 757 else adminBarHeight = 46; 758 } 759 } else adminBarHeight = 0; 760 } 761 UNCODE.adminBarHeight = adminBarHeight; 762 UNCODE.menuHeight = menuHeight; 763 764 if (masthead != undefined) { 765 masthead.parentNode.style.height = menuHeight + 'px'; 766 if (classie.hasClass(masthead, 'menu-transparent')) { 767 if (wwidth > mediaQuery) masthead.parentNode.style.height = '0px'; 768 } 769 } 770 771 if (typeof menuhide == 'object' && menuhide != null && mainmenu[0] != undefined) { 772 var sticky_element = (typeof mainmenu.item === 'undefined' ? ((wwidth > mediaQuery) ? mainmenu[0] : mainmenu[1]) : mainmenu[0]); 773 if (sticky_element.style.top != '') { 774 sticky_element.style.top = UNCODE.bodyBorder + 'px' 775 } 776 } 777 778 }, 779 centerSplitMenu = function() { 780 if (wwidth > mediaQuery && mainNavMenu) { 781 if (mainNavMenu.style.left == '') { 782 mainNavMenu.style.left = '0px'; 783 var logoPos = logo.parentNode.getBoundingClientRect(); 784 mainNavMenu.style.left = (wwidth / 2) - (logoPos.left + (logoPos.width / 2) ) + 'px'; 785 mainNavWrapper.style.opacity = '1'; 786 } 787 } 788 }, 789 initHeader = function() { 790 UNCODE.adaptive(); 791 headerHeight('.header-wrapper'); 792 parallaxHeaders = document.querySelectorAll('.header-parallax > .header-bg-wrapper > .header-bg'); 793 header = document.querySelectorAll('.header-wrapper.header-uncode-block, .header-wrapper.header-revslider, .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 .col-lg-12 .uncoltable'); 794 headerWithOpacity = document.querySelectorAll('.header-scroll-opacity'); 795 pageHeader = document.getElementById("page-header"); 796 if (pageHeader != undefined) { 797 var backs = pageHeader.querySelectorAll('.header-bg'), 798 backsCarousel = pageHeader.querySelectorAll('.header-uncode-block .background-inner'), 799 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; 800 if (backs.length == 0 && backsCarousel.length == 0) { 801 pageHeader.setAttribute('data-imgready', 'true'); 802 } else { 803 if (backsCarousel.length) { 804 for (var j = 0; j < backsCarousel.length; j++) { 805 if (j == 0) { 806 if (!!backsCarousel[j].style.backgroundImage && backsCarousel[j].style.backgroundImage !== void 0) { 807 var url = (backsCarousel[j].style.backgroundImage).match(uri_pattern), 808 image = new Image(); 809 image.onload = function() { 810 pageHeader.setAttribute('data-imgready', 'true'); 811 }; 812 image.src = url[0]; 813 } else { 814 pageHeader.setAttribute('data-imgready', 'true'); 815 } 816 } 817 } 818 } else { 819 for (var i = 0; i < backs.length; i++) { 820 if (i == 0) { 821 if (!!backs[i].style.backgroundImage && backs[i].style.backgroundImage !== void 0) { 822 var url = (backs[i].style.backgroundImage).match(uri_pattern), 823 image = new Image(); 824 image.onload = function() { 825 pageHeader.setAttribute('data-imgready', 'true'); 826 }; 827 image.src = url[0]; 828 } else { 829 pageHeader.setAttribute('data-imgready', 'true'); 830 } 831 } 832 } 833 } 834 } 835 } 836 837 if (masthead != undefined && !classie.hasClass(masthead, 'masthead-vert
837ical')) { 838 if (header.length) { 839 masthead.parentNode.style.height = menuHeight + 'px'; 840 if (menuwrapper[0] != undefined) classie.addClass(menuwrapper[0], 'with-header'); 841 for (var j = 0; j < header.length; j++) { 842 var headerel = header[j], 843 closestStyle = getClosest(headerel, 'style-light'); 844 if (closestStyle != null && classie.hasClass(closestStyle, 'style-light')) switchColorsMenu(0, 'light'); 845 else if (getClosest(headerel, 'style-dark') != null) switchColorsMenu(0, 'dark'); 846 else { 847 if (masthead.style.opacity !== 1) masthead.style.opacity = 1; 848 } 849 if (classie.hasClass(masthead, 'menu-transparent')) { 850 if (wwidth > mediaQuery) { 851 masthead.parentNode.style.height = '0px'; 852 if (classie.hasClass(masthead, 'menu-add-padding')) { 853 var headerBlock = getClosest(headerel, 'header-uncode-block'); 854 if (headerBlock != null) { 855 var innerRows = headerel.querySelectorAll('.column_parent > .uncol > .uncoltable > .uncell > .uncont, .uncode-slider .column_child > .uncol > .uncoltable > .uncell > .uncont'); 856 for (var k = 0; k < innerRows.length; k++) { 857 if (innerRows[k] != undefined) { 858 innerRows[k].style.paddingTop = transmenuHeight + 'px'; 859 } 860 } 861 } else { 862 getDivChildren(headerel, '.header-content', function(headerContent, i) { 863 headerContent.style.paddingTop = transmenuHeight + 'px'; 864 }); 865 } 866 } 867 } 868 } 869 } 870 } else { 871 if (menuwrapper[0] != undefined) classie.addClass(menuwrapper[0], 'no-header'); 872 classie.removeClass(masthead, 'menu-transparent'); 873 transmenuHeight = 0; 874 } 875 } 876 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 877 UNCODE.bodyTop = bodyTop; 878 scrollFunction(); 879 showHideScrollup(bodyTop); 880 }, 881 initRow = function(currentRow) { 882 UNCODE.adaptive(); 883 var el = currentRow.parentNode.parentNode.getAttribute("data-parent") == 'true' ? currentRow.parentNode : currentRow.parentNode.parentNode, 884 rowParent = el.parentNode, 885 rowInner = currentRow.parentNode, 886 percentHeight = el.getAttribute("data-height-ratio"), 887 minHeight = el.getAttribute("data-minheight"), 888 calculateHeight, 889 calculatePadding = 0, 890 isHeader = false, 891 isFirst = false, 892 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; 893 894 /** Add class to the row when contains responsive column size */ 895 getDivChildren(el.parentNode, '.column_parent, .column_child', function(obj, i, total) { 896 if ((obj.className).indexOf("col-md-") > - 1) classie.addClass(obj.parentNode, 'cols-md-responsive'); 897 }); 898 899 setRowHeight(el); 900 901 var elements = 0; 902 getDivChildren(el, '.row-internal .background-inner', function(obj, i, total) { 903 elements++; 904 if (i == 0) { 905 if (!!obj.style.backgroundImage && obj.style.backgroundImage !== void 0) { 906 var url = (obj.style.backgroundImage).match(uri_pattern), 907 image = new Image(); 908 image.onload = function() { 909 el.setAttribute('data-imgready', 'true'); 910 el.dispatchEvent(new CustomEvent('imgLoaded')); 911 }; 912 image.src = url[0]; 913 } else { 914 el.setAttribute('data-imgready', 'true'); 915 el.dispatchEvent(new CustomEvent('imgLoaded')); 916 } 917 } 918 }); 919 if (elements == 0) { 920 el.setAttribute('data-imgready', 'true'); 921 } 922 923 /** init parallax is not mobile */ 924 if (!UNCODE.isMobile) { 925 parallaxRows = el.parentNode.parentNode.querySelectorAll('.with-parallax > .row-background > .background-wrapper'); 926 parallaxCols = el.querySelectorAll('.with-parallax > .column-background > .background-wrapper'); 927 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 928 UNCODE.bodyTop = bodyTop; 929 parallaxRowCol(bodyTop); 930 } 931 }, 932 setRowHeight = function(container, forced, resized) { 933 var currentTallest = 0, 934 percentHeight = 0, 935 minHeight = 0, 936 el, 937 child, 938 hasSubCols = false;
939 if (container.length == undefined) { 940 container = [container]; 941 } 942 // Loop for each container element to match their heights 943 for (var i = 0; i < container.length; i++) { 944 var el = container[i], 945 $row = el, 946 totalHeight = 0, 947 colsArray = new Array(), 948 calculatePadding = 0, 949 $rowParent = $row.parentNode, 950 isHeader = false, 951 isFirst = false; 952 $row.oversized = false; 953 percentHeight = el.getAttribute("data-height-ratio"); 954 minHeight = el.getAttribute("data-minheight"); 955 child = (el.firstElementChild || el.firstChild); 956 var childHeight = outerHeight(child); 957 /** window height without header **/ 958 if (!!percentHeight || !!minHeight || forced || (isIE && classie.hasClass(el, 'unequal'))) { 959 child.style.height = ''; 960 if (!!percentHeight) { 961 if (percentHeight == 'full') { 962 currentTallest = parseInt(wheight); 963 } else { 964 currentTallest = parseInt((wheight * percentHeight) / 100); 965 } 966 } else { 967 currentTallest = el.clientHeight; 968 } 969 970 if (!!minHeight) { 971 if (currentTallest < minHeight || currentTallest == undefined) currentTallest = parseInt(minHeight); 972 } 973 974 var computedStyleRow = getComputedStyle(el), 975 computedStyleRowParent = getComputedStyle($rowParent); 976 calculatePadding -= (parseFloat(computedStyleRow.paddingTop) + parseFloat(computedStyleRowParent.paddingTop)); 977 calculatePadding -= (parseFloat(computedStyleRow.paddingBottom) + parseFloat(computedStyleRowParent.paddingBottom)); 978 if (getClosest(el, 'header-uncode-block') != null) { 979 el.setAttribute('data-row-header', 'true'); 980 isHeader = true; 981 } else { 982 if (pageHeader == null) { 983 var prevRow = $rowParent.previousSibling; 984 if (prevRow != null && prevRow.innerText == 'UNCODE.initHeader();') { 985 isFirst = true; 986 } 987 } 988 } 989 990 if (classie.hasClass(el, 'row-slider')) { 991 percentHeight = el.getAttribute("data-height-ratio"); 992 minHeight = el.getAttribute("data-minheight"); 993 if (percentHeight == 'full') { 994 currentTallest = parseInt(wheight); 995 } else { 996 currentTallest = parseInt((wheight * percentHeight) / 100); 997 } 998 999 if (isHeader || isFirst) { 1000 if (wwidth > mediaQuery) currentTallest -= menuHeight - transmenuHeight; 1001 else currentTallest -= menuHeight - secmenuHeight; 1002 currentTallest += calculatePadding; 1003 } else { 1004 if (wwidth > mediaQuery) currentTallest += calculatePadding; 1005 else currentTallest = 'auto'; 1006 } 1007 1008 getDivChildren(el, '.owl-carousel', function(owl, i) { 1009 owl.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1010 if (isIE) { 1011 getDivChildren(owl, '.owl-stage', function(owlIn, i) { 1012 owlIn.style.height = (currentTallest == 'auto' ? '100%' : currentTallest + 'px'); 1013 }); 1014 } 1015 }); 1016 continue; 1017 } else { 1018 if (isHeader || isFirst) { 1019 if (wwidth > mediaQuery) currentTallest -= menuHeight - transmenuHeight; 1020 else currentTallest -= menuHeight - secmenuHeight; 1021 currentTallest += calculatePadding; 1022 } else { 1023 if (wwidth > mediaQuery) currentTallest += calculatePadding; 1024 else currentTallest = 'auto'; 1025 } 1026 } 1027 if (!!minHeight) { 1028 if (currentTallest < minHeight || currentTallest == 'auto') currentTallest = parseInt(minHeight); 1029 } 1030 1031 child.style.height = (currentTallest == 'auto' ? 'auto' : currentTallest + 'px'); 1032 } else { 1033 currentTallest = 0; 1034 } 1035 1036 if (wwidth > mediaQuery) { 1037 1038 getDivChildren(el, '.column_parent', function(col, i, total) { 1039 var $col = col, 1040 $colHeight = 0, 1041 $colDiff = 0, 1042 $colPercDiff = 100; 1043 $col.oversized = false; 1044 $col.forceHeight = currentTallest; 1045 currentTallest = child.clientHeight; 1046 if ((isHeader || isFirst) && currentTallest != 'auto') currentTallest -= transmenuHeight; 1047 var getFirstCol = null; 1048 var getMargin = 0; 1049 getDivChildren(col, '.row-child', function(obj, i, total) { 1050 var $colChild = obj, 1051 $colInner = $colChild.children[0], 1052 $colParent = $colChild.parentNode, 1053 $uncont = $colParent.parentNode; 1054 if (i == 0 && total > 1) getFirstCol = $colInner; 1055 $colChild.oversized = false;
1056 percentHeight = $colChild.getAttribute("data-height"); 1057 minHeight = $colChild.getAttribute("data-minheight"); 1058 if (percentHeight != null || minHeight != null) { 1059 $colInner.style.height = ''; 1060 $colParent.style.height = 'auto'; 1061 $uncont.style.height = '100%'; 1062 $colChild.removeAttribute("style"); 1063 var newHeight = (percentHeight != null) ? Math.ceil((currentTallest) * (percentHeight / 100)) : parseInt(minHeight); 1064 var computedStyleCol = getComputedStyle($colParent); 1065 parseFloat(computedStyleCol.marginTop); 1066 getMargin = parseFloat(computedStyleCol.marginTop); 1067 newHeight -= (getMargin); 1068 $colPercDiff -= (percentHeight != null) ? percentHeight : 0; 1069 if (currentTallest > newHeight) { 1070 var getColHeight = outerHeight($colChild); 1071 if (getColHeight > newHeight) { 1072 $colHeight += getColHeight; 1073 $colDiff += getColHeight; 1074 $colChild.oversized = true; 1075 $col.oversized = true; 1076 $row.oversized = true; 1077 } else { 1078 $colHeight += newHeight; 1079 $colInner.style.height = newHeight + 'px'; 1080 } 1081 } 1082 } else { 1083 $colHeight += outerHeight($colChild); 1084 } 1085 }); 1086 if (getFirstCol != null) { 1087 getFirstCol.style.height = (parseFloat(getFirstCol.style.height) - getMargin) + 'px'; 1088 } 1089 colsArray.push({ 1090 colHeight: $colHeight, 1091 colDiv: $col 1092 }); 1093 $col.colDiff = $colDiff; 1094 $col.colPercDiff = $colPercDiff; 1095 }); 1096 1097 if ($row.oversized) { 1098 child.style.height = ''; 1099 colsArray.sort(function(a, b) { 1100 if (a.colHeight < b.colHeight) return 1; 1101 if (a.colHeight > b.colHeight) return -1; 1102 return 0; 1103 }); 1104 var $totalHeight = 0; 1105 colsArray.forEach(function(col) { 1106 var $col = col.colDiv, 1107 $colHeight = col.colHeight; 1108 getDivChildren($col, '.row-child', function(obj, i, total) { 1109 var $colChild = obj, 1110 $colInner = $colChild.children[0], 1111 percentHeight = $colChild.getAttribute("data-height"), 1112 $colParent = $colChild.parentNode, 1113 $uncont = $colParent.parentNode, 1114 newHeight; 1115 $colHeight = $col.forceHeight - $col.colDiff; 1116 if (percentHeight != null) { 1117 if ($colHeight > 0) { 1118 if ($col.oversized) { 1119 if (!$colChild.oversized) { 1120 newHeight = Math.ceil(($colHeight) * (percentHeight / $col.colPercDiff)); 1121 if (i == total - 1 && total > 1) { 1122 $uncont.style.height = 'auto'; 1123 $colChild.style.display = 'none'; 1124 newHeight = outerHeight($col.parentNode) - outerHeight($uncont); 1125 $uncont.style.height = '100%'; 1126 $colChild.style.display = 'table'; 1127 } 1128 if (newHeight == 0) newHeight = Math.ceil(($col.forceHeight) * (percentHeight / 100)); 1129 $colInner.style.height = newHeight + 'px'; 1130 } 1131 } else { 1132 if ($totalHeight == 0) newHeight = Math.ceil(($colHeight) * (percentHeight / $col.colPercDiff)); 1133 else { 1134 newHeight = Math.ceil(($totalHeight) * (percentHeight / $col.colPercDiff)); 1135 } 1136 if (i == total - 1 && total > 1) { 1137 $uncont.style.height = 'auto'; 1138 $colChild.style.display = 'none'; 1139 newHeight = outerHeight($col.parentNode) - outerHeight($uncont); 1140 $uncont.style.height = '100%'; 1141 $colChild.style.display = 'table'; 1142 } 1143 $colInner.style.height = newHeight + 'px'; 1144 } 1145 } else { 1146 if ($colChild.oversized) { 1147 if ($totalHeight == 0) newHeight = Math.ceil(($colHeight) * (percentHeight / $col.colPercDiff)); 1148 else { 1149 if ($col.colPercDiff == 0) $col.colPercDiff = 100; 1150 newHeight = Math.ceil(($totalHeight) * (percentHeight / $col.colPercDiff)); 1151 } 1152 if (i == total - 1 && total > 1) { 1153 $uncont.style.height = 'auto'; 1154 $colChild.style.display = 'none'; 1155 newHeight = outerHeight($col.parentNode) - outerHeight($uncont); 1156 $uncont.style.height = '100%'; 1157 $colChild.style.display = 'table'; 1158 } 1159 $colInner.style.height = newHeight + 'px'; 1160 } 1161 } 1162 } 1163 }); 1164 var uncell = $col.getElementsByClassName('uncell'); 1165 if (uncell[0] != undefined && $totalHeight == 0) $totalHeight = outerHeight(uncell[0]); 1166 }); 1167 } 1168 if (isFF) { 1169 getDivChildren(el, '.uncoltable', function(col, i, total) { 1170 if (col.style.minHeight != '') { 1171 col.style.height = ''; 1172 } 1173 }); 1174 } 1175 if (resized) { 1176 getDivChildren(el, '.row-child > .row-inner', function(obj, k, total) { 1177 if (obj.style.height == '') { 1178 if (wwidth > mediaQueryMobile) { 1179 var getStyle = (window.getComputedStyle((obj.parentNode), null)), 1180 getInnerHeight = (parseInt(obj.parentNode.clientHeight) - parseInt(getStyle.paddingTop) - parseInt(getStyle.paddingBottom)); 1181 obj.style.height = getInnerHeight + 1 + 'px'; 1182 obj.style.marginBottom = '-1px'; 1183 } 1184 } 1185 }); 1186 getDivChildren(el, '.row-parent > .row-inner', function(obj, k, total) { 1187 if (obj.style.height != '') { 1188 var getStyle = (window.getComputedStyle((obj.parentNode), null)), 1189 getInnerHeight = (parseInt(obj.parentNode.clientHeight) - parseInt(getStyle.paddingTop) - parseInt(getStyle.paddingBottom)), 1190 getTempHeight = parseInt(obj.style.height); 1191 if (getInnerHeight > getTempHeight) { 1192 obj.style.height = getInnerHeight + 1 + 'px'; 1193 obj.style.marginBottom = '-1px'; 1194 } 1195 } 1196 }); 1197 } 1198 } else { 1199 if (isFF) { 1200 getDivChildren(el, '.uncoltable', function(col, i, total) { 1201 if (col.style.minHeight != '') { 1202 col.style.height = ''; 1203 col.style.height = outerHeight(col.parentNode) + 'px'; 1204 } 1205 }); 1206 } 1207 if (isIE && (wwidth > mediaQueryMobile)) { 1208 if (child.style.height == 'auto') { 1209 child.style.height = outerHeight(child) + 'px'; 1210 } 1211 } 1212 } 1213 if (isFF) { 1214 var sliderColumnFix = document.querySelector('.uncode-slider .row-inner > .column_child:only-child'); 1215 if (sliderColumnFix != null) { 1216 if (wwidth > mediaQuery) { 1217 sliderColumnFix.style.setProperty("height", ""); 1218 } else { 1219 sliderColumnFix.style.setProperty("height", ""); 1220 sliderColumnFix.style.setProperty("height", outerHeight(sliderColumnFix.parentNode) + "px", "important"); 1221 } 1222 } 1223 } 1224 }; 1225 }, 1226 headerHeight = function(container) {
1227 forEachElement(container, function(el, i) { 1228 var getHeight = el.getAttribute("data-height"), 1229 newHeight = ((wheight * getHeight) / 100); 1230 if (getHeight != 'fixed' && newHeight != 0) { 1231 if (wwidth > mediaQuery) newHeight -= menuHeight - transmenuHeight; 1232 else newHeight -= menuHeight - secmenuHeight; 1233 el.style.height = newHeight + 'px'; 1234 } 1235 }); 1236 if (masthead != undefined) { 1237 masthead.parentNode.style.height = menuHeight + 'px'; 1238 if (header != undefined && header.length) { 1239 if (classie.hasClass(masthead, 'menu-transparent')) { 1240 if (wwidth > mediaQuery) { 1241 masthead.parentNode.style.height = '0px'; 1242 if (classie.hasClass(masthead, 'menu-add-padding')) { 1243 for (var j = 0; j < header.length; j++) { 1244 var headerel = header[j]; 1245 var headerBlock = getClosest(headerel, 'header-uncode-block'); 1246 if (headerBlock != null) { 1247 var innerRows = headerel.querySelectorAll('.column_parent > .uncol > .uncoltable > .uncell > .uncont, .uncode-slider .column_child > .uncol > .uncoltable > .uncell > .uncont'); 1248 for (var k = 0; k < innerRows.length; k++) { 1249 if (innerRows[k] != undefined) { 1250 innerRows[k].style.paddingTop = transmenuHeight + 'px'; 1251 } 1252 } 1253 } else { 1254 getDivChildren(headerel, '.header-content', function(headerContent, i) { 1255 headerContent.style.paddingTop = transmenuHeight + 'px'; 1256 }); 1257 } 1258 } 1259 } 1260 } 1261 } 1262 } 1263 } 1264 }, 1265 initVideoComponent = function(container, classTarget) { 1266 getDivChildren(container, classTarget, function(el, i) { 1267 var width = outerWidth(el), 1268 pWidth, // player width, to be defined 1269 height = outerHeight(el), 1270 pHeight, // player height, tbd 1271 $tubularPlayer = (el.getElementsByTagName('iframe').length == 1) ? el.getElementsByTagName('iframe') : el.getElementsByTagName('video'), 1272 ratio = (el.getAttribute("data-ratio") != null) ? Number(el.getAttribute("data-ratio")) : null, 1273 heightOffset = 80, 1274 widthOffset = heightOffset * ratio; 1275 // when screen aspect ratio differs from video, video must center and underlay one dimension 1276 if ($tubularPlayer[0] != undefined) { 1277 if (width / ratio < height) { // if new video height < window height (gap underneath) 1278 pWidth = Math.ceil((height + heightOffset) * ratio); // get new player width 1279 $tubularPlayer[0].style.width = pWidth + widthOffset + 'px'; 1280 $tubularPlayer[0].style.height = height + heightOffset + 'px'; 1281 $tubularPlayer[0].style.left = ((width - pWidth) / 2) - (widthOffset / 2) + 'px'; 1282 $tubularPlayer[0].style.top = '-' + (heightOffset / 2) + 'px'; 1283 $tubularPlayer[0].style.position = 'absolute'; 1284 } else { // new video width < window width (gap to right) 1285 pHeight = Math.ceil(width / ratio); // get new player height 1286 $tubularPlayer[0].style.width = width + widthOffset + 'px'; 1287 $tubularPlayer[0].style.height = pHeight + heightOffset + 'px'; 1288 $tubularPlayer[0].style.left = '-' + (widthOffset / 2) + 'px'; 1289 $tubularPlayer[0].style.top = ((height - pHeight) / 2) - (heightOffset / 2) + 'px'; 1290 $tubularPlayer[0].style.position = 'absolute'; 1291 } 1292 } 1293 }); 1294 }, 1295 init_overlay = function() { 1296 var triggerButton, 1297 closeButtons = new Array(); 1298 function toggleOverlay(btn) { 1299 Array.prototype.forEach.call(document.querySelectorAll('div.overlay'), function(overlay) { 1300 if (btn.getAttribute('data-area') == overlay.getAttribute('data-area')) { 1301 var container = document.querySelector('div.' + btn.getAttribute('data-container')), 1302 inputField = overlay.querySelector('.search-field'); 1303 if (classie.has(overlay, 'open')) { 1304 overlayOpened = false; 1305 classie.remove(overlay, 'open'); 1306 classie.remove(container, 'overlay-open'); 1307 classie.add(overlay, 'close'); 1308 classie.remove(overlay, 'open-items'); 1309 var onEndTransitionFn = function(ev) { 1310 if (transitionEvent) { 1311 if (ev.propertyName !== 'visibility') return; 1312 this.removeEventListener(transitionEvent, onEndTransitionFn); 1313 } 1314 classie.remove(overlay, 'close'); 1315 }; 1316 if (transitionEvent) { 1317 overlay.addEventListener(transitionEvent, onEndTransitionFn); 1318 } else { 1319 onEndTransitionFn(); 1320 } 1321 } else if (!classie.has(overlay, 'close')) { 1322 overlayOpened = true; 1323 classie.add(overlay, 'open'); 1324 classie.add(container, 'overlay-open'); 1325 if (jQuery('body.menu-overlay').length == 0) { 1326 setTimeout(function() { 1327 inputField.focus(); 1328 }, 1000); 1329 } 1330 setTimeout(function() { 1331 if (classie.has(overlay, 'overlay-sequential')) classie.add(overlay, 'open-items'); 1332 }, 800); 1333 } 1334 } 1335 }); 1336 1337 if (classie.hasClass(btn, 'search-icon') || classie.hasClass(btn, 'menu-close-search')) return; 1338 1339 if (classie.hasClass(triggerButton, 'close')) { 1340 UNCODE.menuOpened = false;
1341 classie.removeClass(triggerButton, 'close'); 1342 classie.addClass(triggerButton, 'closing'); 1343 Array.prototype.forEach.call(closeButtons, function(closeButton) { 1344 if (!classie.hasClass(closeButton, 'menu-close-search')) { 1345 classie.removeClass(closeButton, 'close'); 1346 classie.addClass(closeButton, 'closing'); 1347 } 1348 }); 1349 setTimeout(function() { 1350 classie.removeClass(triggerButton, 'closing'); 1351 triggerButton.style.opacity = 1; 1352 Array.prototype.forEach.call(closeButtons, function(closeButton) { 1353 if (!classie.hasClass(closeButton, 'menu-close-search')) { 1354 classie.removeClass(closeButton, 'closing'); 1355 closeButton.style.opacity = 0; 1356 } 1357 }); 1358 }, 800); 1359 } else { 1360 UNCODE.menuOpened = true; 1361 triggerButton.style.opacity = 0; 1362 var getBtnRect = !classie.hasClass(triggerButton, 'search-icon') ? triggerButton.getBoundingClientRect() : null; 1363 Array.prototype.forEach.call(closeButtons, function(closeButton) { 1364 if (!classie.hasClass(closeButton, 'menu-close-search')) { 1365 classie.addClass(triggerButton, 'close'); 1366 if (getBtnRect != null) closeButton.setAttribute('style', 'top:' + getBtnRect.top + 'px; left:'+ getBtnRect.left + 'px !important'); 1367 classie.addClass(closeButton, 'close'); 1368 closeButton.style.opacity = 1; 1369 } 1370 }); 1371 } 1372 } 1373 (function bindEscape() { 1374 document.onkeydown = function(evt) { 1375 evt = evt || window.event; 1376 var isEscape = false;
1377 if ("key" in evt) { 1378 isEscape = (evt.key == "Escape" || evt.key == "Esc"); 1379 } else { 1380 isEscape = (evt.keyCode == 27); 1381 } 1382 if (isEscape && overlayOpened) { 1383 Array.prototype.forEach.call(closeButtons, function(closeButton) { 1384 if (classie.hasClass(closeButton, 'overlay-close') && classie.hasClass(closeButton, 'menu-button-overlay')) { 1385 closeButton.click(); 1386 } 1387 }); 1388 } 1389 }; 1390 })(); 1391 Array.prototype.forEach.call(document.querySelectorAll('.trigger-overlay'), function(triggerBttn) { 1392 if (UNCODE.menuOpened) return; 1393 triggerBttn.addEventListener('click', function(e) { 1394 triggerButton = e.currentTarget; 1395 if (wwidth < mediaQuery && classie.hasClass(triggerButton, 'search-icon')) { 1396 return true; 1397 } else { 1398 e.stopPropagation(); 1399 if (wwidth > mediaQuery) toggleOverlay(triggerButton); 1400 else { 1401 if (classie.addClass(triggerButton, 'search-icon')) return true; 1402 } 1403 e.preventDefault(); 1404 return false; 1405 } 1406 }, false); 1407 }); 1408 Array.prototype.forEach.call(document.querySelectorAll('.overlay-close'), function(closeBttn) { 1409 closeButtons.push(closeBttn); 1410 closeBttn.addEventListener('click', function(e) { 1411 if (wwidth > mediaQuery) toggleOverlay(closeBttn); 1412 e.preventDefault(); 1413 return false; 1414 }, false); 1415 }); 1416 }, 1417 /** All scrolling functions - Begin */ 1418 /** Shrink menu **/ 1419 shrinkMenu = function(bodyTop) { 1420 var logoShrink, 1421 offset = 100; 1422 for (var i = 0; i < logoel.length; i++) { 1423 if (((secmenuHeight == 0) ? bodyTop > menuHeight : bodyTop > secmenuHeight + offset) && !classie.hasClass(logoel[i], 'shrinked') && (wwidth > mediaQuery)) { 1424 classie.addClass(logoel[i], 'shrinked'); 1425 if (logoMinScale != undefined) { 1426 logoShrink = logolink.children; 1427 Array.prototype.forEach.call(logoShrink, function(singleLogo) { 1428 singleLogo.style.height = logoMinScale + 'px'; 1429 singleLogo.style.lineHeight = logoMinScale + 'px'; 1430 if (classie.hasClass(singleLogo, 'text-logo')) singleLogo.style.fontSize = logoMinScale + 'px'; 1431 }); 1432 } 1433 } else if ((((secmenuHeight == 0) ? bodyTop == 0 : bodyTop <= secmenuHeight + offset) || (wwidth < mediaQuery)) && classie.hasClass(logoel[i], 'shrinked')) { 1434 classie.removeClass(logoel[i], 'shrinked'); 1435 if (logoMinScale != undefined) { 1436 logoShrink = logolink.children; 1437 Array.prototype.forEach.call(logoShrink, function(singleLogo) { 1438 singleLogo.style.height = singleLogo.getAttribute('data-maxheight') + 'px'; 1439 singleLogo.style.lineHeight = singleLogo.getAttribute('data-maxheight') + 'px'; 1440 if (classie.hasClass(singleLogo, 'text-logo')) singleLogo.style.fontSize = singleLogo.getAttribute('data-maxheight') + 'px'; 1441 }); 1442 } 1443 } 1444 } 1445 }, 1446 /** Switch colors menu **/ 1447 switchColorsMenu = function(bodyTop, style) { 1448 for (var i = 0; i < transmenuel.length; i++) { 1449 if (masthead.style.opacity !== 1) masthead.style.opacity = 1; 1450 if ((secmenuHeight == 0) ? bodyTop > menuHeight / 2 : bodyTop > secmenuHeight) { 1451 if (classie.hasClass(masthead, 'style-dark-original')) { 1452 logo.className = logo.className.replace("style-light", "style-dark"); 1453 } 1454 if (classie.hasClass(masthead, 'style-light-original')) { 1455 logo.className = logo.className.replace("style-dark", "style-light"); 1456 } 1457 if (style != undefined) { 1458 if (style == 'dark') { 1459 classie.removeClass(transmenuel[i], 'style-light-override'); 1460 } 1461 if (style == 'light') { 1462 classie.removeClass(transmenuel[i], 'style-dark-override'); 1463 } 1464 classie.addClass(transmenuel[i], 'style-' + style + '-override'); 1465 } 1466 } else { 1467 if (style != undefined) { 1468 if (style == 'dark') { 1469 classie.removeClass(transmenuel[i], 'style-light-override'); 1470 } 1471 if (style == 'light') { 1472 classie.removeClass(transmenuel[i], 'style-dark-override'); 1473 } 1474 classie.addClass(transmenuel[i], 'style-' + style + '-override'); 1475 } 1476 } 1477 } 1478 if (pageHeader != undefined) { 1479 if (style != undefined) { 1480 if (classie.hasClass(pageHeader, 'header-style-dark')) { 1481 classie.removeClass(pageHeader, 'header-style-dark'); 1482 } 1483 if (classie.hasClass(pageHeader, 'header-style-light')) { 1484 classie.removeClass(pageHeader, 'header-style-light'); 1485 } 1486 classie.addClass(pageHeader, 'header-style-' + style); 1487 } 1488 } 1489 }, 1490 /** Parallax Rows **/
1491 parallaxRowCol = function(bodyTop) { 1492 var value; 1493 if (typeof parallaxRows == 'object') { 1494 for (var i = 0; i < parallaxRows.length; i++) { 1495 var section = parallaxRows[i].parentNode, 1496 thisHeight = outerHeight(parallaxRows[i]), 1497 sectionHeight = outerHeight(section), 1498 offSetTop = bodyTop + (section != null ? (classie.hasClass(section.parentNode.parentNode, 'owl-carousel') ? section.parentNode.parentNode.getBoundingClientRect().top : section.getBoundingClientRect().top) : 0), 1499 offSetPosition = wheight + bodyTop - offSetTop; 1500 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 1501 value = ((offSetPosition - wheight) * speedDivider); 1502 if (Math.abs(value) < (thisHeight - sectionHeight)) { 1503 translateElement(parallaxRows[i], value); 1504 } else { 1505 translateElement(parallaxRows[i], thisHeight - sectionHeight); 1506 } 1507 } 1508 } 1509 } 1510 if (typeof parallaxCols == 'object') { 1511 for (var j = 0; j < parallaxCols.length; j++) { 1512 var section = parallaxCols[j].parentNode, 1513 thisHeight = outerHeight(parallaxCols[j]), 1514 sectionHeight = outerHeight(section), 1515 offSetTop = bodyTop + (section != null ? section.getBoundingClientRect().top : 0), 1516 offSetPosition = wheight + bodyTop - offSetTop; 1517 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 1518 value = ((offSetPosition - wheight) * speedDivider); 1519 value *= .8; 1520 if (Math.abs(value) < (thisHeight - sectionHeight)) { 1521 translateElement(parallaxCols[j], value); 1522 } else { 1523 translateElement(parallaxCols[j], thisHeight - sectionHeight); 1524 } 1525 } 1526 } 1527 } 1528 }, 1529 /** Parallax Headers **/ 1530 parallaxHeader = function(bodyTop) { 1531 var value; 1532 if (typeof parallaxHeaders == 'object') { 1533 for (var i = 0; i < parallaxHeaders.length; i++) { 1534 var section = parallaxHeaders[i].parentNode, 1535 thisSibling = section.nextSibling, 1536 thisHeight, 1537 sectionHeight, 1538 offSetTop, 1539 offSetPosition; 1540 if (classie.hasClass(parallaxHeaders[i], 'header-carousel-wrapper')) { 1541 getDivChildren(parallaxHeaders[i], '.t-background-cover', function(item, l, total) { 1542 thisHeight = outerHeight(item); 1543 sectionHeight = outerHeight(section); 1544 offSetTop = bodyTop + section.getBoundingClientRect().top; 1545 offSetPosition = wheight + bodyTop - offSetTop; 1546 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 1547 value = ((offSetPosition - wheight) * speedDivider); 1548 if (Math.abs(value) < (thisHeight - sectionHeight)) { 1549 translateElement(item, value); 1550 } 1551 } 1552 }); 1553 } else { 1554 thisHeight = outerHeight(parallaxHeaders[i]); 1555 sectionHeight = outerHeight(section); 1556 offSetTop = bodyTop + section.getBoundingClientRect().top; 1557 offSetPosition = wheight + bodyTop - offSetTop; 1558 if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) { 1559 value = ((offSetPosition - wheight) * speedDivider); 1560 if (Math.abs(value) < (thisHeight - sectionHeight)) { 1561 translateElement(parallaxHeaders[i], value); 1562 } 1563 } 1564 } 1565 } 1566 } 1567 }, 1568 /** Header opacity **/ 1569 headerOpacity = function(bodyTop) { 1570 if (headerWithOpacity && headerWithOpacity.length) { 1571 var thisHeight = outerHeight(headerWithOpacity[0]); 1572 if (bodyTop > thisHeight / 8) { 1573 if (pageHeader != undefined) classie.addClass(pageHeader, 'header-scrolled'); 1574 } else { 1575 if (pageHeader != undefined) classie.removeClass(pageHeader, 'header-scrolled'); 1576 } 1577 } 1578 }, 1579 /** Show hide scroll top arrow **/ 1580 showHideScrollup = function(bodyTop) { 1581 if (bodyTop != 0) { 1582 if (bodyTop > wheight || ((bodyTop + wheight) >= docheight) && docheight > 0) { 1583 classie.addClass(document.body, 'window-scrolled'); 1584 classie.removeClass(document.body, 'hide-scrollup'); 1585 if (footerScroller && footerScroller[0] != undefined) { 1586 footerScroller[0].style.display = ''; 1587 } 1588 } else { 1589 if (classie.hasClass(document.body, 'window-scrolled')) classie.addClass(document.body, 'hide-scrollup'); 1590 classie.removeClass(document.body, 'window-scrolled'); 1591 } 1592 } 1593 }, 1594 /** Hide Menu **/ 1595 hideMenu = function(bodyTop) { 1596 if (UNCODE.menuOpened || bodyTop < 0) return; 1597 if (classie.hasClass(document.body, 'vmenu')) { 1598 if (wwidth < mediaQuery) menuhide = document.querySelector('#masthead .menu-hide-vertical'); 1599 else menuhide = null; 1600 } 1601 if (classie.hasClass(document.body, 'hmenu-center')) { 1602 if (wwidth > mediaQuery) menuhide = document.querySelector('#masthead .menu-hide'); 1603 else menuhide = document.querySelector('.menu-container-mobile.menu-hide'); 1604 } 1605 if (typeof menuhide == 'object' && menuhide != null && mainmenu[0] != undefined) { 1606 var translate, 1607 scrollingDown = true; 1608 /** fix for hmenu-center **/ 1609 var sticky_element = (typeof mainmenu.item === 'undefined' ? ((wwidth > mediaQuery) ? mainmenu[0] : mainmenu[1]) : mainmenu[0]); 1610 if (lastScrollValue == bodyTop) return; 1611 1612 if (lastScrollValue > bodyTop) scrollingDown = false;
1613 else scrollingDown = true; 1614 lastScrollValue = bodyTop; 1615 if (!scrollingDown) { 1616 if (!UNCODE.scrolling) { 1617 if ((secmenuHeight == 0) ? bodyTop == 0 : bodyTop < secmenuHeight) { 1618 classie.removeClass(sticky_element.parentNode, 'is_stuck'); 1619 if (wwidth > mediaQuery) sticky_element.style.position = ''; 1620 else sticky_element.style.position = 'fixed'; 1621 hideMenuReset(sticky_element); 1622 clearTimeout(hidingTimer); 1623 } 1624 1625 if (classie.hasClass(menuhide, 'menu-hided')) { 1626 classie.removeClass(menuhide, 'menu-hided'); 1627 hidingTimer = setTimeout(function() { 1628 classie.addClass(sticky_element.parentNode, 'is_stuck'); 1629 hideMenuReset(sticky_element); 1630 }, 400); 1631 } 1632 } 1633 } else { 1634 if (menusticky.length == 0 && bodyTop < wheight / 3) { 1635 if (sticky_element.style.position == 'fixed') sticky_element.style.position = ''; 1636 } 1637 if (bodyTop > wheight / 2) { 1638 clearTimeout(hidingTimer); 1639 if (!classie.hasClass(menuhide, 'menu-hided')) { 1640 classie.addClass(menuhide, 'menu-hided'); 1641 classie.addClass(sticky_element.parentNode, 'is_stuck'); 1642 if (sticky_element.style.position != 'fixed') { 1643 sticky_element.style.visibility = 'hidden'; 1644 sticky_element.style.position = 'fixed'; 1645 sticky_element.style.top = '0px'; 1646 } 1647 translateElement(menuhide, -UNCODE.menuMobileHeight - 1); 1648 } 1649 } 1650 } 1651 } 1652 }, 1653 hideMenuReset = function(sticky_element) { 1654 var topOffset = 0; 1655 if (sticky_element.style.visibility == 'hidden') sticky_element.style.visibility = ''; 1656 if (bodyBorder > 0) topOffset += bodyBorder; 1657 if (adminBar != null && window.getComputedStyle(adminBar,null).getPropertyValue("position") != 'fixed') adminBarHeight = 0; 1658 if (adminBarHeight > 0) topOffset += adminBarHeight; 1659 sticky_element.style.top = topOffset + 'px'; 1660 if (!classie.hasClass(document.body, 'boxed-width') && boxWidth > 0) sticky_element.style.width = boxWidth + 'px'; 1661 translateElement(menuhide, 0); 1662 }, 1663 /** Stick Menu **/ 1664 stickMenu = function(bodyTop) { 1665 if (header && mainmenu[0] != undefined) { 1666 if (classie.hasClass(mainmenu[0], 'vmenu-container') && wwidth > mediaQuery) return; 1667 /** fix for hmenu-center **/ 1668 var sticky_element = (typeof mainmenu.item === 'undefined' ? ((wwidth > mediaQuery) ? mainmenu[0] : mainmenu[1]) : mainmenu[0]); 1669 if ((secmenuHeight == 0 && wwidth > mediaQuery) ? bodyTop > (0 + adminBarHeight) : bodyTop > (secmenuHeight + adminBarHeight)) { 1670 if (sticky_element.style.position != 'fixed') { 1671 classie.addClass(sticky_element.parentNode, 'is_stuck'); 1672 sticky_element.style.position = 'fixed'; 1673 var getAnchorTop = bodyBorder; 1674 if (adminBar != null && window.getComputedStyle(adminBar,null).getPropertyValue("position") != 'fixed') adminBarHeight = 0; 1675 if (adminBarHeight > 0) getAnchorTop += adminBarHeight; 1676 sticky_element.style.top = getAnchorTop + 'px'; 1677 if (!classie.hasClass(document.body, 'boxed-width') && boxWidth > 0) sticky_element.style.width = boxWidth + 'px'; 1678 } 1679 } else { 1680 clearTimeout(hidingTimer); 1681 classie.removeClass(sticky_element.parentNode, 'is_stuck'); 1682 if (wwidth > mediaQuery) sticky_element.style.position = ''; 1683 else sticky_element.style.position = 'fixed'; 1684 sticky_element.style.top = ''; 1685 } 1686 } 1687 }, 1688 translateElement = function(element, valueY) { 1689 var translate = 'translate3d(0, ' + valueY + 'px' + ', 0)'; 1690 element.style['-webkit-transform'] = translate; 1691 element.style['-moz-transform'] = translate; 1692 element.style['-ms-transform'] = translate; 1693 element.style['-o-transform'] = translate; 1694 element.style['transform'] = translate; 1695 }, 1696 scrollFunction = function() { 1697 if (logoel != undefined && logoel.length && !isMobile) shrinkMenu(bodyTop); 1698 if (menusticky != undefined && menusticky.length) stickMenu(bodyTop); 1699 hideMenu(bodyTop); 1700 if (!isMobile) { 1701 if (header && menusticky != undefined && menusticky.length) switchColorsMenu(bodyTop); 1702 parallaxRowCol(bodyTop); 1703 parallaxHeader(bodyTop); 1704 headerOpacity(bodyTop); 1705 } 1706 }; 1707 if (!noScroll) { 1708 window.addEventListener('scroll', function(e) { 1709 bodyTop = document.documentElement.scrollTop || document.body.scrollTop; 1710 scrollFunction(); 1711 showHideScrollup(bodyTop); 1712 }, false); 1713 } 1714 /** All scrolling functions - End */ 1715 /** help functions */ 1716 function getClosest(el, tag) { 1717 do { 1718 if (el.className != undefined && el.className.indexOf(tag) > -1) return el; 1719 } while (el = el.parentNode); 1720 // not found :( 1721 return null; 1722 } 1723 1724 function outerHeight(el, includeMargin) { 1725 if (el != null) { 1726 var height = el.offsetHeight; 1727 if (includeMargin) { 1728 var style = el.currentStyle || getComputedStyle(el); 1729 height += parseInt(style.marginTop) + parseInt(style.marginBottom); 1730 } 1731 return height; 1732 } 1733 } 1734 1735 function outerWidth(el, includeMargin) { 1736 var width = el.offsetWidth; 1737 if (includeMargin) { 1738 var style = el.currentStyle || getComputedStyle(el); 1739 width += parseInt(style.marginLeft) + parseInt(style.marginRight); 1740 } 1741 return width; 1742 } 1743 // Replicate jQuery .each method 1744 function forEachElement(selector, fn) { 1745 var elements = document.querySelectorAll(selector); 1746 for (var i = 0; i < elements.length; i++) fn(elements[i], i); 1747 } 1748 1749 function getDivChildren(containerId, selector, fn) { 1750 if (containerId !== null) { 1751 var elements = containerId.querySelectorAll(selector); 1752 for (var i = 0; i < elements.length; i++) fn(elements[i], i, elements.length); 1753 } 1754 } 1755 1756 function hideFooterScroll() { 1757 if (classie.hasClass(document.body, 'hide-scrollup')) footerScroller[0].style.display = "none"; 1758 } 1759 document.addEventListener("DOMContentLoaded", function(event) { 1760 UNCODE.adaptive(); 1761 boxWrapper = document.querySelectorAll('.box-wrapper'); 1762 docheight = boxWrapper[0] != undefined ? boxWrapper[0].offsetHeight : 0; 1763 if (!classie.hasClass(document.body, 'vmenu') && !classie.hasClass(document.body, 'menu-offcanvas')) init_overlay(); 1764 if (!UNCODE.isMobile) {
1765 parallaxRows = document.querySelectorAll('.with-parallax > .row-background > .background-wrapper'); 1766 parallaxCols = document.querySelectorAll('.with-parallax > .column-background > .background-wrapper'); 1767 } 1768 footerScroller = document.querySelectorAll('.footer-scroll-top'); 1769 if (footerScroller && footerScroller[0] != undefined) { 1770 if (transitionEvent) { 1771 footerScroller[0].addEventListener(transitionEvent, hideFooterScroll); 1772 } 1773 } 1774 Array.prototype.forEach.call(document.querySelectorAll('.row-inner'), function(el) { 1775 el.style.height = ''; 1776 el.style.marginBottom = ''; 1777 }); 1778 setRowHeight(document.querySelectorAll('.page-wrapper .row-parent')); 1779 }); 1780 /** On resize events **/ 1781 window.addEventListener("resize", function() { 1782 docheight = (boxWrapper != undefined && boxWrapper[0] != undefined) ? boxWrapper[0].offsetHeight : 0; 1783 var oldWidth = wwidth; 1784 UNCODE.wwidth = wwidth = window.innerWidth || document.documentElement.clientWidth; 1785 UNCODE.wheight = wheight = (window.innerHeight || document.documentElement.clientHeight) - (bodyBorder * 2); 1786 if (isSplitMenu) centerSplitMenu(); 1787 if (isMobile && (oldWidth == wwidth)) return false; 1788 calculateMenuHeight(false); 1789 initBox(); 1790 headerHeight('.header-wrapper'); 1791 window.dispatchEvent(boxEvent); 1792 if (!isMobile) { 1793 setTimeout(function() { 1794 initVideoComponent(document.body, '.uncode-video-container.video, .uncode-video-container.self-video'); 1795 }, 100); 1796 } 1797 scrollFunction(); 1798 showHideScrollup(bodyTop); 1799 clearTimeout(resizeTimer); 1800 resizeTimer = setTimeout(function() { 1801 UNCODE.wheight = wheight = (window.innerHeight || document.documentElement.clientHeight) - (bodyBorder * 2); 1802 Array.prototype.forEach.call(document.querySelectorAll('.row-inner'), function(el) { 1803 el.style.height = ''; 1804 el.style.marginBottom = ''; 1805 }); 1806 setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true); 1807 }, 500); 1808 }); 1809 1810 /** 1811 * On DOM ready 1812 */ 1813 window.addEventListener("load", function(){ 1814 if (!UNCODE.isMobile) { 1815 setTimeout(function() { 1816 window.dispatchEvent(UNCODE.boxEvent); 1817 Waypoint.refreshAll(); 1818 }, 2000); 1819 } 1820 showHideScrollup(bodyTop); 1821 if (document.createEvent) { // W3C 1822 var ev = document.createEvent('Event'); 1823 ev.initEvent('resize', true, true); 1824 window.dispatchEvent(ev); 1825 } else { // IE 1826 document.fireEvent('onresize'); 1827 } 1828 }, false); 1829 1830 var UNCODE = { 1831 bodyTop: bodyTop, 1832 boxEvent: boxEvent, 1833 bodyBorder: bodyBorder, 1834 initBox: initBox, 1835 adminBarHeight: 0, 1836 menuHeight: 0, 1837 menuMobileHeight: 0, 1838 fixMenuHeight: fixMenuHeight, 1839 initHeader: initHeader, 1840 initRow: initRow, 1841 setRowHeight: setRowHeight, 1842 switchColorsMenu: switchColorsMenu, 1843 isMobile: isMobile, 1844 scrolling: false, 1845 menuHiding: false, 1846 menuOpened: false, 1847 menuMobileTriggerEvent: menuMobileTriggerEvent, 1848 mediaQuery: mediaQuery, 1849 initVideoComponent: initVideoComponent, 1850 hideMenu: hideMenu, 1851 wwidth: wwidth, 1852 wheight: wheight, 1853 }; 1854 // transport 1855 if (typeof define === 'function' && define.amd) { 1856 // AMD 1857 define(UNCODE); 1858 } else { 1859 // browser global 1860 window.UNCODE = UNCODE; 1861 } 1862 1863 UNCODE.adaptive = function() { 1864 var images = new Array(), 1865 getImages = document.querySelectorAll('.adaptive-async:not(.adaptive-fetching)'); 1866 for (var i = 0; i < getImages.length; i++) { 1867 var imageObj = {}, 1868 el = getImages[i]; 1869 classie.addClass(el, 'adaptive-fetching'); 1870 imageObj.unique = el.getAttribute('data-uniqueid'); 1871 imageObj.url = el.getAttribute('data-guid'); 1872 imageObj.path = el.getAttribute('data-path'); 1873 imageObj.singlew = el.getAttribute('data-singlew'); 1874 imageObj.singleh = el.getAttribute('data-singleh'); 1875 imageObj.origwidth = el.getAttribute('data-width'); 1876 imageObj.origheight = el.getAttribute('data-height'); 1877 imageObj.crop = el.getAttribute('data-crop'); 1878 imageObj.fixed = el.getAttribute('data-fixed') == undefined ? null : el.getAttribute('data-fixed'); 1879 imageObj.screen = window.uncodeScreen; 1880 imageObj.images = window.uncodeImages; 1881 images.push(imageObj); 1882 } 1883 var jsonString = JSON.stringify(images); 1884 var data = new Array(); 1885 data['action'] = 'get_adaptive_async'; 1886 data['images'] = jsonString;
1887 data['cache'] = 'false'; 1888 1889 if (images.length > 0) { 1890 var xmlhttp; 1891 if (window.XMLHttpRequest) { 1892 // code for IE7+, Firefox, Chrome, Opera, Safari 1893 xmlhttp = new XMLHttpRequest(); 1894 } else { 1895 // code for IE6, IE5 1896 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 1897 } 1898 xmlhttp.onreadystatechange = function() { 1899 if (xmlhttp.readyState == XMLHttpRequest.DONE ) { 1900 if(xmlhttp.status == 200){ 1901 var images = JSON.parse(xmlhttp.responseText); 1902 for (var i = 0; i < images.length; i++) { 1903 var val = images[i], 1904 getImage = document.querySelectorAll('[data-uniqueid="'+val.unique+'"]'); 1905 for (var j = 0; j < getImage.length; j++) { 1906 var attrScr = getImage[j].getAttribute('src'), 1907 replaceImg = new Image(); 1908 replaceImg.source = attrScr; 1909 replaceImg.el = getImage[j]; 1910 1911 classie.removeClass(getImage[j], 'adaptive-async'); 1912 classie.removeClass(getImage[j], 'adaptive-fetching'); 1913 1914 replaceImg.onload = function () { 1915 if (this.source !== null) { 1916 (this.el).src = this.src; 1917 } else { 1918 (this.el).style.backgroundImage = 'url("'+this.src+'")'; 1919 } 1920 classie.addClass(this.el, 'async-done'); 1921 } 1922 replaceImg.src = val.url; 1923 } 1924 } 1925 } 1926 else if(xmlhttp.status == 400) { 1927 console.log('There was an error 400') 1928 } 1929 else { 1930 console.log('something else other than 200 was returned') 1931 } 1932 } 1933 } 1934 //Serialize the data 1935 var queryString = "", 1936 arrayLength = Object.keys(data).length, 1937 arrayCounter = 0; 1938 1939 for (var key in data) { 1940 queryString += key + "=" + data[key]; 1941 if(arrayCounter < arrayLength - 1) { 1942 queryString += "&"; 1943 } 1944 arrayCounter++; 1945 } 1946 1947 xmlhttp.open("POST", SiteParameters.theme_directory + '/core/inc/uncode-ajax.php', true); 1948 xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 1949 xmlhttp.send(queryString); 1950 1951 } 1952 }; 1953 1954})(window); 1955 1956 1957 1958/** 1959 * vivus - JavaScript library to make drawing animation on SVG 1960 * @version v0.3.1 1961 * @link https://github.com/maxwellito/vivus 1962 * @license MIT 1963 */ 1964 1965'use strict'; 1966 1967(function (window, document) { 1968 1969 'use strict'; 1970 1971/** 1972 * Pathformer 1973 * Beta version 1974 * 1975 * Take any SVG version 1.1 and transform 1976 * child elements to 'path' elements 1977 * 1978 * This code is purely forked from 1979 * https://github.com/Waest/SVGPathConverter 1980 */ 1981 1982/** 1983 * Class constructor 1984 * 1985 * @param {DOM|String} element Dom element of the SVG or id of it 1986 */ 1987function Pathformer(element) { 1988 // Test params 1989 if (typeof element === 'undefined') { 1990 throw new Error('Pathformer [constructor]: "element" parameter is required'); 1991 } 1992 1993 // Set the element 1994 if (element.constructor === String) { 1995 element = document.getElementById(element); 1996 if (!element) { 1997 throw new Error('Pathformer [constructor]: "element" parameter is not related to an existing ID'); 1998 } 1999 } 2000 if (element.constructor instanceof window.SVGElement || /^svg$/i.test(element.nodeName)) { 2001 this.el = element; 2002 } else { 2003 throw new Error('Pathformer [constructor]: "element" parameter must be a string or a SVGelement'); 2004 } 2005 2006 // Start 2007 this.scan(element); 2008} 2009 2010/** 2011 * List of tags which can be transformed 2012 * to path elements 2013 * 2014 * @type {Array} 2015 */ 2016Pathformer.prototype.TYPES = ['line', 'ellipse', 'circle', 'polygon', 'polyline', 'rect']; 2017 2018/** 2019 * List of attribute names which contain 2020 * data. This array list them to check if 2021 * they contain bad values, like percentage. 2022 * 2023 * @type {Array} 2024 */ 2025Pathformer.prototype.ATTR_WATCH = ['cx', 'cy', 'points', 'r', 'rx', 'ry', 'x', 'x1', 'x2', 'y', '
2025y1', 'y2']; 2026 2027/** 2028 * Finds the elements compatible for transform 2029 * and apply the liked method 2030 * 2031 * @param {object} options Object from the constructor 2032 */ 2033Pathformer.prototype.scan = function (svg) { 2034 var fn, element, pathData, pathDom, 2035 elements = svg.querySelectorAll(this.TYPES.join(',')); 2036 for (var i = 0; i < elements.length; i++) { 2037 element = elements[i]; 2038 fn = this[element.tagName.toLowerCase() + 'ToPath']; 2039 pathData = fn(this.parseAttr(element.attributes)); 2040 pathDom = this.pathMaker(element, pathData); 2041 element.parentNode.replaceChild(pathDom, element); 2042 } 2043}; 2044 2045 2046/** 2047 * Read `line` element to extract and transform 2048 * data, to make it ready for a `path` object. 2049 * 2050 * @param {DOMelement} element Line element to transform 2051 * @return {object} Data for a `path` element 2052 */ 2053Pathformer.prototype.lineToPath = function (element) { 2054 var newElement = {}; 2055 newElement.d = 'M' + element.x1 + ',' + element.y1 + 'L' + element.x2 + ',' + element.y2; 2056 return newElement; 2057}; 2058 2059/** 2060 * Read `rect` element to extract and transform 2061 * data, to make it ready for a `path` object. 2062 * The radius-border is not taken in charge yet. 2063 * (your help is more than welcomed) 2064 * 2065 * @param {DOMelement} element Rect element to transform 2066 * @return {object} Data for a `path` element 2067 */ 2068Pathformer.prototype.rectToPath = function (element) { 2069 var newElement = {}, 2070 x = parseFloat(element.x) || 0, 2071 y = parseFloat(element.y) || 0, 2072 width = parseFloat(element.width) || 0, 2073 height = parseFloat(element.height) || 0; 2074 newElement.d = 'M' + x + ' ' + y + ' '; 2075 newElement.d += 'L' + (x + width) + ' ' + y + ' '; 2076 newElement.d += 'L' + (x + width) + ' ' + (y + height) + ' '; 2077 newElement.d += 'L' + x + ' ' + (y + height) + ' Z'; 2078 return newElement; 2079}; 2080 2081/** 2082 * Read `polyline` element to extract and transform 2083 * data, to make it ready for a `path` object. 2084 * 2085 * @param {DOMelement} element Polyline element to transform 2086 * @return {object} Data for a `path` element 2087 */ 2088Pathformer.prototype.polylineToPath = function (element) { 2089 var i, path; 2090 var newElement = {}; 2091 var points = element.points.trim().split(' '); 2092 2093 // Reformatting if points are defined without commas 2094 if (element.points.indexOf(',') === -1) { 2095 var formattedPoints = []; 2096 for (i = 0; i < points.length; i+=2) { 2097 formattedPoints.push(points[i] + ',' + points[i+1]); 2098 } 2099 points = formattedPoints; 2100 } 2101 2102 // Generate the path.d value 2103 path = 'M' + points[0]; 2104 for(i = 1; i < points.length; i++) { 2105 if (points[i].indexOf(',') !== -1) { 2106 path += 'L' + points[i]; 2107 } 2108 } 2109 newElement.d = path; 2110 return newElement; 2111}; 2112 2113/** 2114 * Read `polygon` element to extract and transform 2115 * data, to make it ready for a `path` object. 2116 * This method rely on polylineToPath, because the 2117 * logic is similar. The path created is just closed, 2118 * so it needs an 'Z' at the end. 2119 * 2120 * @param {DOMelement} element Polygon element to transform 2121 * @return {object} Data for a `path` element 2122 */ 2123Pathformer.prototype.polygonToPath = function (element) { 2124 var newElement = Pathformer.prototype.polylineToPath(element); 2125 newElement.d += 'Z'; 2126 return newElement; 2127}; 2128 2129/** 2130 * Read `ellipse` element to extract and transform 2131 * data, to make it ready for a `path` object. 2132 * 2133 * @param {DOMelement} element ellipse element to transform 2134 * @return {object} Data for a `path` element 2135 */ 2136Pathformer.prototype.ellipseToPath = function (element) { 2137 var startX = element.cx - element.rx, 2138 startY = element.cy; 2139 var endX = parseFloat(element.cx) + parseFloat(element.rx), 2140 endY = element.cy; 2141 2142 var newElement = {}; 2143 newElement.d = 'M' + startX + ',' + startY + 2144 'A' + element.rx + ',' + element.ry + ' 0,1,1 ' + endX + ',' + endY + 2145 'A' + element.rx + ',' + element.ry + ' 0,1,1 ' + startX + ',' + endY; 2146 return newElement; 2147}; 2148 2149/** 2150 * Read `circle` element to extract and transform 2151 * data, to make it ready for a `path` object. 2152 * 2153 * @param {DOMelement} element Circle element to transform 2154 * @return {object} Data for a `path` element 2155 */ 2156Pathformer.prototype.circleToPath = function (element) { 2157 var newElement = {}; 2158 var startX = element.cx - element.r, 2159 startY = element.cy; 2160 var endX = parseFloat(element.cx) + parseFloat(element.r), 2161 endY = element.cy; 2162 newElement.d = 'M' + startX + ',' + startY + 2163 'A' + element.r + ',' + element.r + ' 0,1,1 ' + endX + ',' + endY + 2164 'A' + element.r + ',' + element.r + ' 0,1,1 ' + startX + ',' + endY; 2165 return newElement; 2166}; 2167 2168/** 2169 * Create `path` elements form original element 2170 * and prepared objects 2171 * 2172 * @param {DOMelement} element Original element to transform 2173 * @param {object} pathData Path data (from `toPath` methods) 2174 * @return {DOMelement} Path element 2175 */ 2176Pathformer.prototype.pathMaker = function (element, pathData) { 2177 var i, attr, pathTag = document.createElementNS('http://www.w3.org/2000/svg','path'); 2178 for(i = 0; i < element.attributes.length; i++) { 2179 attr = element.attributes[i];
vendor: 6,058 bytes, lines 2180-2372
2180 if (this.ATTR_WATCH.indexOf(attr.name) === -1) { 2181 pathTag.setAttribute(attr.name, attr.value); 2182 } 2183 } 2184 for(i in pathData) { 2185 pathTag.setAttribute(i, pathData[i]); 2186 } 2187 return pathTag; 2188}; 2189 2190/** 2191 * Parse attributes of a DOM element to 2192 * get an object of attribute => value 2193 * 2194 * @param {NamedNodeMap} attributes Attributes object from DOM element to parse 2195 * @return {object} Object of attributes 2196 */ 2197Pathformer.prototype.parseAttr = function (element) { 2198 var attr, output = {}; 2199 for (var i = 0; i < element.length; i++) { 2200 attr = element[i]; 2201 // Check if no data attribute contains '%', or the transformation is impossible 2202 if (this.ATTR_WATCH.indexOf(attr.name) !== -1 && attr.value.indexOf('%') !== -1) { 2203 throw new Error('Pathformer [parseAttr]: a SVG shape got values in percentage. This cannot be transformed into \'path\' tags. Please use \'viewBox\'.'); 2204 } 2205 output[attr.name] = attr.value; 2206 } 2207 return output; 2208}; 2209 2210 'use strict'; 2211 2212var requestAnimFrame, cancelAnimFrame, parsePositiveInt; 2213 2214/** 2215 * Vivus 2216 * Beta version 2217 * 2218 * Take any SVG and make the animation 2219 * to give give the impression of live drawing 2220 * 2221 * This in more than just inspired from codrops 2222 * At that point, it's a pure fork. 2223 */ 2224 2225/** 2226 * Class constructor 2227 * option structure 2228 * type: 'delayed'|'async'|'oneByOne'|'script' (to know if the item must be drawn asynchronously or not, default: delayed) 2229 * duration: <int> (in frames) 2230 * start: 'inViewport'|'manual'|'autostart' (start automatically the animation, default: inViewport) 2231 * delay: <int> (delay between the drawing of first and last path) 2232 * dashGap <integer> whitespace extra margin between dashes 2233 * pathTimingFunction <function> timing animation function for each path element of the SVG 2234 * animTimingFunction <function> timing animation function for the complete SVG 2235 * forceRender <boolean> force the browser to re-render all updated path items 2236 * selfDestroy <boolean> removes all extra styling on the SVG, and leaves it as original 2237 * 2238 * The attribute 'type' is by default on 'delayed'. 2239 * - 'delayed' 2240 * all paths are draw at the same time but with a 2241 * little delay between them before start 2242 * - 'async' 2243 * all path are start and finish at the same time 2244 * - 'oneByOne' 2245 * only one path is draw at the time 2246 * the end of the first one will trigger the draw 2247 * of the next one 2248 * 2249 * All these values can be overwritten individually 2250 * for each path item in the SVG 2251 * The value of frames will always take the advantage of 2252 * the duration value. 2253 * If you fail somewhere, an error will be thrown. 2254 * Good luck. 2255 * 2256 * @constructor 2257 * @this {Vivus} 2258 * @param {DOM|String} element Dom element of the SVG or id of it 2259 * @param {Object} options Options about the animation 2260 * @param {Function} callback Callback for the end of the animation 2261 */ 2262function Vivus (element, options, callback) { 2263 2264 // Setup 2265 this.isReady = false; 2266 this.setElement(element, options); 2267 this.setOptions(options); 2268 this.setCallback(callback); 2269 2270 if (this.isReady) { 2271 this.init(); 2272 } 2273} 2274 2275/** 2276 * Timing functions 2277 ************************************** 2278 * 2279 * Default functions to help developers. 2280 * It always take a number as parameter (between 0 to 1) then 2281 * return a number (between 0 and 1) 2282 */ 2283Vivus.LINEAR = function (x) {return x;}; 2284Vivus.EASE = function (x) {return -Math.cos(x * Math.PI) / 2 + 0.5;}; 2285Vivus.EASE_OUT = function (x) {return 1 - Math.pow(1-x, 3);}; 2286Vivus.EASE_IN = function (x) {return Math.pow(x, 3);}; 2287Vivus.EASE_OUT_BOUNCE = function (x) { 2288 var base = -Math.cos(x * (0.5 * Math.PI)) + 1, 2289 rate = Math.pow(base,1.5), 2290 rateR = Math.pow(1 - x, 2), 2291 progress = -Math.abs(Math.cos(rate * (2.5 * Math.PI) )) + 1; 2292 return (1- rateR) + (progress * rateR); 2293}; 2294 2295 2296/** 2297 * Setters 2298 ************************************** 2299 */ 2300 2301/** 2302 * Check and set the element in the instance 2303 * The method will not return anything, but will throw an 2304 * error if the parameter is invalid 2305 * 2306 * @param {DOM|String} element SVG Dom element or id of it 2307 */ 2308Vivus.prototype.setElement = function (element, options) { 2309 // Basic check 2310 if (typeof element === 'undefined') { 2311 throw new Error('Vivus [constructor]: "element" parameter is required'); 2312 } 2313 2314 // Set the element 2315 if (element.constructor === String) { 2316 element = document.getElementById(element); 2317 if (!element) { 2318 throw new Error('Vivus [constructor]: "element" parameter is not related to an existing ID'); 2319 } 2320 } 2321 this.parentEl = element; 2322 2323 // Create the object element if the property `file` exists in the options object 2324 if (options && options.file) { 2325 var objElm = document.createElement('object'); 2326 objElm.setAttribute('type', 'image/svg+xml'); 2327 objElm.setAttribute('data', options.file); 2328 objElm.setAttribute('built-by-vivus', 'true'); 2329 element.appendChild(objElm); 2330 element = objElm; 2331 } 2332 2333 switch (element.constructor) { 2334 case window.SVGSVGElement: 2335 case window.SVGElement: 2336 this.el = element; 2337 this.isReady = true; 2338 break; 2339 2340 case window.HTMLObjectElement: 2341 // If we have to wait for it 2342 var onLoad, self; 2343 2344 self = this; 2345 onLoad = function (e) { 2346 if (self.isReady) { 2347 return; 2348 } 2349 self.el = element.contentDocument && element.contentDocument.querySelector('svg'); 2350 if (!self.el && e) { 2351 throw new Error('Vivus [constructor]: object loaded does not contain any SVG'); 2352 } 2353 else if (self.el) { 2354 if (element.getAttribute('built-by-vivus')) { 2355 self.parentEl.insertBefore(self.el, element); 2356 self.parentEl.removeChild(element); 2357 self.el.setAttribute('width', '100%'); 2358 self.el.setAttribute('height', '100%'); 2359 } 2360 self.isReady = true; 2361 self.init(); 2362 return true; 2363 } 2364 }; 2365 2366 if (!onLoad()) { 2367 element.addEventListener('load', onLoad); 2368 } 2369 break; 2370 2371 default: 2372 throw new Error('Vivus [constructor]: "element" parameter is not val
2372id (or miss the "file" attribute)'); 2373 } 2374}; 2375 2376/** 2377 * Set up user option to the instance 2378 * The method will not return anything, but will throw an 2379 * error if the parameter is invalid 2380 * 2381 * @param {object} options Object from the constructor 2382 */ 2383Vivus.prototype.setOptions = function (options) { 2384 var allowedTypes = ['delayed', 'async', 'oneByOne', 'scenario', 'scenario-sync']; 2385 var allowedStarts = ['inViewport', 'manual', 'autostart']; 2386 2387 // Basic check 2388 if (options !== undefined && options.constructor !== Object) { 2389 throw new Error('Vivus [constructor]: "options" parameter must be an object'); 2390 } 2391 else { 2392 options = options || {}; 2393 } 2394 2395 // Set the animation type 2396 if (options.type && allowedTypes.indexOf(options.type) === -1) { 2397 throw new Error('Vivus [constructor]: ' + options.type + ' is not an existing animation `type`'); 2398 } 2399 else { 2400 this.type = options.type || allowedTypes[0]; 2401 } 2402 2403 // Set the start type 2404 if (options.start && allowedStarts.indexOf(options.start) === -1) { 2405 throw new Error('Vivus [constructor]: ' + options.start + ' is not an existing `start` option'); 2406 } 2407 else { 2408 this.start = options.start || allowedStarts[0]; 2409 } 2410 2411 this.isIE = (window.navigator.userAgent.indexOf('MSIE') !== -1 || window.navigator.userAgent.indexOf('Trident/') !== -1 || window.navigator.userAgent.indexOf('Edge/') !== -1 ); 2412 this.duration = parsePositiveInt(options.duration, 120); 2413 this.delay = parsePositiveInt(options.delay, null); 2414 this.delayStart = parsePositiveInt(options.delayStart, null); 2415 this.dashGap = parsePositiveInt(options.dashGap, 1); 2416 this.forceRender = options.hasOwnProperty('forceRender') ? !!options.forceRender : this.isIE; 2417 this.selfDestroy = !!options.selfDestroy; 2418 this.onReady = options.onReady; 2419 this.frameLength = this.currentFrame = this.map = this.delayUnit = this.speed = this.handle = null; 2420 2421 this.ignoreInvisible = options.hasOwnProperty('ignoreInvisible') ? !!options.ignoreInvisible : false; 2422 2423 this.animTimingFunction = options.animTimingFunction || Vivus.LINEAR; 2424 this.pathTimingFunction = options.pathTimingFunction || Vivus.LINEAR; 2425 2426 if (this.delay >= this.duration) { 2427 throw new Error('Vivus [constructor]: delay must be shorter than duration'); 2428 } 2429}; 2430 2431/** 2432 * Set up callback to the instance 2433 * The method will not return enything, but will throw an 2434 * error if the parameter is invalid 2435 * 2436 * @param {Function} callback Callback for the animation end 2437 */ 2438Vivus.prototype.setCallback = function (callback) { 2439 // Basic check 2440 if (!!callback && callback.constructor !== Function) { 2441 throw new Error('Vivus [constructor]: "callback" parameter must be a function'); 2442 } 2443 this.callback = callback || function () {}; 2444}; 2445 2446 2447/** 2448 * Core 2449 ************************************** 2450 */ 2451 2452/** 2453 * Map the svg, path by path. 2454 * The method return nothing, it just fill the 2455 * `map` array. Each item in this array represent 2456 * a path element from the SVG, with informations for 2457 * the animation. 2458 * 2459 * ``` 2460 * [ 2461 * { 2462 * el: <DOMobj> the path element 2463 * length: <number> length of the path line 2464 * startAt: <number> time start of the path animation (in frames) 2465 * duration: <number> path animation duration (in frames) 2466 * }, 2467 * ... 2468 * ] 2469 * ``` 2470 * 2471 */ 2472Vivus.prototype.mapping = function () { 2473 var i, paths, path, pAttrs, pathObj, totalLength, lengthMeter, timePoint; 2474 timePoint = totalLength = lengthMeter = 0; 2475 paths = this.el.querySelectorAll('path'); 2476 2477 for (i = 0; i < paths.length; i++) { 2478 path = paths[i]; 2479 if (this.isInvisible(path)) { 2480 continue; 2481 } 2482 pathObj = { 2483 el: path, 2484 length: Math.ceil(path.getTotalLength()) 2485 }; 2486 // Test if the path length is correct 2487 if (isNaN(pathObj.length)) { 2488 if (window.console && console.warn) { 2489 console.warn('Vivus [mapping]: cannot retrieve a path element length', path); 2490 } 2491 continue; 2492 } 2493 this.map.push(pathObj); 2494 path.style.strokeDasharray = pathObj.length + ' ' + (pathObj.length + this.dashGap * 2); 2495 path.style.strokeDashoffset = pathObj.length + this.dashGap; 2496 pathObj.length += this.dashGap; 2497 totalLength += pathObj.length; 2498 2499 this.renderPath(i); 2500 } 2501 2502 totalLength = totalLength === 0 ? 1 : totalLength; 2503 this.delay = this.delay === null ? this.duration / 3 : this.delay; 2504 this.delayUnit = this.delay / (paths.length > 1 ? paths.length - 1 : 1); 2505 2506 for (i = 0; i < this.map.length; i++) { 2507 pathObj = this.map[i]; 2508 2509 switch (this.type) { 2510 case 'delayed': 2511 pathObj.startAt = this.delayUnit * i; 2512 pathObj.duration = this.duration - this.delay; 2513 break; 2514 2515 case 'oneByOne': 2516 pathObj.startAt = lengthMeter / totalLength * this.duration; 2517 pathObj.duration = pathObj.length / totalLength * this.duration; 2518 break; 2519 2520 case 'async': 2521 pathObj.startAt = 0; 2522 pathObj.duration = this.duration; 2523 break; 2524 2525 case 'scenario-sync': 2526 path = pathObj.el; 2527 pAttrs = this.parseAttr(path); 2528 pathObj.startAt = timePoint + (parsePositiveInt(pAttrs['data-delay'], this.delayUnit) || 0); 2529 pathObj.duration = parsePositiveInt(pAttrs['data-duration'], this.duration); 2530 timePoint = pAttrs['data-async'] !== undefined ? pathObj.startAt : pathObj.startAt + pathObj.duration; 2531 this.frameLength = Math.max(this.frameLength, (pathObj.startAt + pathObj.duration)); 2532 break; 2533 2534 case 'scenario': 2535 path = pathObj.el; 2536 pAttrs = this.parseAttr(path); 2537 pathObj.startAt = parsePositiveInt(pAttrs['data-start'], this.delayUnit) || 0; 2538 pathObj.duration = parsePositiveInt(pAttrs['data-duration'], this.duration); 2539 this.frameLength = Math.max(this.frameLength, (pathObj.startAt + pathObj.duration)); 2540 break; 2541 } 2542 lengthMeter += pathObj.length; 2543 this.frameLength = this.frameLength || this.duration; 2544 } 2545}; 2546 2547/** 2548 * Interval method to draw the SVG from current 2549 * position of the animation. It update the value of 2550 * `currentFrame` and re-trace the SVG. 2551 * 2552 * It use this.handle to store the requestAnimationFrame 2553 * and clear it one the animation is stopped. So this 2554 * attribute can be used to know if the animation is 2555 * playing. 2556 * 2557 * Once the animation at the end, this method will 2558 * trigger the Vivus callback. 2559 * 2560 */ 2561Vivus.prototype.drawer = function () { 2562 var self = this; 2563 this.currentFrame += this.speed; 2564 2565 if (this.currentFrame <= 0) { 2566 this.stop(); 2567 this.reset(); 2568 this.callback(this); 2569 } else if (this.currentFrame >= this.frameLength) { 2570 this.stop(); 2571 this.currentFrame = this.frameLength; 2572 this.trace();
2573 if (this.selfDestroy) { 2574 this.destroy(); 2575 } 2576 this.callback(this); 2577 } else { 2578 this.trace(); 2579 this.handle = requestAnimFrame(function () { 2580 self.drawer(); 2581 }); 2582 } 2583}; 2584 2585/** 2586 * Draw the SVG at the current instant from the 2587 * `currentFrame` value. Here is where most of the magic is. 2588 * The trick is to use the `strokeDashoffset` style property. 2589 * 2590 * For optimisation reasons, a new property called `progress` 2591 * is added in each item of `map`. This one contain the current 2592 * progress of the path element. Only if the new value is different 2593 * the new value will be applied to the DOM element. This 2594 * method save a lot of resources to re-render the SVG. And could 2595 * be improved if the animation couldn't be played forward. 2596 * 2597 */ 2598Vivus.prototype.trace = function () { 2599 var i, progress, path, currentFrame; 2600 currentFrame = this.animTimingFunction(this.currentFrame / this.frameLength) * this.frameLength; 2601 for (i = 0; i < this.map.length; i++) { 2602 path = this.map[i]; 2603 progress = (currentFrame - path.startAt) / path.duration; 2604 progress = this.pathTimingFunction(Math.max(0, Math.min(1, progress))); 2605 if (path.progress !== progress) { 2606 path.progress = progress; 2607 path.el.style.strokeDashoffset = Math.floor(path.length * (1 - progress)); 2608 this.renderPath(i); 2609 } 2610 } 2611}; 2612 2613/** 2614 * Method forcing the browser to re-render a path element 2615 * from it's index in the map. Depending on the `forceRender` 2616 * value. 2617 * The trick is to replace the path element by it's clone. 2618 * This practice is not recommended because it's asking more 2619 * ressources, too much DOM manupulation.. 2620 * but it's the only way to let the magic happen on IE. 2621 * By default, this fallback is only applied on IE. 2622 * 2623 * @param {Number} index Path index 2624 */ 2625Vivus.prototype.renderPath = function (index) { 2626 if (this.forceRender && this.map && this.map[index]) { 2627 var pathObj = this.map[index], 2628 newPath = pathObj.el.cloneNode(true); 2629 try { 2630 pathObj.el.parentNode.replaceChild(newPath, pathObj.el); 2631 } catch(err) {} 2632 pathObj.el = newPath; 2633 } 2634}; 2635 2636/** 2637 * When the SVG object is loaded and ready, 2638 * this method will continue the initialisation. 2639 * 2640 * This this mainly due to the case of passing an 2641 * object tag in the constructor. It will wait 2642 * the end of the loading to initialise. 2643 * 2644 */ 2645Vivus.prototype.init = function () { 2646 // Set object variables 2647 this.frameLength = 0; 2648 this.currentFrame = 0; 2649 this.map = []; 2650 2651 // Start 2652 new Pathformer(this.el); 2653 this.mapping(); 2654 this.starter(); 2655 2656 if (this.onReady) { 2657 this.onReady(this); 2658 } 2659}; 2660 2661/** 2662 * Trigger to start of the animation. 2663 * Depending on the `start` value, a different script 2664 * will be applied. 2665 * 2666 * If the `start` value is not valid, an error will be thrown. 2667 * Even if technically, this is impossible. 2668 * 2669 */ 2670Vivus.prototype.starter = function () { 2671 switch (this.start) { 2672 case 'manual': 2673 return; 2674 2675 case 'autostart': 2676 this.play(); 2677 break; 2678 2679 case 'inViewport': 2680 var self = this, 2681 listener = function () { 2682 if (self.isInViewport(self.parentEl, 1)) { 2683 self.play(); 2684 window.removeEventListener('scroll', listener); 2685 } 2686 }; 2687 window.addEventListener('scroll', listener); 2688 listener(); 2689 break; 2690 } 2691}; 2692 2693 2694/** 2695 * Controls 2696 ************************************** 2697 */ 2698 2699/** 2700 * Get the current status of the animation between 2701 * three different states: 'start', 'progress', 'end'. 2702 * @return {string} Instance status 2703 */ 2704Vivus.prototype.getStatus = function () { 2705 return this.currentFrame === 0 ? 'start' : this.currentFrame === this.frameLength ? 'end' : 'progress'; 2706}; 2707 2708/** 2709 * Reset the instance to the initial state : undraw 2710 * Be careful, it just reset the animation, if you're 2711 * playing the animation, this won't stop it. But just 2712 * make it start from start. 2713 * 2714 */ 2715Vivus.prototype.reset = function () { 2716 return this.setFrameProgress(0); 2717}; 2718 2719/** 2720 * Set the instance to the final state : drawn 2721 * Be careful, it just set the animation, if you're 2722 * playing the animation on rewind, this won't stop it. 2723 * But just make it start from the end. 2724 * 2725 */ 2726Vivus.prototype.finish = function () { 2727 return this.setFrameProgress(1); 2728}; 2729 2730/** 2731 * Set the level of progress of the drawing. 2732 * 2733 * @param {number} progress Level of progress to set 2734 */ 2735Vivus.prototype.setFrameProgress = function (progress) { 2736 progress = Math.min(1, Math.max(0, progress)); 2737 this.currentFrame = Math.round(this.frameLength * progress); 2738 this.trace(); 2739 return this; 2740}; 2741 2742/** 2743 * Play the animation at the desired speed. 2744 * Speed must be a valid number (no zero). 2745 * By default, the speed value is 1. 2746 * But a negative value is accepted to go forward. 2747 *
2748 * And works with float too. 2749 * But don't forget we are in JavaScript, se be nice 2750 * with him and give him a 1/2^x value. 2751 * 2752 * @param {number} speed Animation speed [optional] 2753 */ 2754Vivus.prototype.play = function (speed) { 2755 if (speed && typeof speed !== 'number') { 2756 throw new Error('Vivus [play]: invalid speed'); 2757 } 2758 this.speed = speed || 1; 2759 if (!this.handle) { 2760 var $this = this, 2761 delay = (this.delayStart != null) ? this.delayStart : 0; 2762 setTimeout(function() { 2763 $this.drawer(); 2764 }, delay); 2765 } 2766 return this; 2767}; 2768 2769/** 2770 * Stop the current animation, if on progress. 2771 * Should not trigger any error. 2772 * 2773 */ 2774Vivus.prototype.stop = function () { 2775 if (this.handle) { 2776 cancelAnimFrame(this.handle); 2777 this.handle = null; 2778 } 2779 return this; 2780}; 2781 2782/** 2783 * Destroy the instance. 2784 * Remove all bad styling attributes on all 2785 * path tags 2786 * 2787 */ 2788Vivus.prototype.destroy = function () { 2789 this.stop(); 2790 var i, path; 2791 for (i = 0; i < this.map.length; i++) { 2792 path = this.map[i]; 2793 path.el.style.strokeDashoffset = null; 2794 path.el.style.strokeDasharray = null; 2795 this.renderPath(i); 2796 } 2797}; 2798 2799 2800/** 2801 * Utils methods 2802 * include methods from Codrops 2803 ************************************** 2804 */ 2805 2806/** 2807 * Method to best guess if a path should added into 2808 * the animation or not. 2809 * 2810 * 1. Use the `data-vivus-ignore` attribute if set 2811 * 2. Check if the instance must ignore invisible paths 2812 * 3. Check if the path is visible 2813 * 2814 * For now the visibility checking is unstable. 2815 * It will be used for a beta phase. 2816 * 2817 * Other improvments are planned. Like detecting 2818 * is the path got a stroke or a valid opacity. 2819 */ 2820Vivus.prototype.isInvisible = function (el) { 2821 var rect, 2822 ignoreAttr = el.getAttribute('data-ignore'); 2823 2824 if (ignoreAttr !== null) { 2825 return ignoreAttr !== 'false'; 2826 } 2827 2828 if (this.ignoreInvisible) { 2829 rect = el.getBoundingClientRect(); 2830 return !rect.width && !rect.height; 2831 } 2832 else { 2833 return false; 2834 } 2835}; 2836 2837/** 2838 * Parse attributes of a DOM element to 2839 * get an object of {attributeName => attributeValue} 2840 * 2841 * @param {object} element DOM element to parse 2842 * @return {object} Object of attributes 2843 */ 2844Vivus.prototype.parseAttr = function (element) { 2845 var attr, output = {}; 2846 if (element && element.attributes) { 2847 for (var i = 0; i < element.attributes.length; i++) { 2848 attr = element.attributes[i]; 2849 output[attr.name] = attr.value; 2850 } 2851 } 2852 return output; 2853}; 2854 2855/** 2856 * Reply if an element is in the page viewport 2857 * 2858 * @param {object} el Element to observe 2859 * @param {number} h Percentage of height 2860 * @return {boolean} 2861 */ 2862Vivus.prototype.isInViewport = function (el, h) { 2863 var scrolled = this.scrollY(), 2864 viewed = scrolled + this.getViewportH(), 2865 elBCR = el.getBoundingClientRect(), 2866 elHeight = elBCR.height, 2867 elTop = scrolled + elBCR.top, 2868 elBottom = elTop + elHeight; 2869 2870 // if 0, the element is considered in the viewport as soon as it enters. 2871 // if 1, the element is considered in the viewport only when it's fully inside 2872 // value in percentage (1 >= h >= 0) 2873 h = h || 0; 2874 2875 return (elTop + elHeight * h) <= viewed && (elBottom) >= scrolled; 2876}; 2877 2878/** 2879 * Alias for document element 2880 * 2881 * @type {DOMelement} 2882 */ 2883Vivus.prototype.docElem = window.document.documentElement; 2884 2885/** 2886 * Get the viewport height in pixels 2887 * 2888 * @return {integer} Viewport height 2889 */ 2890Vivus.prototype.getViewportH = function () { 2891 var client = this.docElem.clientHeight, 2892 inner = window.innerHeight; 2893 2894 if (client < inner) { 2895 return inner; 2896 } 2897 else { 2898 return client; 2899 } 2900}; 2901 2902/** 2903 * Get the page Y offset 2904 * 2905 * @return {integer} Page Y offset 2906 */ 2907Vivus.prototype.scrollY = function () { 2908 return window.pageYOffset || this.docElem.scrollTop; 2909}; 2910 2911/** 2912 * Alias for `requestAnimationFrame` or 2913 * `setTimeout` function for deprecated browsers. 2914 * 2915 */ 2916requestAnimFrame = (function () { 2917 return ( 2918 window.requestAnimationFrame || 2919 window.webkitRequestAnimationFrame || 2920 window.mozRequestAnimationFrame || 2921 window.oRequestAnimationFrame || 2922 window.msRequestAnimationFrame || 2923 function(/* function */ callback){ 2924 return window.setTimeout(callback, 1000 / 60); 2925 } 2926 ); 2927})(); 2928 2929/** 2930 * Alias for `cancelAnimationFrame` or 2931 * `cancelTimeout` function for deprecated browsers. 2932 * 2933 */ 2934cancelAnimFrame = (function () { 2935 return ( 2936 window.cancelAnimationFrame || 2937 window.webkitCancelAnimationFrame || 2938 window.mozCancelAnimationFrame || 2939 window.oCancelAnimationFrame || 2940 window.msCancelAnimationFrame || 2941 function(id){ 2942 return window.clearTimeout(id); 2943 } 2944 ); 2945})(); 2946 2947/** 2948 * Parse string to integer. 2949 * If the number is not positive or null 2950 * the method will return the default value 2951 * or 0 if undefined 2952 * 2953 * @param {string} value String to parse 2954 * @param {*}
2954 defaultValue Value to return if the result parsed is invalid 2955 * @return {number} 2956 * 2957 */ 2958parsePositiveInt = function (value, defaultValue) { 2959 var output = parseInt(value, 10); 2960 return (output >= 0) ? output : defaultValue; 2961}; 2962 2963 2964 if (typeof define === 'function' && define.amd) { 2965 // AMD. Register as an anonymous module. 2966 define([], function() { 2967 return Vivus; 2968 }); 2969 } else if (typeof exports === 'object') { 2970 // Node. Does not work with strict CommonJS, but 2971 // only CommonJS-like environments that support module.exports, 2972 // like Node. 2973 module.exports = Vivus; 2974 } else { 2975 // Browser globals 2976 window.Vivus = Vivus; 2977 } 2978 2979}(window, document));
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.