1(function ($, window, undefined) { 2 3 /* --- DETECT VIEWPORT SIZE --- */ 4 5 function browserSize() { 6 wh = $(window).height(); 7 ww = $(window).width(); 8 dh = $(document).height(); 9 ar = ww / wh; 10 } 11 12 13 /* --- DETECT PLATFORM --- */ 14 15 function platformDetect() { 16 $.support.touch = 'ontouchend' in document; 17 var navUA = navigator.userAgent.toLowerCase(), 18 navPlat = navigator.platform.toLowerCase(); 19 20 var isiPhone = navPlat.indexOf("iphone"), 21 isiPod = navPlat.indexOf("ipod"), 22 isAndroidPhone = navPlat.indexOf("android"), 23 safari = (navUA.indexOf('safari') != -1 && navUA.indexOf('chrome') == -1) ? true : false, 24 svgSupport = (window.SVGAngle) ? true : false, 25 svgSupportAlt = (document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")) ? true : false, 26 ff3x = (/gecko/i.test(navUA) && /rv:1.9/i.test(navUA)) ? true : false; 27 28 ieMobile = navigator.userAgent.match(/Windows Phone/i) ? true : false; 29 phone = (isiPhone > -1 || isiPod > -1 || isAndroidPhone > -1) ? true : false; 30 touch = $.support.touch ? true : false; 31 ltie9 = $.support.leadingWhitespace ? false : true; 32 33 var $bod = $('body'); 34 35 if (touch) $('html').addClass('touch'); 36 if (ieMobile) $('html').addClass('is--winmob'); 37 if (is_android) $('html').addClass('is--ancient-android'); 38 if (safari) $bod.addClass('safari'); 39 if (phone) $bod.addClass('phone'); 40 41 42 } 43// /* ====== SHARED VARS ====== */ 44 45var phone, touch, ltie9, dh, ar, fonts, ieMobile; 46 47var ua = navigator.userAgent; 48var winLoc = window.location.toString(); 49 50var is_webkit = ua.match(/webkit/i); 51var is_firefox = ua.match(/gecko/i); 52var is_newer_ie = ua.match(/msie (9|([1-9][0-9]))/i); 53var is_older_ie = ua.match(/msie/i) && !is_newer_ie; 54var is_ancient_ie = ua.match(/msie 6/i); 55var is_ie = is_ancient_ie || is_older_ie || is_newer_ie; 56var is_mobile_ie = navigator.userAgent.indexOf('IEMobile') !== -1; 57var is_mobile = ua.match(/mobile/i); 58var is_OSX = ua.match(/(iPad|iPhone|iPod|Macintosh)/g) ? true : false; 59var iOS = getIOSVersion(ua); 60var is_EDGE = /Edge\/12./i.test(navigator.userAgent); 61 62var latestKnownScrollY = (window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0), 63 newScrollY = - 1, 64 ticking = false; 65 66if (is_EDGE) { 67 jQuery('body').addClass('is-edge'); 68} 69 70 71var nua = navigator.userAgent; 72var is_android = ((nua.indexOf('Mozilla/5.0') !== -1 && nua.indexOf('Android ') !== -1 && nua.indexOf('AppleWebKit') !== -1) && nua.indexOf('Chrome') === -1); 73var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile"); 74 75var useTransform = true; 76var use2DTransform = (ua.match(/msie 9/i) || winLoc.match(/transform\=2d/i)); 77var transform; 78 79// setting up transform prefixes 80var prefixes = { 81 webkit: 'webkitTransform', 82 firefox: 'MozTransform', 83 ie: 'msTransform', 84 w3c: 'transform' 85}; 86 87if (useTransform) { 88 if (is_webkit) { 89 transform = prefixes.webkit; 90 } else if (is_firefox) { 91 transform = prefixes.firefox; 92 } else if (is_newer_ie) { 93 transform = prefixes.ie; 94 } 95} 96 97var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, 98 windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 99 100/* --- To enable verbose debug add to Theme Options > Custom Code footer -> globalDebug=true; --- */ 101var globalDebug = false, 102 timestamp, 103 gifImages; 104 105/* --- 404 Page --- */ 106gifImages = [ 107 "http://i.imgur.com/ShiZM6m.gif", 108 "http://i.imgur.com/8ZYNp.gif", 109 "http://i.imgur.com/Xb4fq.gif", 110 "http://i.imgur.com/UYPLKwN.gif", 111 "http://media.tumblr.com/d9e792a91d5391b8a7aa22689d4e2555/tumblr_inline_mwq1hmelce1qmoozl.gif", 112 "http://www.teen.com/wp-content/uploads/2013/10/world-without-jennifer-lawrence-gifs-food-uproxx-2.gif" 113]; 114 115function getGif() { 116 return gifImages[Math.floor(Math.random() * gifImages.length)]; 117} 118 119function changeBackground() { 120 $('.error404').css('background-image', 'url(' + getGif() + ')'); 121} 122 123$(window).on('load', function() { 124 if ($('.error404').length) {
125 changeBackground(); 126 } 127}); 128 129$(window).keydown(function (e) { 130 if (e.keyCode == 32) { 131 changeBackground(); 132 } 133}); 134 135/* --- Cover Animations Init --- */ 136 137var CoverAnimation = { 138 selector: '.article__header', 139 initialized: false, 140 animated: false, 141 142 initialize: function () { 143 144 if (is_EDGE) { 145 return; 146 } 147 148 var that = this; 149 150 $(this.selector).each(function(i, header) { 151 152 var $header = $(header), 153 $headline = $header.find('.article__headline'), 154 timeline = new TimelineMax({ paused: true }), 155 $title = $headline.find('.headline__primary'), 156 $subtitle = $headline.find('.headline__secondary'), 157 $description = $headline.find('.headline__description'), 158 $star = $headline.find('.star'), 159 $lines = $headline.find('.line'), 160 $arrows = $description.find('.arrow'), 161 $hr = $description.find('hr'), 162 headerTop = $header.offset().top, 163 headerHeight = $header.outerHeight(); 164 165 $header.find('.pixcode--separator').width($title.width()); 166 167 $description.css({opacity: 1}); 168 $description = $description.children().not('.pixcode--separator'); 169 $description.css({opacity: 0}); 170 171 // ------ A 172 173 timeline.fromTo($title, 0.72, {'letter-spacing': '1em', 'margin-right': '-0.9em'}, {'letter-spacing': '0.2em', 'margin-right': '-0.1em', ease: Expo.easeOut}); 174 timeline.fromTo($title, 0.89, {opacity: 0}, {opacity: 1, ease: Expo.easeOut}, '-=0.72'); 175 timeline.fromTo($title, 1, {'y': 30}, {'y': 0, ease: Expo.easeOut}, '-=0.89'); 176 timeline.fromTo($subtitle, 0.65, {opacity: 0}, {opacity: 1, ease: Quint.easeOut}, '-=0.65'); 177 timeline.fromTo($subtitle, 0.9, {y: 30}, {y: 0, ease: Quint.easeOut}, '-=0.65'); 178 timeline.fromTo($star, 0.15, {opacity: 0}, {opacity: 1, ease: Quint.easeOut}, '-=0.6'); 179 timeline.fromTo($star, 0.55, {rotation: -270}, {rotation: 0, ease: Back.easeOut}, '-=0.5'); 180 timeline.fromTo($lines, 0.6, {width: 0}, {width: '42%', opacity: 1, ease: Quint.easeOut}, '-=0.55'); 181 timeline.fromTo($hr, 0.6, {width: 0}, {width: '100%', opacity: 1, ease: Quint.easeOut}, '-=0.6'); 182 timeline.fromTo($arrows, 0.2, {opacity: 0}, {opacity: 1, ease: Quint.easeOut}, '-=0.27'); 183 timeline.fromTo($description, 0.5, {opacity: 0}, {opacity: 1, ease: Quint.easeOut}, '-=0.28'); 184 timeline.fromTo($description, 0.75, {y: -20}, {y: 0}, '-=0.5'); 185 186 // ------ B 187 timeline.addLabel("animatedIn"); 188 189 // if (i == 0) { 190 // timeline.fromTo($headline, 1.08, {y: 0}, {y: 150, ease: Linear.easeNone}); 191 // timeline.fromTo($title, 1.08, {y: 0}, {opacity: 0, y: -60, ease: Quad.easeIn}, '-=1.08'); 192 // } else { 193 timeline.fromTo($title, 1.08, {y: 0}, {opacity: 0, y: -60, ease: Quad.easeIn}); 194 // } 195 196 timeline.to($description, 1.08, {y: 60, opacity: 0, ease: Quad.easeIn}, '-=1.08'); 197 timeline.to($subtitle, 1.08, {opacity: 0, y: -90, ease: Quad.easeIn}, '-=1.08'); 198 timeline.to($lines, 0.86, {width: 0, opacity: 0, ease: Quad.easeIn}, '-=0.94'); 199 timeline.to($hr, 0.86, {width: 0, opacity: 0, ease: Quad.easeIn}, '-=0.86'); 200 timeline.to($star, 1, {rotation: 180}, '-=1.08'); 201 timeline.to($star, 0.11, {opacity: 0}, '-=0.03'); 202 timeline.to($arrows, 0.14, {opacity: 0}, '-=1.08'); 203 204 timeline.addLabel("animatedOut"); 205 206 // ------ C 207 208 var animatedInTime = timeline.getLabelTime("animatedIn"), 209 animatedOutTime = timeline.getLabelTime("animatedOut"), 210 start = headerTop + headerHeight / 2 - wh / 2, 211 end = start + headerHeight / 2, 212 ab, bc; 213 214 if (i == 0) { 215 start = headerTop; 216 end = start + windowHeight / 2; 217 } 218 219 ab = animatedInTime / animatedOutTime; 220 bc = 1 - ab; 221 222 if (!that.initialized) { 223 224 timeline.tweenTo("animatedIn", { 225 onComplete: function () { 226 if (Modernizr.touchevents) { 227 $headline.data("animated", true); 228 } 229 } 230 }); 231 232 if (!Modernizr.touchevents) { 233 timeline.tweenTo("animatedOut", { 234 onComplete: function () { 235 $headline.data("animated", true); 236 }, 237 onUpdate: function () { 238 var progress = (1 / (end - start)) * (latestKnownScrollY - start), 239 partialProgress = progress < 0 ? ab : ab + bc * progress, 240 currentProgress = timeline.progress(); 241 242 if (Math.abs(partialProgress - currentProgress) < 0.01) { 243 $headline.data("animated", true); 244 this.kill(); 245 } 246 } 247 }); 248 } 249 } 250 251 $headline.data('tween', { 252 timeline: timeline, 253 ab: ab, 254 bc: bc, 255 start: start, 256 end: end 257 }); 258 259 }); 260 261 that.initialized = true;
262 that.update(); 263 }, 264 265 update: function () { 266 267 if (is_EDGE) { 268 return; 269 } 270 271 var that = this; 272 273 $(this.selector).each(function (i, element) { 274 275 var $headline = $(element).find('.article__headline'), 276 options = $headline.data('tween'), 277 progress = 0; 278 279 // some sanity check 280 // we wouldn't want to divide by 0 - the Universe might come to an end 281 if (! empty(options) && (options.end - options.start) !== 0) { 282 283 // progress on the total timeline (ac) 284 progress = (1 / (options.end - options.start)) * (latestKnownScrollY - options.start); 285 286 // progress on partial timeline (bc) 287 // point B being labeled as "animated" 288 var partialProgress = options.ab + options.bc * progress; 289 290 $headline.data('progress', partialProgress); 291 292 if (!$headline.data("animated")) { 293 return; 294 } 295 296 if (0 > progress) { 297 partialProgress = options.ab; 298 } 299 300 if (1 > partialProgress) { 301 options.timeline.progress(partialProgress); 302 return; 303 } 304 305 options.timeline.progress(1); 306 } 307 }); 308 } 309} 310var DownArrow = { 311 selector: '.down-arrow', 312 $arrow: null, 313 timeline: null, 314 start: 0, 315 end: 0, 316 bubble: false, 317 318 initialize: function () { 319 320 var that = this; 321 322 this.$arrow = $(this.selector); 323 324 if (empty(this.$arrow)) { 325 return; 326 } 327 328 this.start = 0; 329 this.end = this.start + 300; 330 this.timeline = new TimelineMax({ paused: true }); 331 this.$next = this.$arrow.closest('.article--page'); 332 333 if (!empty(this.$next)) { 334 this.nextTop = this.$next.offset().top; 335 this.nextHeight = this.$next.outerHeight(); 336 } 337 338 339 if (this.$arrow.hasClass('down-arrow--bubble')) { 340 this.timeline.to(this.$arrow, .2, {y: 10, opacity: 0, ease: Linear.easeNone, overwrite: "none"}); 341 this.timeline.to('.blurp--top', .3, {scaleY: 0, ease: Linear.easeNone, overwrite: "none"}); 342 this.bubble = true; 343 } else { 344 this.timeline.to(this.$arrow, 1, {y: 100, opacity: 0, ease: Linear.easeNone, overwrite: "none"}); 345 } 346 347 this.$arrow.on('click', function (e) { 348 e.preventDefault(); 349 350 if (empty(that.$next)) { 351 return; 352 } 353 354 if (that.$next.is('.article__header')) { 355 smoothScrollTo(that.nextTop - windowHeight/2 + that.nextHeight/2); 356 } else { 357 smoothScrollTo(that.nextTop - $('.site-header').height()); 358 } 359 360 }); 361 }, 362 363 update: function () { 364 365 if (empty(this.$arrow) || this.bubble) { 366 return; 367 } 368 369 if (Modernizr.touchevents && is_OSX) { 370 this.timeline.progress(0); 371 return; 372 } 373 374 setProgress(this.timeline, this.start, this.end); 375 } 376} 377// /* ====== HELPER FUNCTIONS ====== */ 378 379//similar to PHP's empty function 380function empty(data) { 381 if (typeof(data) == 'number' || typeof(data) == 'boolean') { 382 return false; 383 } 384 if (typeof(data) == 'undefined' || data === null) { 385 return true; 386 } 387 if (typeof(data.length) != 'undefined') { 388 return data.length === 0; 389 } 390 var count = 0; 391 for (var i in data) { 392 // if(data.hasOwnProperty(i)) 393 // 394 // This doesn't work in ie8/ie9 due the fact that hasOwnProperty works only on native objects. 395 // http://stackoverflow.com/questions/8157700/object-has-no-hasownproperty-method-i-e-its-undefined-ie8 396 // 397 // for hosts objects we do this 398 if (Object.prototype.hasOwnProperty.call(data, i)) { 399 count++; 400 } 401 } 402 return count === 0; 403} 404 405function extend(a, b) { 406 for (var key in b) { 407 if (b.hasOwnProperty(key)) { 408 a[key] = b[key]; 409 } 410 } 411 return a; 412} 413 414// taken from https://github.com/inuyaksa/jquery.nicescroll/blob/master/jquery.nicescroll.js
415function hasParent(e, id) { 416 if (!e) return false; 417 var el = e.target || e.srcElement || e || false; 418 while (el && el.id != id) { 419 el = el.parentNode || false; 420 } 421 return (el !== false); 422} 423 424function mobilecheck() { 425 var check = false; 426 (function (a) { 427 if (/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4)))check = true; 428 })(navigator.userAgent || navigator.vendor || window.opera); 429 return check; 430} 431 432/* --- Set Query Parameter--- */ 433function setQueryParameter(uri, key, value) { 434 var re = new RegExp("([?|&])" + key + "=.*?(&|$)", "i"); 435 separator = uri.indexOf('?') !== -1 ? "&" : "?"; 436 if (uri.match(re)) { 437 return uri.replace(re, '$1' + key + "=" + value + '$2'); 438 } 439 else { 440 return uri + separator + key + "=" + value; 441 } 442} 443 444// http://stackoverflow.com/a/7557433 445function isElementInViewport (el) { 446 447 //special bonus for those using jQuery 448 if (el instanceof jQuery) { 449 el = el[0]; 450 } 451 452 var rect = el.getBoundingClientRect(); 453 454 return ( 455 rect.top >= 0 && 456 rect.left >= 0 && 457 rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /*or $(window).height() */ 458 rect.right <= (window.innerWidth || document.documentElement.clientWidth) /*or $(window).width() */ 459 ); 460} 461 462function getIOSVersion(ua) { 463 ua = ua || navigator.userAgent; 464 return parseFloat( 465 ('' + (/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(ua) || [0,''])[1]) 466 .replace('undefined', '3_2').replace('_', '.').replace('_', '') 467 ) || false; 468} 469 470function setProgress(timeline, start, end) { 471 472 var progress = (latestKnownScrollY - start) / (end - start); 473 474 if (0 > progress) { 475 timeline.progress(0); 476 return; 477 } 478 479 if (1 < progress) { 480 timeline.progress(1); 481 return; 482 } 483 484 timeline.progress(progress); 485} 486 487/** 488 * Generic tree implementation 489 * 490 * This class represents any node in the tree. 491 */ 492var Node = function( val ) { 493 494 this.val = val; 495 this.children = []; 496 this.parent = null; 497 498 /** 499 * Sets the parent node of this node. 500 */ 501 this.setParentNode = function( node ) { 502 this.parent = node; 503 node.children[node.children.length] = this; 504 } 505 506 /** 507 * Gets the parent node of this node. 508 */ 509 this.getParentNode = function() { 510 return this.parent; 511 } 512 513 /** 514 * Adds a child node of this node. 515 */ 516 this.addChild = function( node ) { 517 node.parent = this; 518 this.children[this.children.length] = node; 519 } 520 521 /** 522 * Gets the array of child nodes of this node. 523 */ 524 this.getChildren = function() { 525 return this.children; 526 } 527 528 /** 529 * Removes all the children of this node. 530 */ 531 this.removeChildren = function() { 532 var child; 533 for ( var i = 0; i < this.children.length; i++ ) { 534 child = this.children[i]; 535 child.parent = null; 536 } 537 this.children = []; 538 } 539 540 /** 541 * Recursively counts the number of all descendants, from children down, and 542 * returns the total number. 543 */ 544 this.getTotalDescendantCount = function() { 545 var count = 0, 546 child; 547 for ( var i = 0; i < this.children.length; i++ ) { 548 child = this.children[i]; 549 count += child.getTotalDescendantCount(); 550 } 551 return count + this.children.length; 552 } 553} 554 555/** 556 * Protocol Buffer implementation, which extends the functionality of Node 557 * while specifically typing the stored value 558 */
559var PrBufNode = function( id, type, value ) { 560 this.val = { 561 id: id, 562 type: type, 563 value: value 564 }; 565 this.children = []; 566 this.parent = null; 567} 568 569PrBufNode.prototype = new Node(); 570PrBufNode.prototype.constructor = PrBufNode; 571 572PrBufNode.prototype.id = function() { 573 return this.val.id; 574} 575PrBufNode.prototype.type = function() { 576 return this.val.type; 577} 578PrBufNode.prototype.value = function() { 579 return this.val.value; 580} 581 582/** 583 * Compares the number of descendants with the value specified in the map element. 584 * If all the children have not yet been added, we continue adding to this element. 585 */ 586PrBufNode.prototype.findLatestIncompleteNode = function() { 587 588 //if it's a branch (map) node ('m') and has room, 589 //or if it's the root (identified by having a null parent), which has no element limit, 590 //then return this node 591 if ( ( 592 ( 593 this.val.type === 'm' 594 ) && ( 595 this.val.value > this.getTotalDescendantCount() 596 ) 597 ) 598 || ( 599 null === this.parent 600 ) ) { 601 return this; 602 } 603 else { 604 return this.parent.findLatestIncompleteNode(); 605 } 606} 607 608/** 609 * Parses the input URL 'data' protocol buffer parameter into a tree 610 */ 611PrBufNode.create = function( urlToParse ) { 612 var rootNode = null; 613 var re = /data=!([^?&]+)/; 614 var dataArray = urlToParse.match( re ); 615 if ( dataArray && dataArray.length >= 1 ) { 616 rootNode = new PrBufNode(); 617 var workingNode = rootNode; 618 //we iterate through each of the elements, creating a node for it, and 619 //deciding where to place it in the tree 620 var elemArray = dataArray[1].split( "!" ); 621 for ( var i = 0; i < elemArray.length; i ++ ) { 622 var elemRe = /^([0-9]+)([a-z])(.+)$/; 623 var elemValsArray = elemArray[i].match( elemRe ); 624 if ( elemValsArray && elemValsArray.length > 3 ) { 625 var elemNode = new PrBufNode( elemValsArray[1], elemValsArray[2], elemValsArray[3] ); 626 workingNode.addChild( elemNode ); 627 workingNode = elemNode.findLatestIncompleteNode(); 628 } 629 } 630 } 631 return rootNode; 632} 633 634 635/** 636 * Represents a basic waypoint, with latitude and longitude. 637 * 638 * If both are not specified, the waypoint is considered to be valid 639 * but empty waypoint (these can exist in the data parameter, where 640 * the coordinates have been specified in the URL path. 641 */ 642var GmdpWaypoint = function( lat, lng, primary ) { 643 this.lat = lat; 644 this.lng = lng; 645 this.primary = primary ? true : false; 646} 647 648/** 649 * Represents a basic route, comprised of an ordered list of 650 * GmdpWaypoint objects. 651 */ 652var GmdpRoute = function() { 653 this.route = new Array(); 654} 655 656/** 657 * Pushes a GmdpWaypoint on to the end of this GmdpRoute. 658 */ 659GmdpRoute.prototype.pushWaypoint = function( wpt ) { 660 if ( wpt instanceof GmdpWaypoint ) { 661 this.route.push( wpt ); 662 } 663} 664 665/** 666 * Sets the mode of transportation. 667 * If the passed parameter represents one of the integers normally used by Google Maps, 668 * it will be interpreted as the relevant transport mode, and set as a string: 669 * "car", "bike", "foot", "transit", "flight" 670 */ 671GmdpRoute.prototype.setTransportation = function( transportation ) { 672 switch ( transportation ) { 673 case '0': 674 this.transportation = "car"; 675 break; 676 case '1': 677 this.transportation = "bike"; 678 break; 679 case '2': 680 this.transportation = "foot"; 681 break; 682 case '3': 683 this.transportation = "transit"; 684 break; 685 case '4': 686 this.transportation = "flight"; 687 break; 688 default: 689 this.transportation = transportation; 690 break; 691 } 692} 693 694/** 695 * Returns the mode of transportation (if any) for the route. 696 */ 697GmdpRoute.prototype.getTransportation = function() { 698 return this.transportation; 699} 700 701GmdpRoute.prototype.setUnit = function( unit ) { 702 switch ( unit ) { 703 case '0': 704 this.unit = "km"; 705 break; 706 case '1': 707 this.unit = "miles"; 708 break; 709 } 710} 711 712GmdpRoute.prototype.getUnit = function() { 713 return this.unit; 714} 715 716GmdpRoute.prototype.setRoutePref = function( routePref ) { 717 switch ( routePref ) { 718 case '0': 719 case '1': 720 this.routePref = "best route"; 721 break; 722 case '2': 723 this.routePref = "fewer transfers"; 724 break; 725 case '3': 726 this.routePref = "less walking"; 727 break; 728 } 729} 730 731GmdpRoute.prototype.getRoutePref = function() { 732 return this.routePref; 733} 734 735GmdpRoute.prototype.setArrDepTimeType = function( arrDepTimeType ) { 736 switch ( arrDepTimeType ) { 737 case '0': 738 this.arrDepTimeType = "depart at"; 739 break; 740 case '1': 741 this.arrDepTimeType = "arrive by"; 742 break; 743 case '2': 744 this.arrDepTimeType = "last available"; 745 break; 746 } 747} 748 749GmdpRoute.prototype.getArrDepTimeType = function() { 750 return this.arrDepTimeType; 751} 752 753GmdpRoute.prototype.addTransitModePref = function( transitModePref ) { 754 //there can be multiple preferred transit modes, so we store them in an array 755 //we assume there will be no duplicate values, but it probably doesn't matter 756 //even if there are 757 switch ( transitModePref ) { 758 case '0': 759 this.transitModePref.push( "bus" ); 760 break; 761 case '1': 762 this.transitModePref.push( "subway" ); 763 break; 764 case '2': 765 this.transitModePref.push( "train" ); 766 break; 767 case '3': 768 this.transitModePref.push( "tram / light rail" ); 769 break; 770 } 771} 772 773GmdpRoute.prototype.getTransitModePref = function() { 774 return this.transitModePref; 775} 776 777 778/**
779 * Returns the list of all waypoints belonging to this route. 780 */ 781GmdpRoute.prototype.getAllWaypoints = function() { 782 return this.route; 783} 784 785 786function GmdpException( message ) { 787 this.message = message; 788 // Use V8's native method if available, otherwise fallback 789 if ( "captureStackTrace" in Error ) { 790 Error.captureStackTrace( this, GmdpException ); 791 } else { 792 this.stack = ( 793 new Error() 794 ).stack; 795 } 796} 797 798GmdpException.prototype = Object.create( Error.prototype ); 799GmdpException.prototype.name = "GmdpException"; 800 801/** 802 * Represents a google maps data parameter, constructed from the passed URL. 803 * 804 * Utility methods defined below allow the user to easily extract interesting 805 * information from the data parameter. 806 */ 807var Gmdp = function( url ) { 808 this.prBufRoot = PrBufNode.create( url ); 809 this.mapType = "map"; 810 811 if ( this.prBufRoot == null ) { 812 throw new GmdpException( "no parsable data parameter found" ); 813 } 814 815 //the main top node for routes is 4m; other urls (eg. streetview) feature 3m etc. 816 var routeTop = null; 817 var streetviewTop = null; 818 var rootChildren = this.prBufRoot.getChildren(), 819 child; 820 821 for ( var i = 0; i < rootChildren.length; i++ ) { 822 child = rootChildren[i]; 823 if ( child.id() == 3 && child.type() == 'm' ) { 824 var mapTypeChildren = child.getChildren(); 825 if ( mapTypeChildren && mapTypeChildren.length >= 1 ) { 826 if ( mapTypeChildren[0].id() == 1 && mapTypeChildren[0].type() == 'e' ) { 827 switch ( mapTypeChildren[0].value() ) { 828 case '1': 829 this.mapType = "streetview"; 830 streetviewTop = child; 831 break; 832 case '3': 833 this.mapType = "earth"; 834 break; 835 } 836 } 837 } 838 } else if ( child.id() == 4 && child.type() == 'm' ) { 839 routeTop = child; 840 } 841 } 842 if ( routeTop ) { 843 var directions = null, 844 routeChildren = routeTop.getChildren(); 845 846 for ( var i = 0; i < routeChildren.length; i++ ) { 847 child = routeChildren[i]; 848 if ( child.id() == 4 && child.type() == 'm' ) { 849 directions = child; 850 } 851 } 852 if ( directions ) { 853 this.route = new GmdpRoute(); 854 this.route.arrDepTimeType = "leave now"; //default if no value is specified 855 this.route.avoidHighways = false; 856 this.route.avoidTolls = false; 857 this.route.avoidFerries = false; 858 this.route.transitModePref = []; 859 860 var directionsChildren = directions.getChildren(); 861 862 for ( var i = 0; i < directionsChildren.length; i++ ) { 863 child = directionsChildren[i]; 864 if ( primaryChild.id() == 1 && primaryChild.type() == 'm' ) { 865 if ( primaryChild.value() == 0 ) { 866 this.route.pushWaypoint( new GmdpWaypoint( undefined, undefined, true ) ); 867 } 868 else { 869 var addedPrimaryWpt = false; 870 var wptNodes = primaryChild.getChildren(), 871 wptNode; 872 for ( var i = 0; i < wptNodes.length; i++ ) { 873 wptNode = wptNodes[i]; 874 if ( wptNode.id() == 2 ) { 875 //this is the primary wpt, add coords 876 var coordNodes = wptNode.getChildren(); 877 if ( coordNodes && 878 coordNodes.length >= 2 && 879 coordNodes[0].id() == 1 && 880 coordNodes[0].type() == 'd' && 881 coordNodes[1].id() == 2 && 882 coordNodes[1].type() == 'd' ) { 883 this.route.pushWaypoint( 884 new GmdpWaypoint( coordNodes[1].value(), 885 coordNodes[0].value(), 886 true ) ); 887 } 888 addedPrimaryWpt = true; 889 } else if ( wptNode.id() == 3 ) { 890 //this is a secondary (unnamed) wpt 891 // 892 //but first, if we haven't yet added the primary wpt, 893 //then the coordinates are apparently not specified, 894 //so we should add an empty wpt 895 if ( ! addedPrimaryWpt ) { 896 this.route.pushWaypoint( new GmdpWaypoint( undefined, undefined, true ) ); 897 addedPrimaryWpt = true; 898 } 899 900 //now proceed with the secondary wpt itself 901 var secondaryWpts = wptNode.getChildren(); 902 if ( secondaryWpts && secondaryWpts.length > 1 ) { 903 var coordNodes = secondaryWpts[0].getChildren(); 904 if ( coordNodes && 905 coordNodes.length >= 2 && 906 coordNodes[0].id() == 1 && 907 coordNodes[0].type() == 'd' &&
908 coordNodes[1].id() == 2 && 909 coordNodes[1].type() == 'd' ) { 910 this.route.pushWaypoint( 911 new GmdpWaypoint( coordNodes[1].value(), 912 coordNodes[0].value(), 913 false ) ); 914 } 915 } 916 } 917 } 918 } 919 } else if ( primaryChild.id() == 2 && primaryChild.type() == 'm' ) { 920 var routeOptions = primaryChild.getChildren(), 921 routeOption; 922 for ( var i = 0; i < routeOptions.length; i++ ) { 923 routeOption = routeOptions[i]; 924 925 if ( routeOption.id() == 1 && routeOption.type() == 'b' ) { 926 this.route.avoidHighways = true; 927 } 928 else if ( routeOption.id() == 2 && routeOption.type() == 'b' ) { 929 this.route.avoidTolls = true; 930 } 931 else if ( routeOption.id() == 3 && routeOption.type() == 'b' ) { 932 this.route.avoidFerries = true; 933 } 934 else if ( routeOption.id() == 4 && routeOption.type() == 'e' ) { 935 this.route.setRoutePref( routeOption.value() ); 936 } 937 else if ( routeOption.id() == 5 && routeOption.type() == 'e' ) { 938 this.route.addTransitModePref( routeOption.value() ); 939 } 940 else if ( routeOption.id() == 6 && routeOption.type() == 'e' ) { 941 this.route.setArrDepTimeType( routeOption.value() ); 942 } 943 if ( routeOption.id() == 8 && routeOption.type() == 'j' ) { 944 this.route.arrDepTime = routeOption.value(); //as a unix timestamp 945 } 946 } 947 } else if ( primaryChild.id() == 3 && primaryChild.type() == 'e' ) { 948 this.route.setTransportation( primaryChild.value() ); 949 } else if ( primaryChild.id() == 4 && primaryChild.type() == 'e' ) { 950 this.route.setUnit( primaryChild.value() ); 951 } 952 } 953 } 954 } 955 if ( streetviewTop ) { 956 var streetviewChildren = streetviewTop.getChildren(), 957 streetviewChild; 958 for ( var i = 0; i < streetviewChildren.length; i++ ) { 959 streetviewChild = streetviewChildren[i]; 960 if ( streetviewChild.id() == 3 && streetviewChild.type() == 'm' ) { 961 var svInfos = streetviewChild.getChildren(), 962 svInfo; 963 for ( var i = 0; i < svInfos.length; i++ ) { 964 svInfo = svInfos[i]; 965 if ( svInfo.id() == 2 && svInfo.type() == 'e' ) { 966 if ( svInfo.value() == 4 ) { 967 //!2e4!3e11 indicates a photosphere, rather than standard streetview 968 //but the 3e11 doesn't seem to matter too much (?) 969 this.mapType = "photosphere"; 970 } 971 } 972 if ( svInfo.id() == 6 && svInfo.type() == 's' ) { 973 this.svURL = decodeURIComponent( svInfo.value() ); 974 } 975 } 976 } 977 } 978 } 979} 980 981/** 982 * Returns the route defined by this data parameter. 983 */ 984Gmdp.prototype.getRoute = function() { 985 return this.route; 986} 987 988/** 989 * Returns the main map type ("map", "earth"). 990 */ 991Gmdp.prototype.getMapType = function() { 992 return this.mapType; 993} 994 995/** 996 * Returns the main map type ("map", "earth"). 997 */ 998Gmdp.prototype.getStreetviewURL = function() { 999 return this.svURL; 1000} 1001/* --- Magnific Popup Initialization --- */ 1002 1003function magnificPopupInit() { 1004 if ( globalDebug ) { 1005 console.log( "Magnific Popup - Init" ); 1006 } 1007 1008 $( '.js-post-gallery' ).each( function () { // the containers for all your galleries should have the class gallery 1009 $( this ).magnificPopup( { 1010 tPrev: objectl10n.tPrev, 1011 tNext: objectl10n.tNext, 1012 tCounter: objectl10n.tCounter, 1013 delegate: 'a[href*=".jpg"], a[href*=".jpeg"], a[href*=".png"], a[href*=".gif"]', // the container for each your gallery items 1014 type: 'image', 1015 closeOnContentClick: false, 1016 closeBtnInside: false, 1017 closeOnBgClick: false, 1018 fixedContentPos: true, 1019 removalDelay: 500, 1020 mainClass: 'mfp-fade', 1021 image: { 1022 markup: '<div class="mfp-figure">' + 1023 '<div class="mfp-close"></div>' + 1024 '<div class="mfp-img"></div>' + 1025 '<div class="mfp-bottom-bar">' + 1026 '<div class="mfp-title"></div>' + 1027 '<div class="mfp-counter"></div>' + 1028 '</div>' + 1029 '</div>', 1030 titleSrc: function ( item ) { 1031 var output = ''; 1032 if ( typeof item.el.attr( 'data-alt' ) !== "undefined" && item.el.attr( 'data-alt' ) !== "" ) { 1033 output += '<small>' + item.el.attr( 'data-alt' ) + '</small>'; 1034 } 1035 return output; 1036 } 1037 }, 1038 gallery: { 1039 enabled: true, 1040 navigateByImgClick: true 1041 //arrowMarkup: '<a href="#" class="gallery-arrow gallery-arrow--%dir% control-item arrow-button arrow-button--%dir%">%dir%</a>' 1042 }, 1043 callbacks: { 1044 elementParse: function ( item ) { 1045 1046 if ( this.currItem != undefined ) { 1047 item = this.currItem; 1048 } 1049 1050 var output = ''; 1051 if ( typeof item.el.attr( 'data-alt' ) !== "undefined" && item.el.attr( 'data-alt' ) !== "" ) { 1052 output += '<small>' + item.el.attr( 'data-alt' ) + '</small>'; 1053 } 1054 1055 $( '.mfp-title' ).html( output ); 1056 }, 1057 change: function ( item ) { 1058 var output = ''; 1059 if ( typeof item.el.attr( 'data-alt' ) !== "undefined" && item.el.attr( 'data-alt' ) !== "" ) { 1060 output += '<small>' + item.el.attr( 'data-alt' ) + '</small>'; 1061 } 1062 1063 $( '.mfp-title' ).html( output ); 1064 }, 1065 beforeClose: function () { 1066 $( '.mfp-arrow, .mfp-close' ).hide(); 1067 } 1068 } 1069 } ); 1070 } ); 1071} 1072 1073var GMap = function() { 1074 this.maps = []; 1075 this.pinIconMarkup = $( '.js-map-pin' ).html(); 1076}; 1077 1078GMap.prototype.init = function( $container ) { 1079 var that = this; 1080 1081 $container = typeof $container !== "undefined" ? $container : $( 'body' ); 1082 1083 $container.find( '.c-hero__map' ).each( function( i, obj ) { 1084 var $map = $( obj ); 1085 that.maps.push( $map ); 1086 that.initializeMap( $map ); 1087 } ); 1088}; 1089 1090GMap.prototype.initializeMap = function( $map ) { 1091 var that = this; 1092 1093 if ( typeof google !== 'undefined' ) { 1094 1095 var url = $map.data( 'url' ), 1096 style = typeof $map.data( 'customstyle' ) !== "undefined" ? "rosa" : google.maps.MapTypeId.ROADMAP, 1097 markerContent = $map.data( 'markercontent' ), 1098 coordinates, 1099 pins = []; 1100 1101 if ( typeof url === "string" ) { 1102 1103 coordinates = that.getCenterFrom( url ); 1104 pins = that.getPinsFrom( url, markerContent ); 1105 1106 // if there are no markers encoded in the url 1107 // place a pin the center of the map 1108 if ( pins.length === 0 && typeof coordinates !== "undefined" ) { 1109 pins.push( { 1110 position: [coordinates.latitude, coordinates.longitude], 1111 content: that.getPinMarkup( markerContent ), 1112 x: 0, 1113 y: 4 1114 } ); 1115 } 1116 } else { 1117 var pinsData = $map.data( 'pins' ); 1118 1119 $.each( pinsData, function( label, url ) { 1120 coordinates = that.getCenterFrom( url ); 1121 1122 pins.push( { 1123 position: [coordinates['latitude'], coordinates['longitude']], 1124 content: that.getPinMarkup( label, 'pin' ), 1125 x: 0, 1126 y: 4 1127 } ); 1128 1129 } ); 1130 } 1131 1132 $map 1133 .gmap3( { 1134 center: [coordinates.latitude, coordinates.longitude], 1135 zoom: parseInt( coordinates.zoom ), 1136 mapTypeId: style, 1137 scrollwheel: false, 1138 mapTypeControl: false, 1139 zoomControl: true, 1140 zoomControlOptions: { 1141 position: google.maps.ControlPosition.LEFT_CENTER 1142 }, 1143 scaleControl: true, 1144 streetViewControl: true, 1145 streetViewControlOptions: { 1146 position: google.maps.ControlPosition.LEFT_CENTER 1147 }, 1148 fullscreenControl: true 1149 } ) 1150 .styledmaptype( "rosa", that.customStyle, {name: "Rosa"} ) 1151 .overlay( pins ); 1152 1153 if ( pins.length > 1 ) { 1154 $map.gmap3().fit(); 1155 } 1156 1157 } 1158 1159}; 1160 1161GMap.prototype.getCenterFrom = function( url ) { 1162 var split = url.split( '@' )[1].split( '/' )[0].split( 'z' )[0].split( ',' ), 1163 coordinates = {}; 1164 1165 if ( 2 === split.length || 3 === split.length ) { 1166 coordinates.latitude = parseFloat( split[0] );
1167 coordinates.longitude = parseFloat( split[1] ); 1168 1169 if ( 3 === split.length ) { 1170 coordinates.zoom = parseFloat( split[2] ); 1171 } 1172 return coordinates; 1173 } 1174 1175 return false; 1176}; 1177 1178GMap.prototype.getPinsFrom = function( url, markerContent ) { 1179 var that = this, 1180 coordinates = [], 1181 pins = []; 1182 1183 function parseChildren( obj ) { 1184 var coord = []; 1185 $.each( obj.getChildren(), function( i, child ) { 1186 if ( child.type() == "d" ) { 1187 coord.push( child.value() ); 1188 } 1189 parseChildren( child ); 1190 } ); 1191 1192 if ( coord.length === 2 ) { 1193 coordinates.push( coord ); 1194 } 1195 } 1196 1197 if ( url.indexOf( 'data=' ) > - 1 ) { 1198 parseChildren( new Gmdp( url ).prBufRoot ); 1199 } 1200 1201 $.each( coordinates, function( i, coord ) { 1202 pins.push( { 1203 position: [coord[0], coord[1]], 1204 content: that.getPinMarkup( markerContent, 'tooltip' ), 1205 x: 0, 1206 y: 4 1207 } ); 1208 } ); 1209 1210 return pins; 1211}; 1212 1213GMap.prototype.getPinMarkup = function( content, type ) { 1214 type = type || 'tooltip'; 1215 1216 if ( type === 'tooltip' ) { 1217 return '<div class="map-tooltip"><div class="map-tooltip__content">' + content + '</div></div>'; 1218 } else { 1219 return '<div class="map-pin"><div class="map-pin__text">' + content + '</div>' + this.pinIconMarkup + '</div>' 1220 } 1221}; 1222 1223GMap.prototype.customStyle = [ 1224 { 1225 "stylers": [ 1226 {"saturation": - 100}, 1227 {"gamma": 3.00}, 1228 {"visibility": "simplified"} 1229 ] 1230 }, { 1231 "featureType": "road", 1232 "stylers": [ 1233 {"hue": $( "body" ).data( "color" ) ? $( "body" ).data( "color" ) : "#ffaa00"}, 1234 {"saturation": 48}, 1235 {"gamma": 0.40}, 1236 {"visibility": "on"} 1237 ] 1238 }, { 1239 "featureType": "administrative", 1240 "stylers": [ 1241 {"saturation": - 30}, 1242 {"gamma": 0.6}, 1243 {"visibility": "on"} 1244 ] 1245 }, { 1246 "featureType": "administrative.neighborhood", 1247 "stylers": [ 1248 {"visibility": "off"} 1249 ] 1250 } 1251]; 1252 1253/* --- Royal Slider Init --- */ 1254 1255function royalSliderInit( $container ) { 1256 if ( globalDebug ) { 1257 console.log( "Royal Slider - Init" ); 1258 } 1259 1260 $container = typeof $container !== 'undefined' ? $container : $( 'body' ); 1261 1262 // Transform Wordpress Galleries to Sliders 1263 $container.find( '.wp-gallery' ).each( function () { 1264 sliderMarkupGallery( $( this ) ); 1265 } ); 1266 1267 // Find and initialize each slider 1268 $container.find( '.js-pixslider' ).each( function () { 1269 var $slider = $( this ); 1270 $slider.imagesLoaded( function () { 1271 sliderInit( $slider ); 1272 } ); 1273 } ); 1274 1275} 1276 1277/* 1278 * Slider Initialization 1279 */ 1280function sliderInit( $slider ) { 1281 1282 $slider.find( 'img' ).removeClass( 'invisible' ); 1283 1284 var $children = $( this ).children(), 1285 rs_arrows = typeof $slider.data( 'arrows' ) !== "undefined", 1286 rs_bullets = typeof $slider.data( 'bullets' ) !== "undefined" ? "bullets" : "none", 1287 rs_autoheight = typeof $slider.data( 'autoheight' ) !== "undefined", 1288 rs_autoScaleSlider = false, 1289 rs_autoScaleSliderWidth = $slider.data( 'autoscalesliderwidth' ), 1290 rs_autoScaleSliderHeight = $slider.data( 'autoscalesliderheight' ), 1291 rs_customArrows = typeof $slider.data( 'customarrows' ) !== "undefined", 1292 rs_slidesSpacing = typeof $slider.data( 'slidesspacing' ) !== "undefined" ? parseInt( $slider.data( 'slidesspacing' ) ) : 0, 1293 rs_keyboardNav = typeof $slider.data( 'fullscreen' ) !== "undefined", 1294 rs_imageScale = $slider.data( 'imagescale' ), 1295 rs_visibleNearby = typeof $slider.data( 'visiblenearby' ) !== "undefined" ? true : false, 1296 rs_imageAlignCenter = typeof $slider.data( 'imagealigncenter' ) !== "undefined", 1297 rs_transition = typeof $slider.data( 'slidertransition' ) !== "undefined" && $slider.data( 'slidertransition' ) != '' ? $slider.data( 'slidertransition' ) : 'move', 1298 rs_autoPlay = typeof $slider.data( 'sliderautoplay' ) !== "undefined" ? true : false, 1299 rs_delay = typeof $slider.data( 'sliderdelay' ) !== "undefined" && $slider.data( 'sliderdelay' ) != '' ? $slider.data( 'sliderdelay' ) : '1000', 1300 rs_drag = true, 1301 rs_globalCaption = typeof $slider.data( 'showcaptions' ) !== "undefined" ? true : false, 1302 is_headerSlider = $slider.hasClass( 'header--slideshow' ) ? true : false, 1303 hoverArrows = typeof $slider.data( 'hoverarrows' ) !== "undefined"; 1304 1305 // Single slide case 1306 if ( $children.length == 1 ) { 1307 rs_arrows = false;
1308 rs_bullets = 'none'; 1309 rs_customArrows = false; 1310 rs_keyboardNav = false; 1311 rs_drag = false; 1312 rs_transition = 'fade'; 1313 } 1314 // make sure default arrows won't appear if customArrows is set 1315 if ( rs_customArrows ) { 1316 rs_arrows = false; 1317 } 1318 1319 //the main params for Royal Slider 1320 var royalSliderParams = { 1321 autoHeight: rs_autoheight, 1322 autoScaleSlider: rs_autoScaleSlider, 1323 loop: true, 1324 autoScaleSliderWidth: rs_autoScaleSliderWidth, 1325 autoScaleSliderHeight: rs_autoScaleSliderHeight, 1326 imageScaleMode: rs_imageScale, 1327 imageAlignCenter: rs_imageAlignCenter, 1328 slidesSpacing: rs_slidesSpacing, 1329 arrowsNav: rs_arrows, 1330 controlNavigation: rs_bullets, 1331 keyboardNavEnabled: rs_keyboardNav, 1332 arrowsNavAutoHide: false, 1333 sliderDrag: rs_drag, 1334 transitionType: rs_transition, 1335 autoPlay: { 1336 enabled: rs_autoPlay, 1337 stopAtAction: true, 1338 pauseOnHover: true, 1339 delay: rs_delay 1340 }, 1341 globalCaption: rs_globalCaption, 1342 numImagesToPreload: 4 1343 }; 1344 1345 if ( rs_visibleNearby ) { 1346 royalSliderParams['visibleNearby'] = { 1347 enabled: true, 1348 //centerArea: 0.8, 1349 center: true, 1350 breakpoint: 0, 1351 //breakpointCenterArea: 0.64, 1352 navigateByCenterClick: false 1353 } 1354 } 1355 1356 1357 // lets fire it up 1358 1359 $slider.royalSlider( royalSliderParams ); 1360 $slider.addClass( 'slider--loaded' ); 1361 1362 var royalSlider = $slider.data( 'royalSlider' ); 1363 var slidesNumber = royalSlider.numSlides; 1364 1365 royalSlider.ev.on( 'rsBeforeAnimStart rsAfterSlideChange rsAfterContentSet', function ( event ) { 1366 $( window ).trigger( 'rellax' ); 1367 }); 1368 1369 // create the markup for the customArrows 1370 if ( royalSlider && rs_customArrows ) { 1371 1372 var classes = 'slider__custom-arrows'; 1373 1374 if ( is_headerSlider ) { 1375 classes = 'slider-arrows-header'; 1376 } 1377 1378 if ( hoverArrows && ! Modernizr.touchevents ) { 1379 classes += ' arrows--hover '; 1380 } 1381 1382 $slider.find( '.slider__custom-arrows' ).off( 'click' ).remove(); 1383 1384 var $gallery_control = $( 1385 '<div class="' + classes + '">' + 1386 '<div class="rsArrow rsArrowLeft js-arrow-left" style="display: block;"><div class="rsArrowIcn"></div></div>' + 1387 '<div class="rsArrow rsArrowRight js-arrow-right" style="display: block;"><div class="rsArrowIcn"></div></div>' + 1388 '</div>' 1389 ); 1390 1391 if ( $slider.data( 'customarrows' ) == "left" ) { 1392 $gallery_control.addClass( 'gallery-control--left' ); 1393 } 1394 1395 $gallery_control.insertBefore( $slider ); 1396 1397 $gallery_control.on( 'click', '.js-arrow-left', function ( event ) { 1398 event.preventDefault(); 1399 royalSlider.prev(); 1400 } ); 1401 1402 $gallery_control.on( 'click', '.js-arrow-right', function ( event ) { 1403 event.preventDefault(); 1404 royalSlider.next(); 1405 } ); 1406 } 1407 1408 if ( hoverArrows && ! Modernizr.touchevents ) { 1409 hoverArrow( $gallery_control.find( '.rsArrow' ) ); 1410 1411 } 1412 1413 if ( slidesNumber == 1 ) { 1414 $slider.addClass( 'single-slide' ); 1415 } 1416 1417 $slider.addClass( 'slider--loaded' ); 1418} 1419 1420/* 1421 * Wordpress Galleries to Sliders 1422 * Create the markup for the slider from the gallery shortcode 1423 * take all the images and insert them in the .gallery <div> 1424 */ 1425function sliderMarkupGallery( $gallery ) { 1426 var $old_gallery = $gallery, 1427 gallery_data = $gallery.data(), 1428 $images = $old_gallery.find( 'img' ), 1429 $new_gallery = $( '<div class="pixslider js-pixslider">' ); 1430 1431 $images.prependTo( $new_gallery ).addClass( 'rsImg' ); 1432 1433 //add the data attributes 1434 $.each( gallery_data, function ( key, value ) { 1435 $new_gallery.attr( 'data-' + key, value ); 1436 } ) 1437 1438 $old_gallery.replaceWith( $new_gallery ); 1439} 1440 1441/* 1442 Get slider arrows to hover, following the cursor 1443 */ 1444 1445function hoverArrow( $arrow ) { 1446 1447 $arrow.each(function(i, obj) { 1448 1449 var $arrow = $(obj), 1450 update = false, 1451 offset = $arrow.offset(), 1452 $icon = $arrow.find( '.rsArrowIcn' ), 1453 mouseX, 1454 mouseY; 1455 1456 $arrow.mouseenter( function ( e ) { 1457 offset = $arrow.offset(); 1458 $( this ).addClass( 'visible' ); 1459 update = true; 1460 }); 1461 1462 $arrow.mousemove( function ( e ) { 1463 mouseX = e.pageX - offset.left; 1464 mouseY = e.pageY - offset.top; 1465 }); 1466 1467 $arrow.mouseleave( function ( e ) { 1468 $( this ).removeClass( 'visible' ); 1469 update = false; 1470 }); 1471 1472 function loop() { 1473 if ( update ) { 1474 TweenMax.to( $icon, 0, {x: mouseX, y: mouseY, z: 0.01, force3D: true} ); 1475 } 1476 requestAnimationFrame(loop); 1477 } 1478 1479 loop(); 1480 }); 1481} 1482var ScrollToTop = (function() { 1483 1484 var start = 0, 1485 end = 0, 1486 timeline = null, 1487 played = false, 1488 footerHeight; 1489 1490 function initialize() { 1491 1492 var $button = $('.btn--top'), 1493 offsetTop = 0, 1494 start = offsetTop - windowHeight + footerHeight * 3 / 4; 1495 1496 footerHeight = $('.copyright-area').outerHeight(); 1497 1498 if (empty($button)) { 1499 return; 1500 } 1501 1502 offsetTop = $button.offset().top; 1503 $button.data('offsetTop', offsetTop); 1504 1505 this.timeline = new TimelineMax({ paused: true }); 1506 1507 this.timeline.fromTo('.blurp--bottom', .6, { 1508 y: 40, 1509 scale: 0.5 1510 }, { 1511 y: 0, 1512 scale: 1, 1513 ease: Power3.easeOut, 1514 force3D: true 1515 1516 }); 1517 1518 this.timeline.fromTo($('.btn__arrow--top'), .4, { 1519 y: 15, 1520 opacity: 0 1521 }, { 1522 y: 0, 1523 scale: 1, 1524 opacity: 1, 1525 ease: Back.easeOut 1526 }, '-=0.1'); 1527 1528 this.timeline.fromTo($('.btn__arrow--bottom'),.4, { 1529 y: 15, 1530 opacity: 0 1531 }, { 1532 y: 0, 1533 scale: 1, 1534 opacity: 1, 1535 ease: Back.easeOut 1536 }, '-=0.25'); 1537 1538 $button.on('click', function (e) { 1539 e.preventDefault(); 1540 smoothScrollTo(0); 1541 }); 1542 1543 this.update(); 1544 } 1545
1546 function update() { 1547 1548 var $button = $('.btn--top'), 1549 offsetTop = $button.data('offsetTop'), 1550 start = offsetTop - windowHeight + footerHeight * 3 / 4, 1551 end = start + windowHeight; 1552 1553 if (empty($button) || this.timeline == null) { 1554 return; 1555 } 1556 1557 if (Modernizr.touchevents && is_OSX) { 1558 this.timeline.progress(1); 1559 return; 1560 } 1561 1562 if (start < latestKnownScrollY) { 1563 if (!this.played) { 1564 this.timeline.play(); 1565 this.played = true; 1566 } 1567 } else { 1568 if (this.played) { 1569 this.timeline.reverse(); 1570 this.played = false; 1571 } 1572 } 1573 } 1574 1575 return { 1576 initialize: initialize, 1577 update: update 1578 } 1579 1580})(); 1581 1582/* --- Sticky Header Init --- */ 1583 1584var StickyHeader = (function() { 1585 1586 var headerSelector = '.site-header', 1587 $header = $(headerSelector), 1588 headerHeight, 1589 $headers, 1590 offset; 1591 1592 function init() { 1593 headerHeight = $header.outerHeight(), 1594 $headers = $('.article__header'), 1595 offset = $headers.length ? $headers.first().outerHeight() : 0; 1596 } 1597 1598 function update() { 1599 if ( latestKnownScrollY > offset - headerHeight - 1) { 1600 $header.removeClass('headroom--top').addClass('headroom--not-top'); 1601 } else { 1602 $header.removeClass('headroom--not-top').addClass('headroom--top'); 1603 } 1604 } 1605 1606 return { 1607 init: init, 1608 update: update 1609 } 1610})(); 1611 1612// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 1613// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating 1614 1615// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel 1616 1617// MIT license 1618 1619(function() { 1620 var lastTime = 0; 1621 var vendors = ['ms', 'moz', 'webkit', 'o']; 1622 for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { 1623 window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame']; 1624 window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] 1625 || window[vendors[x]+'CancelRequestAnimationFrame']; 1626 } 1627 1628 if (!window.requestAnimationFrame) 1629 window.requestAnimationFrame = function(callback, element) { 1630 var currTime = new Date().getTime(); 1631 var timeToCall = Math.max(0, 16 - (currTime - lastTime)); 1632 var id = window.setTimeout(function() { callback(currTime + timeToCall); }, 1633 timeToCall); 1634 lastTime = currTime + timeToCall; 1635 return id; 1636 }; 1637 1638 if (!window.cancelAnimationFrame) 1639 window.cancelAnimationFrame = function(id) { 1640 clearTimeout(id); 1641 }; 1642}()); 1643 1644//here we change the link of the Edit button in the Admin Bar 1645//to make sure it reflects the current page 1646function adminBarEditFix(id) { 1647 //get the admin ajax url and clean it 1648 var baseURL = ajaxurl.replace('admin-ajax.php', 'post.php'); 1649 1650 $('#wp-admin-bar-edit a').attr('href', baseURL + '?post=' + id + '&action=edit'); 1651} 1652 1653/* --- Load AddThis Async --- */ 1654function loadAddThisScript() { 1655 if (window.addthis) { 1656 if (globalDebug) { 1657 console.log("AddThis Load Script"); 1658 } 1659 // Listen for the ready event 1660 addthis.addEventListener('addthis.ready', addthisReady); 1661 addthis.init(); 1662 } 1663} 1664 1665/* --- AddThis On Ready - The API is fully loaded --- */ 1666//only fire this the first time we load the AddThis API - even when using ajax 1667function addthisReady() { 1668 if (globalDebug) { 1669 console.log("AddThis Ready"); 1670 } 1671 addThisInit(); 1672} 1673 1674/* --- AddThis Init --- */ 1675function addThisInit() { 1676 if (window.addthis) { 1677 if (globalDebug) { 1678 console.log("AddThis Toolbox INIT"); 1679 } 1680 1681 addthis.toolbox('.addthis_toolbox'); 1682 } 1683} 1684 1685var HandleSubmenusOnTouch = (function() { 1686 1687 var isInitiated = false; 1688 1689 function init() { 1690 if( isInitiated ) return; 1691 1692 // Make sure there are no open menu items 1693 $('.menu-item-has-children').removeClass('hover'); 1694 1695 // Add a class so we know the items to handle 1696 $('.menu-item-has-children > a').each(function () { 1697 $(this).addClass('prevent-one'); 1698 }); 1699 1700 $('a.prevent-one').on('click', function (e) { 1701 e.preventDefault(); 1702 e.stopPropagation(); 1703 1704 if( $(this).hasClass('active') ) { 1705 window.location.href = $(this).attr('href'); 1706 } 1707 1708 $('a.prevent-one').removeClass('active'); 1709 $(this).addClass('active'); 1710 1711 // When a parent menu item is activated, 1712 // close other menu items on the same level 1713 $(this).parent().siblings().removeClass('hover'); 1714 1715 // Open the sub menu of this parent item 1716 $(this).parent().addClass('hover'); 1717 }); 1718 1719 isInitiated = true; 1720 } 1721 1722 function release() { 1723 $('a.prevent-one').unbind(); 1724 isInitiated = false;
1725 } 1726 1727 return { 1728 init: init, 1729 release: release 1730 } 1731}()); 1732 1733/* ====== INTERNAL FUNCTIONS ====== */ 1734 1735/* --- NICESCROLL --- */ 1736 1737var $body = $( 'body' ), 1738 $html = $( 'html' ), 1739 $window = $( window ), 1740 $document = $( document ), 1741 documentHeight = $document.height(), 1742 aspectRatio = windowWidth / windowHeight, 1743 orientation = getOrientation(), 1744 isTouch = ! ! ( ( "ontouchstart" in window ) || window.DocumentTouch && document instanceof DocumentTouch ); 1745 1746function niceScrollInit() { 1747 if ( globalDebug ) { 1748 console.log( "NiceScroll Init" ); 1749 } 1750 1751 var smoothScroll = $( 'body' ).data( 'smoothscrolling' ) !== undefined, 1752 root = document.documentElement; 1753 1754 if ( smoothScroll && ! is_EDGE && ! Modernizr.touchevents && ! is_mobile_ie && ! is_OSX ) { 1755 1756 var $window = $( window ); // Window object 1757 1758 $window.on( "mousewheel DOMMouseScroll", function( event ) { 1759 1760 var scrollTo, 1761 scrollDistance = 400, 1762 delta; 1763 1764 if ( event.type == 'mousewheel' ) { 1765 delta = event.originalEvent.wheelDelta / 120; 1766 } 1767 else if ( event.type == 'DOMMouseScroll' ) { 1768 delta = - event.originalEvent.detail / 3; 1769 } 1770 1771 scrollTo = latestKnownScrollY - delta * scrollDistance; 1772 1773 if ( scrollTo ) { 1774 1775 event.preventDefault(); 1776 1777 TweenMax.to( $window, .6, { 1778 scrollTo: { 1779 y: scrollTo, 1780 autoKill: true 1781 }, 1782 ease: Power1.easeOut, // For more easing functions see http://api.greensock.com/js/com/greensock/easing/package-detail.html 1783 autoKill: true, 1784 overwrite: 5 1785 } ); 1786 1787 } 1788 1789 } ); 1790 1791 } 1792 1793} 1794 1795 1796function smoothScrollTo( y, speed ) { 1797 1798 speed = typeof speed == "undefined" ? 1 : speed; 1799 1800 var distance = Math.abs( latestKnownScrollY - y ), 1801 time = speed * distance / 2000; 1802 1803 TweenMax.to( $( window ), time, {scrollTo: {y: y, autoKill: false, ease: Quint.easeInOut}} ); 1804} 1805 1806 1807function menuTrigger() { 1808 1809 $( '.js-nav-trigger' ).on( 'click', function( e ) { 1810 1811 e.preventDefault(); 1812 e.stopPropagation(); 1813 1814 var $html = $( 'html' ); 1815 1816 if ( $html.hasClass( 'navigation--is-visible' ) ) { 1817 $html.removeClass( 'navigation--is-visible' ); 1818 } else { 1819 $html.addClass( 'navigation--is-visible' ); 1820 1821 if ( $html.is( '.is--ancient-android, .is--winmob, .is--ie' ) ) { 1822 $( '.navigation--main' ).height( windowHeight ); 1823 } 1824 } 1825 } ); 1826} 1827 1828 1829/* --- $VIDEOS --- */ 1830 1831function initVideos() { 1832 1833 var videos = $( 'iframe, video' ); 1834 1835 // Figure out and save aspect ratio for each video 1836 videos.each( function() { 1837 $( this ).data( 'aspectRatio', this.width / this.height ) 1838 // and remove the hard coded width/height 1839 .removeAttr( 'height' ) 1840 .removeAttr( 'width' ); 1841 } ); 1842 1843 // Firefox Opacity Video Hack 1844 $( 'iframe' ).each( function() { 1845 var url = $( this ).attr( "src" ); 1846 if ( ! empty( url ) ) { 1847 $( this ).attr( "src", setQueryParameter( url, "wmode", "transparenartt" ) ); 1848 } 1849 } ); 1850} 1851 1852 1853function resizeVideos() { 1854 1855 var videos = $( 'iframe, video' ); 1856 1857 videos.each( function() { 1858 var video = $( this ), 1859 ratio = video.data( 'aspectRatio' ), 1860 w = video.css( 'width', '100%' ).width(), 1861 h = w / ratio; 1862 video.height( h ); 1863 } ); 1864} 1865 1866 1867/* ====== INTERNAL FUNCTIONS END ====== */ 1868 1869function init() { 1870 if ( globalDebug ) { 1871 console.group( "Init" ); 1872 } 1873 1874 // /* GLOBAL VARS */ 1875 touch = false; 1876 1877 if ( typeof ( 1878 isIe 1879 ) != 'undefined' || ( 1880 ! ( 1881 window.ActiveXObject 1882 ) && "ActiveXObject" in window 1883 ) ) { 1884 $( 'html' ).addClass( 'is--ie' ); 1885 } 1886 1887 if ( is_EDGE ) { 1888 $( 'html' ).addClass( 'is--ie-edge' ); 1889 } 1890 1891 // GET BROWSER DIMENSIONS 1892 browserSize(); 1893 1894 // /* DETECT PLATFORM */ 1895 platformDetect(); 1896 1897 loadAddThisScript(); 1898 1899 if ( is_android || window.opera ) { 1900 $( 'html' ).addClass( 'android-browser' ).removeClass( 'no-android-browser' ); 1901 } 1902 1903 /* ONE TIME EVENT HANDLERS */ 1904 eventHandlersOnce(); 1905 1906 /* INSTANTIATE EVENT HANDLERS */ 1907 eventHandlers(); 1908 updateHeaderPadding(); 1909 1910// move waves in siblings so they keep up with the parallax 1911// var $waves = jQuery( '.border-waves' ).not( '.site-footer' ); 1912// $waves.removeClass( 'border-waves' ); 1913// 1914// $waves.each( function( i, obj ) { 1915// var $wave = $( obj ); 1916// $wave.prevAll( '.article__header' ).first().find( '.article__parallax' ).addClass( 'border-waves-top' ); 1917// $wave.nextAll( '.article__header' ).first().find( '.article__parallax' ).addClass( 'border-waves-bottom' ); 1918// $wave.next( '.site-footer' ).addClass( 'border-waves-bottom' ); 1919// } ); 1920// 1921// $( '.site-footer.border-waves' ).prevAll( 'article__header' ).first().find( '.article__parallax' ).addClass( 'border-waves-top border-waves-top--dark' ); 1922 1923 1924 $( '.navigation--main' ).on( 'DOMMouseScroll mousewheel', function( ev ) { 1925 var $this = $( this ), 1926 scrollTop = this.scrollTop, 1927 scrollHeight = this.scrollHeight, 1928 height = $this.height(), 1929 delta = ( 1930 ev.type == 'DOMMouseScroll' ? 1931 ev.originalEvent.detail * - 40 : 1932 ev.originalEvent.wheelDelta 1933 ), 1934 up = delta > 0; 1935 1936 var prevent = function() { 1937 ev.stopPropagation(); 1938 ev.preventDefault(); 1939 ev.returnValue = false;
1940 return false; 1941 }; 1942 1943 if ( ! up && - delta > scrollHeight - height - scrollTop ) { 1944 // Scrolling down, but this will take us past the bottom. 1945 $this.scrollTop( scrollHeight ); 1946 return prevent(); 1947 } else if ( up && delta > scrollTop ) { 1948 // Scrolling up, but this will take us past the top. 1949 $this.scrollTop( 0 ); 1950 return prevent(); 1951 } 1952 } ); 1953 1954 if ( globalDebug ) { 1955 console.groupEnd(); 1956 } 1957} 1958 1959/* ====== EVENT HANDLERS ====== */ 1960 1961function eventHandlersOnce() { 1962 if ( globalDebug ) { 1963 console.group( "Event Handlers Once" ); 1964 } 1965 1966 menuTrigger(); 1967 1968 if ( globalDebug ) { 1969 console.groupEnd(); 1970 } 1971} 1972 1973function eventHandlers() { 1974 if ( globalDebug ) { 1975 console.group( "Event Handlers" ); 1976 } 1977 1978 1979 //Magnific Popup arrows 1980 $( 'body' ).off( 'click', '.js-arrow-popup-prev', magnificPrev ).on( 'click', '.js-arrow-popup-prev', magnificPrev ); 1981 $( 'body' ).off( 'click', '.js-arrow-popup-next', magnificNext ).on( 'click', '.js-arrow-popup-next', magnificNext ); 1982 1983 $( document ).on( 'spam.wpcf7 invalid.wpcf7 mailsent.wpcf7 mailfailed.wpcf7', function() { 1984 setTimeout( function() { 1985 CoverAnimation.initialize(); 1986 }, 300 ); 1987 } ); 1988 1989 var filterHandler; 1990 1991 if ( touch ) { 1992 filterHandler = 'click'; 1993 } else { 1994 filterHandler = 'hover'; 1995 } 1996 1997 if ( touch && windowWidth < 900 ) { 1998 HandleSubmenusOnTouch.init(); 1999 } 2000 2001 if ( ieMobile ) { 2002 filterHandler = 'click'; 2003 } 2004 2005 $( '.pix-dropdown' ).on( filterHandler, function( e ) { 2006 e.stopPropagation(); 2007 2008 $( this ).toggleClass( 'active' ); 2009 } ); 2010 2011 if ( globalDebug ) { 2012 console.groupEnd(); 2013 } 2014} 2015 2016 2017/* --- GLOBAL EVENT HANDLERS --- */ 2018 2019function magnificPrev( e ) { 2020 if ( globalDebug ) { 2021 console.log( "Magnific Popup Prev" ); 2022 } 2023 2024 e.preventDefault(); 2025 var magnificPopup = $.magnificPopup.instance; 2026 magnificPopup.prev(); 2027 return false; 2028} 2029 2030function magnificNext( e ) { 2031 if ( globalDebug ) { 2032 console.log( "Magnific Popup Next" ); 2033 } 2034 2035 e.preventDefault(); 2036 var magnificPopup = $.magnificPopup.instance; 2037 magnificPopup.next(); 2038 return false; 2039} 2040 2041 2042// $(window).bind('beforeunload', function(event) { 2043// if (globalDebug) {console.log("ON BEFORE UNLOAD");} 2044 2045// event.stopPropagation(); 2046 2047// animateBlog('out'); 2048// }); 2049 2050 2051/* ====== ON DOCUMENT READY ====== */ 2052 2053$( document ).ready( function() { 2054 2055 if ( globalDebug ) { 2056 console.group( "OnDocumentReady" ); 2057 } 2058 2059 /* --- INITIALIZE --- */ 2060 init(); 2061 2062 if ( globalDebug ) { 2063 console.groupEnd(); 2064 } 2065} ); 2066 2067 2068/* ====== ON WINDOW LOAD ====== */ 2069 2070$( window ).load( function() { 2071 2072 if ( globalDebug ) { 2073 console.group( "OnWindowLoad" ); 2074 } 2075 2076 StickyHeader.init(); 2077 2078 if ( is_mobile_ie ) { 2079 $( "html" ).addClass( "mobile-ie" ); 2080 } 2081 2082 //Set textarea from contact page to autoresize 2083 if ( $( "textarea" ).length ) { 2084 $( "textarea" ).autosize(); 2085 } 2086 2087 if ( ! $( 'html' ).is( '.ie9, .lt-ie9' ) ) { 2088 setTimeout( function() { 2089 CoverAnimation.initialize(); 2090 }, 600 ); 2091 } else { 2092 setTimeout( function() { 2093 CoverAnimation.initialize(); 2094 }, 400 ); 2095 } 2096 2097 niceScrollInit(); 2098 2099 magnificPopupInit(); 2100 initVideos(); 2101 resizeVideos(); 2102 2103 var Map = new GMap(); 2104 Map.init(); 2105 2106 if ( ! empty( $( '#date-otreservations' ) ) ) { 2107 var dateFormat = $( '#date-otreservations' ).closest( '.otw-wrapper' ).children( '.txtDateFormat' ).attr( 'value' ).toUpperCase(); 2108 2109 // Pikaday 2110 var picker = new Pikaday( { 2111 field: document.getElementById( 'date-otreservations' ), 2112 format: dateFormat, 2113 minDate: moment().toDate(), 2114 defaultDate: moment().toDate(), 2115 setDefaultDate: true 2116 } ); 2117 } 2118 2119 $( '.pixcode--tabs' ).organicTabs(); 2120 DownArrow.initialize(); 2121 2122 setTimeout( function() { 2123 ScrollToTop.initialize(); 2124 }, 60 ); 2125 2126 royalSliderInit(); 2127 updateHeaderPadding(); 2128 2129 loop(); 2130 2131 var $bulletedSections = $('[data-bully]'); 2132 2133 if ( $bulletedSections.length > 1 ) { 2134 2135 $bulletedSections.bully(); 2136 2137 $('.c-bully__bullet').each(function (i, obj) { 2138 2139 var stagger = i * 400, 2140 $obj = $(obj); 2141 2142 setTimeout(function () { 2143 $obj.addClass('c-bully__bullet--pop'); 2144 }, stagger); 2145 }); 2146 } 2147 2148 $html.addClass( 'is--loaded' ); 2149} ); 2150 2151function getOrientation() { 2152 return windowWidth > windowHeight ? "landscape" : "portrait"; 2153} 2154 2155function updateHeaderPadding() { 2156 var $header = $( '.site-header' ), 2157 headerHeight = $header.outerHeight(); 2158 2159 if ( ! $header.next().is( '.c-hero' ) ) { 2160 $('#page').css('paddingTop', headerHeight); 2161 } 2162} 2163 2164$window.on( 'resize', function() { 2165 windowWidth = window.innerWidth; 2166 windowHeight = window.innerHeight; 2167} ); 2168 2169$( window ).on( "debouncedresize", onResize ); 2170 2171$( window ).on( "rellax:restart", function() {
2172 $( '.js-pixslider' ).each(function(i, obj) { 2173 var rs = $(obj).data('royalSlider'); 2174 2175 if (typeof rs !== "undefined") { 2176 rs.updateSliderSize(true); 2177 } 2178 }); 2179}); 2180 2181function onResize() { 2182 var neworientation = getOrientation(); 2183 2184 if ( neworientation !== orientation ) { 2185 orientation = neworientation; 2186 $( window ).trigger( "debouncedorientationchange" ); 2187 } 2188 2189 resizeVideos(); 2190 2191 if ( touch && windowWidth < 900 ) { 2192 HandleSubmenusOnTouch.init(); 2193 } else { 2194 HandleSubmenusOnTouch.release(); 2195 } 2196 2197 requestAnimationFrame( refreshStuff ); 2198} 2199 2200function refreshStuff() { 2201 CoverAnimation.initialize(); 2202 ScrollToTop.initialize(); 2203 $window.trigger( 'rellax' ); 2204} 2205 2206 2207function updateStuff() { 2208 ScrollToTop.update(); 2209 DownArrow.update(); 2210 CoverAnimation.update(); 2211 2212 if ( windowWidth >= 900 ) { 2213 StickyHeader.update(); 2214 } 2215} 2216 2217$( window ).on( "organicTabsChange", function() { 2218 onResize(); 2219 refreshStuff(); 2220 $window.trigger( 'rellax' ); 2221} ); 2222 2223$window.scroll( function() { 2224 newScrollY = (window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0); 2225} ); 2226 2227function loop() { 2228 // Avoid calculations if not needed 2229 if ( latestKnownScrollY !== newScrollY ) { 2230 latestKnownScrollY = newScrollY; 2231 updateStuff(); 2232 } 2233 requestAnimationFrame( loop ); 2234} 2235 2236if ( navigator.userAgent.match( /iPad;.*CPU.*OS 7_\d/i ) && window.innerHeight != document.documentElement.clientHeight ) { 2237 2238 var fixViewportHeight = function() { 2239 $( 'html, body' ).outerHeight( window.innerHeight ); 2240 }; 2241 2242 window.addEventListener( "scroll", fixViewportHeight, false ); 2243 window.addEventListener( "orientationchange", fixViewportHeight, false ); 2244 fixViewportHeight(); 2245} 2246 2247function detectIE() { 2248 var ua = window.navigator.userAgent; 2249 2250 var msie = ua.indexOf( 'MSIE ' ); 2251 if ( msie > 0 ) { 2252 // IE 10 or older => return version number 2253 return parseInt( ua.substring( msie + 5, ua.indexOf( '.', msie ) ), 10 ); 2254 } 2255 2256 var trident = ua.indexOf( 'Trident/' ); 2257 if ( trident > 0 ) { 2258 // IE 11 => return version number 2259 var rv = ua.indexOf( 'rv:' ); 2260 return parseInt( ua.substring( rv + 3, ua.indexOf( '.', rv ) ), 10 ); 2261 } 2262 2263 var edge = ua.indexOf( 'Edge/' ); 2264 if ( edge > 0 ) { 2265 // IE 12 => return version number 2266 return parseInt( ua.substring( edge + 5, ua.indexOf( '.', edge ) ), 10 ); 2267 } 2268 2269 // other browser 2270 return false; 2271} 2272 2273 2274// smooth scrolling to anchors 2275$( function() { 2276 2277 var $header = $( '.site-header' ), 2278 headerHeight = parseInt( $header.outerHeight(), 10 ), 2279 $html = $( 'html' ); 2280 2281 $( '.site-header a[href*="#"]:not([href="#"])' ).click( function() { 2282 2283 var timeout = 0; 2284 2285 if ( $html.hasClass( 'navigation--is-visible' ) ) { 2286 $( 'body' ).css( 'overflow', '' ); 2287 $html.removeClass( 'navigation--is-visible' ); 2288 timeout = 600; 2289 } 2290 2291 2292 if ( location.pathname.replace( /^\//, '' ) == this.pathname.replace( /^\//, '' ) && location.hostname == this.hostname ) { 2293 var target = $( this.hash ); 2294 target = target.length ? target : $( '[name=' + this.hash.slice( 1 ) + ']' ); 2295 if ( target.length ) { 2296 setTimeout( function() { 2297 $( 'html,body' ).animate( { 2298 scrollTop: target.offset().top - headerHeight 2299 }, 1000 ); 2300 }, timeout ); 2301 return false; 2302 } 2303 } 2304 2305 } ); 2306} ); 2307 2308$( "[data-rellax]" ).rellax(); 2309$.fn.rellax.defaults.bleed = 60; 2310$window.trigger( 'rellax' ); 2311// returns the depth of the element "e" relative to element with id=id 2312// for this calculation only parents with classname = waypoint are considered 2313function getLevelDepth(e, id, waypoint, cnt) { 2314 cnt = cnt || 0; 2315 if (e.id.indexOf(id) >= 0) return cnt; 2316 if ($(e).hasClass(waypoint)) { 2317 ++cnt; 2318 } 2319 return e.parentNode && getLevelDepth(e.parentNode, id, waypoint, cnt); 2320} 2321 2322// returns the closest element to 'e' that has class "classname" 2323function closest(e, classname) { 2324 if ($(e).hasClass(classname)) { 2325 return e; 2326 } 2327 return e.parentNode && closest(e.parentNode, classname); 2328} 2329 2330}) (jQuery, window); 2331/*! modernizr 3.3.1 (Custom Build) | MIT * 2332 * https://modernizr.com/download/?-applicationcache-audio-backgroundsize-borderimage-borderradius-boxshadow-canvas-canvastext-cssanimations-csscolumns-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-flexbox-fontface-generatedcontent-geolocation-hashchange-history-hsla-indexeddb-inlinesvg-input-inputtypes-localstorage-multiplebgs-opacity-postmessage-rgba-sessionstorage-smil-svg-svgclippaths-textshadow-touchevents-video-webgl-websockets-websqldatabase-webworkers-addtest-domprefixes-hasevent-mq-prefixed-prefixes-setclasses-shiv-testallprops-testprop-teststyles !*/ 2333!function(e,t,n){function r(e,t){return typeof e===t}function a(){var e,t,n,a,o,i,s;for(var c in x)if(x.hasOwnProperty(c)){if(e=[],t=x[c],t.name&&(e.push(t.name.toLowerCase()),t.options&&t.options.aliases&&t.options.aliases.length))for(n=0;n<t.options.aliases.length;n++)e.push(t.options.aliases[n].toLowerCase());for(a=r(t.fn,"function")?t.fn():t.fn,o=0;o<e.length;o++)i=e[o],s=i.split("."),1===s.length?Modernizr[s[0]]=a:(!Modernizr[s[0]]||Modernizr[s[0]]instanceof Boolean||(Modernizr[s[0]]=new Boolean(Modernizr[s[0]])),Modernizr[s[0]][s[1]]=a),b.push((a?"":"no-")+s.join("-"))}}function o(e){var t=E.className,n=Modernizr._config.classPrefix||"";if(k&&(t=t.baseVal),Modernizr._config.enableJSClass){var r=new RegExp("(^|\\s)"+n+"no-js(\\s|$)");t=t.replace(r,"$1"+n+"js$2")}Modernizr._config.enableClasses&&(t+=" "+n+e.join(" "+n),k?E.className.baseVal=t:E.className=t)}function i(e,t){if("object"==typeof e)for(var n in e)z(e,n)&&i(n,e[n]);else{e=e.toLowerCase();var r=e.split("."),a=Modernizr[r[0]];if(2==r.length&&(a=a[r[1]]),"undefined"!=typeof a)return Modernizr;t="function"==typeof t?t():t,1==r.length?Modernizr[r[0]]=t:(!Modernizr[r[0]]||Modernizr[r[0]]instanceof Boolean||(Modernizr[r[0]]=new Boolean(Modernizr[r[0]])),Modernizr[r[0]][r[1]]=t),o([(t&&0!=t?"":"no-")+r.join("-")]),Modernizr._trigger(e,t)}return Modernizr}function s(){return"function"!=typeof t.createElement?t.createElement(arguments[0]):k?t.createElementNS.call(t,"http://www.w3.org/2000/svg",arguments[0]):t.createElement.apply(t,arguments)}function c(e){return e.replace(/([a-z])-([a-z])/g,function(e,t,n){return t+n.toUpperCase()}).replace(/^-/,"")}function l(e,t){return!!~(""+e).indexOf(t)}function d(){var e=t.body;return e||(e=s(k?"svg":"body"),e.fake=!0),e}function u(e,n,r,a){var o,i,c,l,u="modernizr",f=s("div"),p=d();if(parseInt(r,10))for(;r--;)c=s("div"),c.id=a?a[r]:u+(r+1),f.appendChild(c);return o=s("style"),o.type="text/css",o.id="s"+u,(p.fake?p:f).appendChild(o),p.appendChild(f),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(t.createTextNode(e)),f.id=u,p.fake&&(p.style.background="",p.style.overflow="hidden",l=E.style.overflow,E.style.overflow="hidden",E.appendChild(p)),i=n(f,e),p.fake?(p.parentNode.removeChild(p),E.style.overflow=l,E.offsetHeight):f.parentNode.removeChild(f),!!i}function f(e,t){return function(){return e.apply(t,arguments)}}function p(e,t,n){var a;for(var o in e)if(e[o]in t)return n===!1?e[o]:(a=t[e[o]],r(a,"function")?f(a,n||t):a);return!1}function m(e){return e.replace(/([A-Z])/g,function(e,t){return"-"+t.toLowerCase()}).replace(/^ms-/,"-ms-")}function h(t,r){var a=t.length;if("CSS"in e&&"supports"in e.CSS){for(;a--;)if(e.CSS.supports(m(t[a]),r))return!0;return!1}if("CSSSupportsRule"in e){for(var o=[];a--;)o.push("("+m(t[a])+":"+r+")");return o=o.join(" or "),u("@supports ("+o+") { #modernizr { position: absolute; } }",function(e){return"absolute"==getComputedStyle(e,null).position})}return n}function g(e,t,a,o){function i(){u&&(delete H.style,delete H.modElem)}if(o=r(o,"undefined")?!1:o,!r(a,"undefined")){var d=h(e,a);if(!r(d,"undefined"))return d}for(var u,f,p,m,g,v=["modernizr","tspan","samp"];!H.style&&v.length;)u=!0,H.modElem=s(v.shift()),H.style=H.modElem.style;for(p=e.length,f=0;p>f;f++)if(m=e[f],g=H.style[m],l(m,"-")&&(m=c(m)),H.style[m]!==n){if(o||r(a,"undefined"))return i(),"pfx"==t?m:!0;try{H.style[m]=a}catch(y){}if(H.style[m]!=g)return i(),"pfx"==t?m:!0}return i(),!1}function v(e,t,n,a,o){var i=e.charAt(0).toUpperCase()+e.slice(1),s=(e+" "+W.join(i+" ")+i).split(" ");return r(t,"string")||r(t,"undefined")?g(s,t,a,o):(s=(e+" "+P.join(i+" ")+i).split(" "),p(s,t,n))}function y(e,t,r){return v(e,n,n,t,r)}var b=[],x=[],T={_version:"3.3.1",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,t){var n=this;setTimeout(function(){t(n[e])},0)},addTest:function(e,t,n){x.push({name:e,fn:t,options:n})},addAsyncTest:function(e){x.push({name:null,fn:e})}},Modernizr=function(){};Modernizr.prototype=T,Modernizr=new Modernizr,Modernizr.addTest("applicationcache","applicationCache"in e),Modernizr.addTest("geolocation","geolocation"in navigator),Modernizr.addTest("history",function(){var t=navigator.userAgent;return-1===t.indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone")?e.history&&"pushState"in e.history:!1}),Modernizr.addTest("postmessage","postMessage"in e),Modernizr.addTest("svg",!!t.createElementNS&&!!t.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect);var w=!1;try{w="WebSocket"in e&&2===e.WebSocket.CLOSING}catch(S){}Modernizr.addTest("websockets",w),Modernizr.addTest("localstorage",function(){var e="modernizr";try{return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(t){return!1}}),Modernizr.addTest("sessionstorage",function(){var e="modernizr";try{return sessionStorage.setItem(e,e),sessionStorage.removeItem(e),!0}catch(t){return!1}}),Modernizr.addTest("websqldatabase","openDatabase"in e),Modernizr.addTest("webworkers","Worker"
2333in e);var C=T._config.usePrefixes?" -webkit- -moz- -o- -ms- ".split(" "):["",""];T._prefixes=C;var E=t.documentElement,k="svg"===E.nodeName.toLowerCase();k||!function(e,t){function n(e,t){var n=e.createElement("p"),r=e.getElementsByTagName("head")[0]||e.documentElement;return n.innerHTML="x<style>"+t+"</style>",r.insertBefore(n.lastChild,r.firstChild)}function r(){var e=b.elements;return"string"==typeof e?e.split(" "):e}function a(e,t){var n=b.elements;"string"!=typeof n&&(n=n.join(" ")),"string"!=typeof e&&(e=e.join(" ")),b.elements=n+" "+e,l(t)}function o(e){var t=y[e[g]];return t||(t={},v++,e[g]=v,y[v]=t),t}function i(e,n,r){if(n||(n=t),u)return n.createElement(e);r||(r=o(n));var a;return a=r.cache[e]?r.cache[e].cloneNode():h.test(e)?(r.cache[e]=r.createElem(e)).cloneNode():r.createElem(e),!a.canHaveChildren||m.test(e)||a.tagUrn?a:r.frag.appendChild(a)}function s(e,n){if(e||(e=t),u)return e.createDocumentFragment();n=n||o(e);for(var a=n.frag.cloneNode(),i=0,s=r(),c=s.length;c>i;i++)a.createElement(s[i]);return a}function c(e,t){t.cache||(t.cache={},t.createElem=e.createElement,t.createFrag=e.createDocumentFragment,t.frag=t.createFrag()),e.createElement=function(n){return b.shivMethods?i(n,e,t):t.createElem(n)},e.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+r().join().replace(/[\w\-:]+/g,function(e){return t.createElem(e),t.frag.createElement(e),'c("'+e+'")'})+");return n}")(b,t.frag)}function l(e){e||(e=t);var r=o(e);return!b.shivCSS||d||r.hasCSS||(r.hasCSS=!!n(e,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),u||c(e,r),e}var d,u,f="3.7.3",p=e.html5||{},m=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,h=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,g="_html5shiv",v=0,y={};!function(){try{var e=t.createElement("a");e.innerHTML="<xyz></xyz>",d="hidden"in e,u=1==e.childNodes.length||function(){t.createElement("a");var e=t.createDocumentFragment();return"undefined"==typeof e.cloneNode||"undefined"==typeof e.createDocumentFragment||"undefined"==typeof e.createElement}()}catch(n){d=!0,u=!0}}();var b={elements:p.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:f,shivCSS:p.shivCSS!==!1,supportsUnknownElements:u,shivMethods:p.shivMethods!==!1,type:"default",shivDocument:l,createElement:i,createDocumentFragment:s,addElements:a};e.html5=b,l(t),"object"==typeof module&&module.exports&&(module.exports=b)}("undefined"!=typeof e?e:this,t);var _="Moz O ms Webkit",P=T._config.usePrefixes?_.toLowerCase().split(" "):[];T._domPrefixes=P;var z;!function(){var e={}.hasOwnProperty;z=r(e,"undefined")||r(e.call,"undefined")?function(e,t){return t in e&&r(e.constructor.prototype[t],"undefined")}:function(t,n){return e.call(t,n)}}(),T._l={},T.on=function(e,t){this._l[e]||(this._l[e]=[]),this._l[e].push(t),Modernizr.hasOwnProperty(e)&&setTimeout(function(){Modernizr._trigger(e,Modernizr[e])},0)},T._trigger=function(e,t){if(this._l[e]){var n=this._l[e];setTimeout(function(){var e,r;for(e=0;e<n.length;e++)(r=n[e])(t)},0),delete this._l[e]}},Modernizr._q.push(function(){T.addTest=i});var N=function(){function e(e,t){var a;return e?(t&&"string"!=typeof t||(t=s(t||"div")),e="on"+e,a=e in t,!a&&r&&(t.setAttribute||(t=s("div")),t.setAttribute(e,""),a="function"==typeof t[e],t[e]!==n&&(t[e]=n),t.removeAttribute(e)),a):!1}var r=!("onblur"in t.documentElement);return e}();T.hasEvent=N,Modernizr.addTest("hashchange",function(){return N("hashchange",e)===!1?!1:t.documentMode===n||t.documentMode>7}),Modernizr.addTest("audio",function(){var e=s("audio"),t=!1;try{(t=!!e.canPlayType)&&(t=new Boolean(t),t.ogg=e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),t.mp3=e.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/,""),t.opus=e.canPlayType('audio/ogg; codecs="opus"')||e.canPlayType('audio/webm; codecs="opus"').replace(/^no$/,""),t.wav=e.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),t.m4a=(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""))}catch(n){}return t}),Modernizr.addTest("canvas",function(){var e=s("canvas");return!(!e.getContext||!e.getContext("2d"))}),Modernizr.addTest("canvastext",function(){return Modernizr.canvas===!1?!1:"function"==typeof s("canvas").getContext("2d").fillText}),Modernizr.addTest("video",function(){var e=s("video"),t=!1;try{(t=!!e.canPlayType)&&(t=new Boolean(t),t.ogg=e.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),t.h264=e.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),t.webm=e.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,""),t.vp9=e.canPlayType('video/webm; codecs="vp9"').replace(/^no$/,""),t.hls=e.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/,""))}catch(n){}return t}),Modernizr.addTest("webgl",function(){var t=s("canvas"),n="probablySupportsContext"in t?"probablySupportsContext":"supportsContext";return n in t?t[n]("webgl")||t[n]("experimental-webgl"):"WebGLRenderingContext"in e}),Modernizr.addTest("cssgradients",function(){for(var e,t="background-image:",n="gradient(linear,left top,right bottom,from(#9f9),to(white));",r="",a=0,o=C.length-1;o>a;a++)e=0===a?"to ":"",r+=t+C[a]+"linear-gradient("+e+"left top, #9f9, white);";Modernizr._config.usePrefixes&&(r+=t+"-webkit-"+n);
2333var i=s("a"),c=i.style;return c.cssText=r,(""+c.backgroundImage).indexOf("gradient")>-1}),Modernizr.addTest("multiplebgs",function(){var e=s("a").style;return e.cssText="background:url(https://),url(https://),red url(https://)",/(url\s*\(.*?){3}/.test(e.background)}),Modernizr.addTest("opacity",function(){var e=s("a").style;return e.cssText=C.join("opacity:.55;"),/^0.55$/.test(e.opacity)}),Modernizr.addTest("rgba",function(){var e=s("a").style;return e.cssText="background-color:rgba(150,255,150,.5)",(""+e.backgroundColor).indexOf("rgba")>-1}),Modernizr.addTest("inlinesvg",function(){var e=s("div");return e.innerHTML="<svg/>","http://www.w3.org/2000/svg"==("undefined"!=typeof SVGRect&&e.firstChild&&e.firstChild.namespaceURI)});var R=s("input"),$="autocomplete autofocus list placeholder max min multiple pattern required step".split(" "),A={};Modernizr.input=function(t){for(var n=0,r=t.length;r>n;n++)A[t[n]]=!!(t[n]in R);return A.list&&(A.list=!(!s("datalist")||!e.HTMLDataListElement)),A}($);var O="search tel url email datetime date month week time datetime-local number range color".split(" "),j={};Modernizr.inputtypes=function(e){for(var r,a,o,i=e.length,s="1)",c=0;i>c;c++)R.setAttribute("type",r=e[c]),o="text"!==R.type&&"style"in R,o&&(R.value=s,R.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(r)&&R.style.WebkitAppearance!==n?(E.appendChild(R),a=t.defaultView,o=a.getComputedStyle&&"textfield"!==a.getComputedStyle(R,null).WebkitAppearance&&0!==R.offsetHeight,E.removeChild(R)):/^(search|tel)$/.test(r)||(o=/^(url|email)$/.test(r)?R.checkValidity&&R.checkValidity()===!1:R.value!=s)),j[e[c]]=!!o;return j}(O),Modernizr.addTest("hsla",function(){var e=s("a").style;return e.cssText="background-color:hsla(120,40%,100%,.5)",l(e.backgroundColor,"rgba")||l(e.backgroundColor,"hsla")});var L="CSS"in e&&"supports"in e.CSS,M="supportsCSS"in e;Modernizr.addTest("supports",L||M);var B={}.toString;Modernizr.addTest("svgclippaths",function(){return!!t.createElementNS&&/SVGClipPath/.test(B.call(t.createElementNS("http://www.w3.org/2000/svg","clipPath")))}),Modernizr.addTest("smil",function(){return!!t.createElementNS&&/SVGAnimate/.test(B.call(t.createElementNS("http://www.w3.org/2000/svg","animate")))});var F=function(){var t=e.matchMedia||e.msMatchMedia;return t?function(e){var n=t(e);return n&&n.matches||!1}:function(t){var n=!1;return u("@media "+t+" { #modernizr { position: absolute; } }",function(t){n="absolute"==(e.getComputedStyle?e.getComputedStyle(t,null):t.currentStyle).position}),n}}();T.mq=F;var D=T.testStyles=u;Modernizr.addTest("touchevents",function(){var n;if("ontouchstart"in e||e.DocumentTouch&&t instanceof DocumentTouch)n=!0;else{var r=["@media (",C.join("touch-enabled),("),"heartz",")","{#modernizr{top:9px;position:absolute}}"].join("");D(r,function(e){n=9===e.offsetTop})}return n});var I=function(){var e=navigator.userAgent,t=e.match(/applewebkit\/([0-9]+)/gi)&&parseFloat(RegExp.$1),n=e.match(/w(eb)?osbrowser/gi),r=e.match(/windows phone/gi)&&e.match(/iemobile\/([0-9])+/gi)&&parseFloat(RegExp.$1)>=9,a=533>t&&e.match(/android/gi);return n||a||r}();I?Modernizr.addTest("fontface",!1):D('@font-face {font-family:"font";src:url("https://")}',function(e,n){var r=t.getElementById("smodernizr"),a=r.sheet||r.styleSheet,o=a?a.cssRules&&a.cssRules[0]?a.cssRules[0].cssText:a.cssText||"":"",i=/src/i.test(o)&&0===o.indexOf(n.split(" ")[0]);Modernizr.addTest("fontface",i)}),D('#modernizr{font:0/0 a}#modernizr:after{content:":)";visibility:hidden;font:7px/1 a}',function(e){Modernizr.addTest("generatedcontent",e.offsetHeight>=7)});var W=T._config.usePrefixes?_.split(" "):[];T._cssomPrefixes=W;var q=function(t){var r,a=C.length,o=e.CSSRule;if("undefined"==typeof o)return n;if(!t)return!1;if(t=t.replace(/^@/,""),r=t.replace(/-/g,"_").toUpperCase()+"_RULE",r in o)return"@"+t;for(var i=0;a>i;i++){var s=C[i],c=s.toUpperCase()+"_"+r;if(c in o)return"@-"+s.toLowerCase()+"-"+t}return!1};T.atRule=q;var V={elem:s("modernizr")};Modernizr._q.push(function(){delete V.elem});var H={style:V.elem.style};Modernizr._q.unshift(function(){delete H.style});var U=T.testProp=function(e,t,r){return g([e],n,t,r)};Modernizr.addTest("textshadow",U("textShadow","1px 1px")),T.testAllProps=v;var G,J=T.prefixed=function(e,t,n){return 0===e.indexOf("@")?q(e):(-1!=e.indexOf("-")&&(e=c(e)),t?v(e,t,n):v(e,"pfx"))};try{G=J("indexedDB",e)}catch(S){}Modernizr.addTest("indexeddb",!!G),G&&Modernizr.addTest("indexeddb.deletedatabase","deleteDatabase"in G),T.testAllProps=y,Modernizr.addTest("cssanimations",y("animationName","a",!0)),Modernizr.addTest("backgroundsize",y("backgroundSize","100%",!0)),Modernizr.addTest("borderimage",y("borderImage","url() 1",!0)),Modernizr.addTest("borderradiu
2333s",y("borderRadius","0px",!0)),Modernizr.addTest("boxshadow",y("boxShadow","1px 1px",!0)),function(){Modernizr.addTest("csscolumns",function(){var e=!1,t=y("columnCount");try{(e=!!t)&&(e=new Boolean(e))}catch(n){}return e});for(var e,t,n=["Width","Span","Fill","Gap","Rule","RuleColor","RuleStyle","RuleWidth","BreakBefore","BreakAfter","BreakInside"],r=0;r<n.length;r++)e=n[r].toLowerCase(),t=y("column"+n[r]),("breakbefore"===e||"breakafter"===e||"breakinside"==e)&&(t=t||y(n[r])),Modernizr.addTest("csscolumns."+e,t)}(),Modernizr.addTest("flexbox",y("flexBasis","1px",!0)),Modernizr.addTest("cssreflections",y("boxReflect","above",!0)),Modernizr.addTest("csstransforms",function(){return-1===navigator.userAgent.indexOf("Android 2.")&&y("transform","scale(1)",!0)}),Modernizr.addTest("csstransforms3d",function(){var e=!!y("perspective","1px",!0),t=Modernizr._config.usePrefixes;if(e&&(!t||"webkitPerspective"in E.style)){var n,r="#modernizr{width:0;height:0}";Modernizr.supports?n="@supports (perspective: 1px)":(n="@media (transform-3d)",t&&(n+=",(-webkit-transform-3d)")),n+="{#modernizr{width:7px;height:18px;margin:0;padding:0;border:0}}",D(r+n,function(t){e=7===t.offsetWidth&&18===t.offsetHeight})}return e}),Modernizr.addTest("csstransitions",y("transition","all",!0)),a(),o(b),delete T.addTest,delete T.addAsyncTest;for(var Z=0;Z<Modernizr._q.length;Z++)Modernizr._q[Z]();e.Modernizr=Modernizr}(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.