1( function( wpbase, $, undefined ) { 2 3 var animation = function() { 4 5 var em = { 6 navigation: { 7 cTimeout: false, 8 cParent: false, 9 lastScroll: 0 10 } 11 }; 12 13 em.navigation.navigationScrollAnimation = function () { 14 var currentScrollPos = $(window).scrollTop(); 15 16 if (currentScrollPos > 100) { 17 $('.b-page-navigation').addClass("b-page-navigation--fixed"); 18 19 if (em.navigation.lastScroll > currentScrollPos) { 20 $('.b-page-navigation').addClass("b-page-navigation--visible"); 21 } else { 22 $('.b-page-navigation').removeClass("b-page-navigation--visible"); 23 } 24 } 25 26 if (currentScrollPos <= 1) { 27 $('.b-page-navigation').removeClass("b-page-navigation--fixed"); 28 $('.b-page-navigation').removeClass("b-page-navigation--visible"); 29 } 30 31 em.navigation.lastScroll = $(window).scrollTop(); 32 }; 33 34 var animations = { 35 // create some properties 36 elements: [], 37 winWidthOk: false, 38 // call any functions to be trigger on dom ready 39 init: function init() { 40 this.capture(); 41 this.checkRequiredWidth(); 42 this.animateFirstBlockIn(); 43 this.setup(); 44 }, 45 capture: function capture() { 46 this.elements = $("[data-animate]"); 47 }, 48 checkRequiredWidth: function checkRequiredWidth() { 49 if (window.innerWidth > 1024) { 50 this.winWidthOk = true; 51 this.animate(); 52 this.animateFirstBlockIn(); 53 } else { 54 this.winWidthOk = false; 55 } 56 }, 57 canWe: function canWe() { 58 if (this.elements.length && this.winWidthOk === true) { 59 return true; 60 } 61 62 return false; 63 }, 64 setup: function setup() { 65 var _this = this; 66 67 $(window).on("scroll", function () { 68 em.navigation.navigationScrollAnimation(); 69 70 if (!_this.canWe()) { 71 return false; 72 } 73 74 _this.animate(); 75 }).scroll(); 76 }, 77 animate: function animate() { 78 this.elements.each(function () { 79 var $win = $(window), 80 $el = $(this), 81 scrollTop = $win.scrollTop(), 82 windowHeight = $win.height(), 83 elTop = $el.offset().top; // el.toggleClass( el.data("animate"), elTop < (scrollTop+windowHeight)); 84 85 if (elTop < scrollTop + windowHeight) { 86 $el.addClass($el.data("animate")); 87 } 88 }); 89 }, 90 animateFirstBlockIn: function animateFirstBlockIn() { 91 if (this.canWe()) { 92 var $el = $('.main-header > section.hero + section'); 93 var $container = $el.find('div').eq(0); 94 95 if (!$el.hasClass('toBeAnimated')) { 96 $container.addClass('animated fadeInUp'); 97 } else { 98 $container.css({ 99 opacity: 1 100 }); 101 } 102 } 103 } 104 }; 105 animations.init(); 106 }; 107 108 wpbase.animation = { 109 init: animation 110 }; 111 112}( window.wpbase = window.wpbase || {}, jQuery ) ); 113 114( function( wpbase, $, undefined ) { 115 116 var blogs = function() { 117 // an example using an object liternal notation to encapsulate into a
117nice package 118 var blog = { 119 // create some properties 120 elements: [], 121 y: false, 122 init: function init() { 123 this.setupMobileClick(); 124 }, 125 setupMobileClick: function setupMobileClick() { 126 $('.js-blog__sidebar-mobile').on("click", function () { 127 $(this).parent().toggleClass("c-sidebar-widget--open"); 128 }); 129 } 130 }; // finally boot the beast up 131 132 blog.init(); 133 }; 134 135 wpbase.blogs = { 136 init: blogs 137 }; 138 139}( window.wpbase = window.wpbase || {}, jQuery ) ); 140 141( function( wpbase, $, undefined ) { 142 143 var clickable = function() { 144 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 145 146 // make a whole area clickable while not breaking nested links 147 // usage: <div class="c-my-component js-clickable h-clickable" data-url="http://km.em87.io">Kilometer race! by <a href="http://www.evermade.fi">Evermade</a></div> 148 $(document).on('click', '.js-clickable', function (e) { 149 var $el = $(this); //if an node clicked within is an achor lets allow to bubble up and do its thing, else go to link 150 151 if (e.target.tagName.toLowerCase() == "a") { 152 return true; 153 } else { 154 var url = $el.attr("data-url"); 155 var target = $el.attr('target'); 156 157 if (url) { 158 if (!target) { 159 // externalize this js-clickable if it's pointed to another domain 160 var a = new RegExp('/' + window.location.host + '/'); 161 162 if (!a.test(url)) { 163 target = '_blank'; 164 } 165 } 166 167 if (_typeof(target) !== (typeof undefined === "undefined" ? "undefined" : _typeof(undefined)) && target !== false) { 168 var win = window.open(url, target); 169 win.focus(); 170 } else { 171 window.location.href = url; 172 } 173 } 174 } 175 }); 176 }; 177 178 wpbase.clickable = { 179 init: clickable 180 }; 181 182}( window.wpbase = window.wpbase || {}, jQuery ) ); 183 184( function( wpbase, $, undefined ) { 185 186 var countdownScript = function() { 187 //const countdown = new Date(); 188 function getRemainingTime(endtime) { 189 var milliseconds = Date.parse(endtime) - Date.parse(new Date()); 190 var seconds = Math.floor(milliseconds / 1000 % 60); 191 var minutes = Math.floor(milliseconds / 1000 / 60 % 60); 192 var hours = Math.floor(milliseconds / (1000 * 60 * 60) % 24); 193 var days = Math.floor(milliseconds / (1000 * 60 * 60 * 24)); 194 return { 195 'total': milliseconds, 196 'seconds': seconds, 197 'minutes': minutes, 198 'hours': hours, 199 'days': days 200 }; 201 } 202 203 var initClock = function initClock(id, endtime) { 204 var counter = document.getElementById(id); 205 var daysItem = counter.querySelector('.js-countdown-days'); 206 var hoursItem = counter.querySelector('.js-countdown-hours'); 207 var minutesItem = counter.querySelector('.js-countdown-minutes'); 208 var secondsItem = counter.querySelector('.js-countdown-seconds'); 209 210 var updateClock = function updateClock() { 211 var time = getRemainingTime(endtime); 212 daysItem.innerHTML = time.days; 213 hoursItem.innerHTML = ('0' + time.hours).slice(-2); 214 minutesItem.innerHTML = ('0' + time.minutes).slice(-2); 215 secondsItem.innerHTML = ('0' + time.seconds).slice(-2); 216 217 if (time.total <= 0) { 218 clearInterval(timeinterval); 219 } 220 }; 221 222 var timeinterval = setInterval(updateClock, 1000); 223 updateClock(); 224 }; //call the init function 225 226 227 if ($('#js-countdown').length) { 228 initClock('js-countdown', new Date(countdown)); 229 } 230 }; 231 232 wpbase.countdownScript = { 233 init: countdownScript 234 }; 235 236}( window.wpbase = window.wpbase || {}, jQuery ) ); 237 238( function( wpbase, $, undefined ) { 239 240 var externalLinks = function() { 241 /** 242 * Automatically sets all external links to open in a new tab. Also includes 243 * protection from the target=_blank + window.location vulnerability. For 244 * cross-browser compatibility, we need to include noopener and n
244oreferrer. 245 * 246 * For more info read https://mathiasbynens.github.io/rel-noopener/ 247 */ 248 var anchors = document.querySelectorAll('a'); 249 250 if (anchors.length > 0) { 251 for (var i = 0; i < anchors.length; ++i) { 252 var a = new RegExp('/' + window.location.host + '/'); 253 var b = new RegExp(/mailto:/); // prevent target blank on mailto links 254 255 if (!a.test(anchors[i].href) && !b.test(anchors[i].href)) { 256 anchors[i].setAttribute("target", "_blank"); 257 anchors[i].setAttribute("rel", "noopener noreferrer"); 258 } 259 } 260 } 261 }; 262 263 wpbase.externalLinks = { 264 init: externalLinks 265 }; 266 267}( window.wpbase = window.wpbase || {}, jQuery ) ); 268 269( function( wpbase, $, undefined ) { 270 271 var flickityCarousels = function() { 272 // http://flickity.metafizzy.co/options.html 273 var elements = document.querySelectorAll('.js-flickity'); 274 275 if (elements.length > 0) { 276 var flky = new Flickity('.js-flickity'); 277 } 278 }; 279 280 wpbase.flickityCarousels = { 281 init: flickityCarousels 282 }; 283 284}( window.wpbase = window.wpbase || {}, jQuery ) ); 285 286( function( wpbase, $, undefined ) { 287 288 var forms = function() { 289 $('select.js-on-change-submit').change(function () { 290 this.form.submit(); 291 }); 292 }; 293 294 wpbase.forms = { 295 init: forms 296 }; 297 298}( window.wpbase = window.wpbase || {}, jQuery ) ); 299 300( function( wpbase, $, undefined ) { 301 302 var reModal = function() { 303 function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 304 305 function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else { return left instanceof right; } } 306 307 (function () { 308 //create empty object in the global em var, dont forget to add the init call in the main.js! 309 var em = {}; 310 em.modal = {}; 311 em.modal.options = { 312 hashTracking: false 313 }; 314 em.modal.firstRun = true; //call any functions to be trigger on dom ready 315 316 em.modal.init = function () { 317 em.modal.setup(); 318 em.modal.closeCallback(); 319 }; 320 321 em.modal.setup = function () { 322 $('[data-remodal-id]').remodal(em.modal.options); 323 324 if (em.modal.firstRun) { 325 $(document).on('opened', '.remodal', function () { 326 // create the close button if it isn't there already 327 var $openModal = $('.remodal.remodal-is-opened'); 328 329 if (!$openModal.find('.remodal-close').length) { 330 $openModal.append('<button data-remodal-action="close" class="remodal-close js-hidden"></button>'); // just to make the opening feel a little smoother: 331 332 setTimeout(function () { 333 $openModal.find('.remodal-close').removeClass('js-hidden'); 334 }, 50); 335 } 336 }); 337 em.modal.firstRun = false; 338 } 339 }; 340 341 em.modal.closeCallback = function () { 342 $(document).on('closed', '.remodal', function (e) { 343 // modal was closed (the contents remain in the DOM) 344 // destroy video players etc here if needed 345 $(".modal-temp").remove(); 346 }); 347 }; 348 349 em.modal.spawn = function (options) { 350 var date = new Date(); 351 var modal_id = 'modal-' + date.getTime(); 352 var $modal = $('<div class="remodal modal-temp" data-remodal-id="' + modal_id + '"></div>'); 353 354 if (typeof options == 'string') { 355 if (options.match(/^(https?:)?\//)) { 356 // options is a url 357 // regexp searches for protocol or slash in the beginning of the string 358 $modal.load(options, function (html) { 359 // options loaded 360 em.modal.show($modal); 361 }); 362 } else if (options !== '') { 363 // assume options is a piece of markup 364 $modal.append(options); 365 em.modal.show($modal); 366 } 367 } else if (typeof options != 'undefined') {
368 if (_instanceof(options, jQuery)) { 369 // options is a jQuery object 370 $modal.append(options); 371 em.modal.show($modal); 372 } else if (_typeof(options) == 'object') { 373 // options is a javascript object 374 if (options.padded) { 375 $modal.addClass('remodal--padded'); 376 } 377 378 if (options.url) { 379 $modal.load(options.url, function (html) { 380 // options loaded 381 em.modal.show($modal); 382 }); 383 } else if (options.content) { 384 $modal.append(options.content); 385 em.modal.show($modal); 386 } 387 } 388 } 389 }; 390 391 em.modal.show = function ($modal) { 392 var instance = $modal.remodal(em.modal.options); 393 instance.open(); 394 }; 395 /** 396 * Helper function to create a new remodal and play a video in it 397 * @param videoId (Video id) 398 * @param videoType (Video type - optional, defaults to Youtube, also accepts vimeo) 399 */ 400 401 402 em.modal.playVideo = function (videoId, videoType) { 403 if (typeof videoId == 'undefined') { 404 return false; 405 } 406 407 if (typeof videoType == 'undefined') { 408 videoType = 'youtube'; 409 } 410 411 videoId = videoId.replace(/[^A-Za-z0-9_-]/g, ''); // clean the video id string 412 413 var remodalId = 'remodal-video-' + videoId; 414 var videoSrc = ''; 415 416 if (videoType == 'vimeo') { 417 videoSrc = 'https://player.vimeo.com/video/' + videoId + '?autoplay=1'; 418 } else { 419 videoSrc = 'https://www.youtube.com/embed/' + videoId + '?autoplay=1'; 420 } 421 422 var $modal = $('<div class="remodal modal-temp" data-remodal-id="' + remodalId + '"><div class="remodal__video"><iframe width="560" height="315" src="' + videoSrc + '" frameborder="0" allowfullscreen></iframe></div></div>'); 423 $modal.appendTo('body').remodal().open(); 424 }; 425 })(); 426 }; 427 428 wpbase.reModal = { 429 init: reModal 430 }; 431 432}( window.wpbase = window.wpbase || {}, jQuery ) ); 433 434( function( wpbase, $, undefined ) { 435 436 var pageNavigation = function() { 437 $('.c-mobile-toggle').on('click', function () { 438 $('body').toggleClass('js-navigation-open'); 439 return false; 440 }); 441 $(document).ready(function () { 442 $('.b-page-navigation__filler').css('height', $('.b-page-navigation').outerHeight()); 443 }); 444 $(function () { 445 $(".c-page-navigation [href]").each(function () { 446 if (this.href == window.location.href) { 447 $(this).addClass("active"); 448 } 449 }); 450 $(".submenu-btn").on('click', function () { 451 document.getElementById("submenu").classList.toggle("show"); 452 }); 453 454 if ($('.c-mobile-toggle:visible').length == 1) { 455 var logoel = $("[data-theme='orange'] .c-page-navigation a img"); 456 logoel.attr('src', '../wp-content/themes/swiss/assets/img/WSai_PrimaryLogo_DateLocation_White-400x187.png'); 457 } 458 }); // Close the dropdown menu if the user clicks outside of it 459 460 window.onclick = function (event) { 461 if (!event.target.matches('.submenu-btn')) { 462 var dropdowns = document.getElementsByClassName("submenu-content"); 463 var i; 464 465 for (i = 0; i < dropdowns.length; i++) { 466 var openDropdown = dropdowns[i]; 467 468 if (openDropdown.classList.contains('show')) { 469 openDropdown.classList.remove('show'); 470 } 471 } 472 } 473 }; 474 }; 475 476 wpbase.pageNavigation = { 477 init: pageNavigation 478 }; 479 480}( window.wpbase = window.wpbase || {}, jQuery ) ); 481 482( function( wpbase, $, undefined ) { 483 484 var plugins = function() { 485 var method; 486 487 var noop = function noop() {}; 488 489 var methods = ['assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn']; 490 var length = methods.length; 491 var console = window.console = window.console || {}; 492 493 while (length--) { 494 method = methods[length]; // Only stub undefined methods. 495 496 if (!console[method]) { 497 console[method] = noop; 498 } 499 } 500 }; 501 502 wpbase.plugins = { 503 init: plugins 504 }; 505 506}( window.wpbase = window.wpbase || {}, jQuery ) ); 507 508( function( wpbase, $, undefined ) { 509 510 var programme = function() { 511 $(document).on("click", ".js-programme-item", function () { 512 openEvent($(this)); 513 }); 514 515 if ($('.b-programme').length > 0) {} //em.programme.dropdownsetup(); 516 //em.programme.filterList(); 517 518 /*em.programme.dropdownsetup = function(){ 519 var elements = $(document).find('select.form-control__programme'); 520 for (var i = 0, l = elements.length; i < l; i++) { 521 var $select = $(elements[i]), $label = $select.parents('.form-group').find('label'); 522 $select.select2({ 523 allowClear: false, 524 placeholder: $select.data('placeholder'), 525 minimumResultsForSearch: 0, 526 theme: 'bootstrap', 527 width: '100%' // https://github.com/select2/select2/issues/3278 528 }); 529 // Trigger focus 530 $label.on('click', function (e) { 531 $(this).parents('.form-group').find('select').trigger('focus').select2('focus'); 532 }); 533 // Trigger search
534 $select.on('keydown', function (e) { 535 var $select = $(this), $select2 = $select.data('select2'), $container = $select2.$container; 536 // Unprintable keys 537 if (typeof e.which === 'undefined' || $.inArray(e.which, [0, 8, 9, 12, 16, 17, 18, 19, 20, 27, 33, 34, 35, 36, 37, 38, 39, 44, 45, 46, 91, 92, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 123, 124, 144, 145, 224, 225, 57392, 63289]) >= 0) { 538 return true; 539 } 540 // Opened dropdown 541 if ($container.hasClass('select2-container--open')) { 542 return true; 543 } 544 $select.select2('open'); 545 // Default search value 546 var $search = $select2.dropdown.$search || $select2.selection.$search, query = $.inArray(e.which, [13, 40, 108]) < 0 ? String.fromCharCode(e.which) : ''; 547 if (query !== '') { 548 $search.val(query).trigger('keyup'); 549 } 550 }); 551 $select.on("change",function(){ 552 if($(this).closest(".block.programme").find('[data-val="'+$(this).val()+'"]').length){ } else { 553 $(this).closest(".block.programme").find('.js-tab-nav__active-filters__tags--programme').append("<li data-val='"+$(this).val()+"'>"+$(this).find("[value="+$(this).val()+"]").html()+"</li>"); 554 em.programme.filterList(); 555 } 556 }); 557 // Format, placeholder 558 $select.on('select2:open', function (e) { 559 var $select = $(this), $select2 = $select.data('select2'), $dropdown = $select2.dropdown.$dropdown || $select2.selection.$dropdown, $search = $select2.dropdown.$search || $select2.selection.$search, data = $select.select2('data'); 560 // Above dropdown 561 if ($dropdown.hasClass('select2-dropdown--above')) { 562 $dropdown.append($search.parents('.select2-search--dropdown').detach()); 563 } 564 // Placeholder 565 $search.attr('placeholder', (data[0].text !== '' ? data[0].text : $select.data('placeholder'))); 566 }); 567 } 568 $('.js-tab-nav__active-filters__tags--programme').on("click","li",function(){ 569 $(this).remove(); 570 em.programme.filterList(); 571 }); 572 $('.js-tab-nav__search-input--programme').hideseek(); 573 $('.js-tab-nav__search-input--programme').on("_after", function() { 574 $('.programme__description').hide(); 575 $('.programme__event--day').show(); 576 em.programme.checkDayItems(); 577 }); 578 };*/ 579 580 581 $(".b-programme__filter__selector select").on("change", function () { 582 if ($(this).closest(".b-programme").find('[data-val="' + $(this).val() + '"]').length) { 583 return; 584 } else { 585 if ($(this).val() !== "") { 586 $(this).closest(".b-programme").find('.js-programme__filters').append("<li data-val='" + $(this).val() + "'>" + $(this).find("[value=" + $(this).val() + "]").html() + "</li>"); 587 filterList(); 588 } 589 } 590 591 $(".b-programme__filter__selector select").prop("selectedIndex", 0); 592 }); 593 $('.js-programme__filters').on("click", "li", function () { 594 $(this).remove(); 595 filterList(); 596 }); 597 $('.b-programme__filter__keywords--input').hideseek(); 598 $('.b-programme__filter__keywords--input').on("_after", function (e) { 599 $('.c-programme-item__description__text').hide(); 600 $('.b-programme__listing__day').show(); 601 checkDayItems(); 602 }); 603 604 function filterList() { 605 $('.b-programme').each(function () { 606 $(this).find(".b-programme__listing-table .c-programme-item").hide(); 607 $(this).find('.c-programme-item--day').show(); 608 var count = 0; 609 $(this).find('.js-programme__filters li').each(function () { 610 $(this).closest(".b-programme").find("." + $(this).data("val")).show(); 611 $(this).closest(".b-programme").find("." + $(this).data("val")).parents('.b-programme__listing-table .c-programme-item').show(); 612 count++; 613 }); 614 615 if (count === 0) { 616 $(this).find('.b-programme__filter--active').slideUp(100); 617 $(this).find('.b-programme__listing-table .c-programme-item').show(); 618 } else { 619 $(this).find('.b-programme__filter--active').slideDown(100); 620 } 621 622 checkDayItems(); 623 }); 624 } 625 626 function checkDayItems() { 627 $('.c-programme-item--day').hide(); 628 var children = $('.c-programme-item:visible'); 629 $(children).each(function () { 630 var thisIndex = $(this).index(); 631 $(".c-programme-item--day[data-date-human='" + $(this).data('date-human') + "']").show(); 632 633 for (var i = thisIndex; i > -1; i--) { 634 if ($(".c-programme-item:eq(" + i + ")").hasClass("c-programme-item--day")) { 635 $(".c-programme-item").eq(i).show(); 636 return; 637 } 638 } 639 }); 640 } 641 642 function openEvent(event) { 643 // close event 644 if ($(event).hasClass("c-programme-item--open")) { 645 $(event).removeClass('c-programme-item--open'); 646 $(event).find(".c-programme-item__description__text").slideUp(100); 647 } else { 648 // open event 649 $('.c-programme-item--open').each(function () { 650 $(this).removeClass('c-programme-item--open'); 651 $(this).find(".c-programme-item__description__text").hide(); 652 }); 653 $(event).find(".c-programme-item__description__text").slideDown(100); 654 $(event).addClass("c-programme-item--open"); 655 } 656 } 657 }; 658 659 wpbase.programme = { 660 init: programme 661 }; 662 663}( window.wpbase = window.wpbase || {}, jQuery ) ); 664 665( function( wpbase, $, undefined ) { 666 667 var sessions = function() { 668 $(document).ready(function () { 669 if ($('.b-sessions')) { 670 $('.b-sessions__trackname').on('mouseenter mouseleave', function () { 671 var popup = $(this).next(); 672 popup.detach().prependTo($('body')).toggle(); 673 $(this).on('mouseenter mouseleave', function () { 674 popup.toggle(); 675 }); 676 }); 677 /* We need to Sinchronize the scrollbars */ 678 /* Day 1 */ 679 680 var isSyncingLeftScroll = false;
681 var isSyncingRightScroll = false; 682 var leftDiv = document.getElementById('tracks-name-day1'); 683 var rightDiv = document.getElementById('tracks-day1'); 684 685 if (leftDiv) { 686 leftDiv.onscroll = function () { 687 if (!isSyncingLeftScroll) { 688 isSyncingRightScroll = true; 689 rightDiv.scrollLeft = this.scrollLeft; 690 } 691 isSyncingLeftScroll = false; 692 }; 693 } 694 695 if (rightDiv) { 696 rightDiv.onscroll = function () { 697 if (!isSyncingRightScroll) { 698 isSyncingLeftScroll = true; 699 leftDiv.scrollLeft = this.scrollLeft; 700 } 701 isSyncingRightScroll = false; 702 }; 703 } 704 705 /* Day 2 */ 706 707 var isSyncingLeftScroll2 = false;
708 var isSyncingRightScroll2 = false; 709 var leftDiv2 = document.getElementById('tracks-name-day2'); 710 var rightDiv2 = document.getElementById('tracks-day2'); 711 712 if (leftDiv2) { 713 leftDiv2.onscroll = function () { 714 if (!isSyncingLeftScroll2) { 715 isSyncingRightScroll2 = true; 716 rightDiv2.scrollLeft = this.scrollLeft; 717 } 718 isSyncingLeftScroll2 = false; 719 }; 720 } 721 722 if (rightDiv2) { 723 rightDiv2.onscroll = function () { 724 if (!isSyncingRightScroll2) { 725 isSyncingLeftScroll2 = true; 726 leftDiv2.scrollLeft = this.scrollLeft; 727 } 728 isSyncingRightScroll2 = false; 729 }; 730 } 731 732 $('.b-sessions__day-2').hide(); 733 $('.b-sessions__day-3').hide(); 734 /* We need to be able to toggle days */ 735 736 $('#day-1').on('click', function () { 737 $('.b-sessions__day-1').show(); 738 $('.b-sessions__day-2').hide(); 739 $('.b-sessions__day-3').hide(); 740 }); 741 $('#day-2').on('click', function (e) { 742 $('.b-sessions__day-1').hide(); 743 $('.b-sessions__day-2').show(); 744 $('.b-sessions__day-3').hide(); 745 }); 746 $('#day-3').on('click', function (e) { 747 $('.b-sessions__day-1').hide(); 748 $('.b-sessions__day-2').hide(); 749 $('.b-sessions__day-3').show(); 750 }); 751 } 752 }); 753 }; 754 755 wpbase.sessions = { 756 init: sessions 757 }; 758 759}( window.wpbase = window.wpbase || {}, jQuery ) ); 760 761( function( wpbase, $, undefined ) { 762 763 var smoothSlide = function() { 764 $('a.smoothSlide').on('click', function (event) { 765 if (this.hash !== "") { 766 // Prevent default anchor click behavior 767 event.preventDefault(); // Store hash 768 769 var hash = this.hash; // Using jQuery's animate() method to add smooth page scroll 770 // The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area 771 772 $('html, body').animate({ 773 scrollTop: $(hash).offset().top 774 }, 500, function () { 775 // Add hash (#) to URL when done scrolling (default click behavior) 776 window.location.hash = hash; 777 }); 778 } 779 }); 780 }; 781 782 wpbase.smoothSlide = { 783 init: smoothSlide 784 }; 785 786}( window.wpbase = window.wpbase || {}, jQuery ) ); 787 788( function( wpbase, $, undefined ) { 789 790 var speakers = function() { 791 // Wrap images so we can add overlay 792 if ($('.c-speakers').length > 0) { 793 $('.c-speakers p img').each(function () { 794 $(this).wrap('<div class="c-speakers__image"></div>'); 795 }); 796 } 797 }; 798 799 wpbase.speakers = { 800 init: speakers 801 }; 802 803}( window.wpbase = window.wpbase || {}, jQuery ) ); 804 805( function( wpbase, $, undefined ) { 806 807 var stickyKit = function() { 808 /* 809 810 HOW TO USE: 811 812 Scrolls across the parent component. Viewports 992 and higher 813 <div data-sticky="parent" data-sticky-viewport="> 992"> 814 <div>The child element will stick</div> 815 </div> 816 817 Scrolls to the $(window).scrollTop() 2000px and unsticks. All viewports 818 <div data-sticky="2000px"> 819 <div>The child element will stick</div> 820 </div> 821 822 Scrolls to the very bottom of the document. All Viewports 823 <div data-sticky> 824 <div>The child element will stick</div> 825 </div> 826 827 */ 828 var sticky = {}; // create empty object in the global em var, dont forget to add the init call in the main.js! 829 830 sticky = { 831 elements: $("*[data-swiss-sticky]"), 832 windowScrollTopLast: $(window).scrollTop(), 833 windowDirection: "" 834 }; // call any functions to be trigger on dom ready 835 836 sticky.init = function () { 837 sticky.defineStickyEnd(); 838 setTimeout(function () { 839 sticky.defineStickyEnd(); 840 }, 500); 841 $(window).on("scroll", function () { 842 sticky.render(); 843 }).scroll(); 844 }; 845 846 sticky.defineStickyEnd = function () { 847 $(sticky.elements).each(function () { 848 var dataSticky = $(this).data("swiss-sticky"); // CASE: data-sticky="parent" stops at the end of the parent 849 850 if (dataSticky == "parent") { 851 var dataStickyEnd = $(this).parent().outerHeight() + $(this).parent().offset().top - $(this).outerHeight(); 852 $(this).attr("data-sticky-end", dataStickyEnd); // CASE: data-sticky="1000px" stops when scroll position gets here 853 } else if (dataSticky.search("px") !== -1) { 854 $(this).attr("data-sticky-end", dataSticky.replace("px", "")); // CASE: data-sticky="" sticks to the very end of the website by default 855 } else { 856 $(this).attr("data-sticky-end", $(document).height()); 857 } // define default paraments 858 859 860 $(this).attr("data-sticky-status", ""); 861 $(this).attr("data-sticky-original-top", $(this).offset().top); 862 $(this).attr("style", "height:" + $(this).height() + "px;position:relative;"); 863 }); 864 }; 865 866 sticky.render = function () { 867 var windowScrollTop = $(window).scrollTop(); 868 var windowHeight = $(window).height(); 869 $(sticky.elements).each(function () { 870 if (sticky.checkViewport($(this))) { 871 var thisOffsetTop = $(this).offset().top; // $(this).data("sticky-end") 872 873 var thisOffsetLeft = $(this).offset().left; 874 var negativeSpace = 0; 875 var stickyTarget = $(this).children(":first"); 876 var thisFinalTop; // create negative space. If elment is higher than window then this is required for repositioning. 877 878 if ($(this).height() > windowHeight) { 879 negativeSpace = $(this).height() - windowHeight; 880 } // check if direction was changed 881 882 883 if (sticky.direction() !== sticky.windowDirection && $(this).data("sticky-status") == "active") { 884 // calculate absolute position 885 if (sticky.direction() == "up") { 886 thisFinalTop = windowScrollTop - $(this).parent().offset().top - negativeSpace; 887 } else { 888 thisFinalTop = windowScrollTop - $(this).parent().offset().top; 889 } 890 891 $(this).data("sticky-status", "direction-change"); // detache from fixed and palce in absolute space. 892 893 $(stickyTarget).attr("style", "margin:0;position:absolute;z-index:100;
893top:" + thisFinalTop + "px;width:" + $(this).width() + "px;"); 894 } 895 896 sticky.windowDirection = sticky.direction(); // element is above viewport 897 898 if ($(this).data("sticky-end") <= windowScrollTop - negativeSpace && $(this).data("sticky-status") !== "above") { 899 $(this).data("sticky-status", "above"); 900 thisFinalTop = $(this).data("sticky-end") - $(this).parent().offset().top; 901 $(stickyTarget).attr("style", "margin:0;position:absolute;z-index:100;top:" + thisFinalTop + "px;width:" + $(this).width() + "px;"); // element is sticky GOING UP 902 } else if (windowScrollTop - negativeSpace >= thisOffsetTop && windowScrollTop < $(this).data("sticky-end") && windowScrollTop < $(stickyTarget).offset().top && sticky.windowScrollTopLast > windowScrollTop && $(this).data("sticky-status") !== "active") { 903 $(this).data("sticky-status", "active"); 904 $(stickyTarget).attr("style", "margin:0;position:fixed;z-index:100;top:0px;width:" + $(this).width() + "px;"); // element is sticky GOING DOWN 905 } else if (windowScrollTop - negativeSpace >= thisOffsetTop && windowScrollTop < $(this).data("sticky-end") && windowScrollTop + windowHeight > $(stickyTarget).offset().top + $(stickyTarget).height() && sticky.windowScrollTopLast < windowScrollTop && $(this).data("sticky-status") !== "active") { 906 $(this).data("sticky-status", "active"); 907 $(stickyTarget).attr("style", "margin:0;position:fixed;z-index:100;top:-" + negativeSpace + "px;width:" + $(this).width() + "px;"); // element below viewport 908 } else if (windowScrollTop <= thisOffsetTop && $(this).data("sticky-status") !== "below") { 909 $(this).data("sticky-status", "below"); 910 $(stickyTarget).attr("style", "margin:0;"); 911 } 912 } 913 }); // Update window position so we can check it later. 914 915 sticky.windowScrollTopLast = windowScrollTop; 916 }; // function to check the direction of the browser scroll 917 918 919 sticky.direction = function () { 920 var windowScrollTop = $(window).scrollTop(); 921 var direction = "down"; 922 923 if (sticky.windowScrollTopLast > windowScrollTop) { 924 direction = "up"; 925 } else { 926 direction = "down"; 927 } 928 929 return direction; 930 }; 931 932 sticky.checkViewport = function (stickyParent) { 933 if ($(stickyParent).data("swiss-sticky-viewport")) { 934 var viewportParam = $(stickyParent).data("swiss-sticky-viewport"); 935 var viewportValue; 936 937 if (viewportParam.search("> ") !== -1) { 938 viewportValue = Number(viewportParam.replace("> ", "")); 939 940 if (window.outerWidth < viewportValue) { 941 return false; 942 } 943 } else { 944 viewportValue = Number(viewportParam.replace("< ", "")); 945 946 if (window.outerWidth > viewportValue) { 947 return false; 948 } 949 } 950 } 951 952 return true; 953 }; 954 955 sticky.init(); 956 }; 957 958 wpbase.stickyKit = { 959 init: stickyKit 960 }; 961 962}( window.wpbase = window.wpbase || {}, jQuery ) ); 963 964( function( wpbase, $, undefined ) { 965 966 var toolbox = function() { 967 $('.js-toolbox-switch').on("click", function () { 968 var activateScheme = $(this).attr("data-activate-scheme"); 969 $('#js-toolbox-scheme-target').attr("class", "b-toolbox__scheme-wrapper " + activateScheme); 970 }); 971 }; 972 973 wpbase.toolbox = { 974 init: toolbox 975 }; 976 977}( window.wpbase = window.wpbase || {}, jQuery ) ); 978 979( function( wpbase, $, undefined ) { 980 981 var utm = function() { 982 983 var utmParams = ''; 984 // Check if UTM parameters exist in the current URL 985 if (window.location.search.indexOf('utm_source=') !== -1) {
986 utmParams = window.location.search; 987 } 988 989 // Find all menu links and other links where you want to add UTM parameters 990 var links = document.querySelectorAll('a'); 991 992 for (var i = 0; i < links.length; i++) { 993 var link = links[i]; 994 var href = link.getAttribute('href'); 995 996 // Check if the link is not empty and doesn't already contain UTM parameters 997 if (href && href.indexOf('utm_source=') === -1) { 998 // Check if the link already has a query string 999 if (href.indexOf('?') !== -1) { 1000 // Append UTM parameters with an '&' if a query string already exists 1001 link.setAttribute('href', href + '&' + utmParams.slice(1)); // Slice to remove the leading '?' 1002 } else { 1003 // Append UTM parameters with a '?' if no query string exists 1004 link.setAttribute('href', href + utmParams); 1005 } 1006 } 1007 } 1008 }; 1009 1010 wpbase.utm = { 1011 init: utm 1012 }; 1013 1014}( window.wpbase = window.wpbase || {}, jQuery ) ); 1015( function( wpbase, $, undefined ) { 1016 1017 var youtubePlayer = function() { 1018 /* 1019 1020 Fast way to put youtube-videos into blocks/layouts 1021 1022 Simple usage example: 1023 <div class="c-youtube-api-player js-youtube-api-player" data-video-id="wPaTfMyEbVg"></div> 1024 1025 Example with parameters: 1026 <div class="c-youtube-api-player js-youtube-api-player" data-video-id="wPaTfMyEbVg" data-autoplay="1" data-loop="1" data-sound="0" data-cover="1"></div> 1027 1028 */ 1029 var em = {}; //create empty object in the global em var 1030 1031 em.youtubeAPIPlayer = {}; // create an array to store references to interval-loops 1032 1033 em.youtubeAPIPlayer.loopRefs = []; //call any functions to be trigger on dom ready 1034 1035 em.youtubeAPIPlayer.init = function () { 1036 // check that the youtube iframe api isn't already loaded 1037 if ($("script[src$='www.youtube.com/iframe_api']").length === 0) { 1038 var tag = document.createElement('script'); 1039 tag.src = "https://www.youtube.com/iframe_api"; 1040 var firstScriptTag = document.getElementsByTagName('script')[0]; 1041 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 1042 } 1043 }; 1044 /** 1045 * Function that decides if autoplay should work for the user's device 1046 */ 1047 1048 1049 em.youtubeAPIPlayer.canAutoplay = function () { 1050 /* if (window.innerWidth < 768) { 1051 console.log('cant autoplay 1'); 1052 return 0; 1053 } else if (/iPad|iPhone/.test(navigator.userAgent)) { 1054 console.log('cant autoplay'); 1055 return 0; 1056 }*/ 1057 return 1; 1058 }; 1059 /** 1060 * This will get called once the YouTube script has been loaded 1061 */ 1062 1063 1064 window.onYouTubeIframeAPIReady = function () { 1065 $('.c-youtube-api-player').each(function () { 1066 var $el = $(this); 1067 1068 if (!em.youtubeAPIPlayer.canAutoplay()) { 1069 // force some settings for devices that won't autoplay videos (modify the data-attributes because onReady-function needs to read them again) 1070 $el.data('controls', 1); 1071 $el.data('loop', 0); 1072 $el.data('autoplay', 1); 1073 $el.data('autoplay-viewport', 0); 1074 } // read settings 1075 1076 1077 var id = $el.data('video-id'); 1078 var sound = Number($el.data('sound')) || 0; 1079 var autoplay = Number($el.data('autoplay')) || 1; 1080 var autoplayViewport = Number($el.data('autoplay-viewport')) || 0; 1081 var loop = Number($el.data('loop')) || 0; 1082 var maskLogo = Number($el.data('mask-logo')) || 0; 1083 var controls = Number($el.data('controls')) || 0; 1084 var showinfo = Number($el.data('showinfo')) || 0; 1085 var related = Number($el.data('related')) || 0; 1086 var cover = Number($el.data('cover')) || 0; // hide element if it's used as a background cover 1087 1088 if (cover) { 1089 $el.css({ 1090 'opacity': 0 1091 }); 1092 } // create a unique id for the player 1093 1094
1095 var playerId = 'em-player-' + id + '-' + Math.ceil(Math.random() * 9999); // create a stunt-div that YT script will turn into an iframe 1096 1097 $('<div id="' + playerId + '"></div>').appendTo($el); 1098 var player = new YT.Player(playerId, { 1099 height: '390', 1100 // will be overwritten by css 1101 width: '640', 1102 // this too 1103 videoId: id, 1104 playerVars: { 1105 'autoplay': autoplayViewport ? 0 : autoplay, 1106 'controls': controls, 1107 'showinfo': showinfo, 1108 'rel': related, 1109 // show or hide related videos when video ends 1110 'iv_load_policy': 3, 1111 // hide annotations (notes on video) by default 1112 'wmode': 'transparent' // required to use z-index on the element on IE 1113 1114 }, 1115 events: { 1116 'onReady': em.youtubeAPIPlayer.onReady, 1117 'onStateChange': em.youtubeAPIPlayer.onPlayerStateChange 1118 } 1119 }); 1120 }); 1121 }; 1122 /** 1123 * This will be called once a player has been loaded 1124 */ 1125 1126 1127 em.youtubeAPIPlayer.onReady = function (event) { 1128 var player = event.target; 1129 var $el = $(player.getIframe().parentNode); 1130 var sound = Number($el.data('sound')) || 0; 1131 var loop = Number($el.data('loop')) || 0; 1132 var autoplay = Number($el.data('autoplay')) || 0; 1133 var autoplayViewport = Number($el.data('autoplay-viewport')) || 0; 1134 var cover = Number($el.data('cover')) || 0; 1135 event.target.mute(); 1136 1137 if (autoplayViewport) { 1138 em.youtubeAPIPlayer.playIfInViewport(player, $el, loop); // add a window scroll -listener that will start the video once it gets on the screen 1139 1140 $(window).on('scroll', function () { 1141 em.youtubeAPIPlayer.playIfInViewport(player, $el, loop); 1142 }); 1143 } 1144 1145 if (!autoplayViewport && autoplay && loop) { 1146 em.youtubeAPIPlayer.makeLoop(player); 1147 } 1148 1149 var debounceMe = em.debounce(function () { 1150 em.youtubeAPIPlayer.onResize($el); 1151 }, 250); 1152 window.addEventListener('resize', debounceMe); // make the video cover the parent container 1153 1154 if (cover) { 1155 em.youtubeAPIPlayer.videoFill($el); // wait a bit before showing the player, to make sure video is playing 1156 1157 setTimeout(function () { 1158 $el.css({ 1159 'opacity': 1, 1160 'transition': 'all 5s ease' 1161 }); 1162 }, 500); 1163 } 1164 }; 1165 1166 em.debounce = function (func, wait, immediate) { 1167 var timeout; 1168 return function () { 1169 var context = this, 1170 args = arguments; 1171 1172 var later = function later() { 1173 timeout = null; 1174 if (!immediate) func.apply(context, args); 1175 }; 1176 1177 var callNow = immediate && !timeout; 1178 clearTimeout(timeout); 1179 timeout = setTimeout(later, wait); 1180 if (callNow) func.apply(context, args); 1181 }; 1182 }; 1183 /** 1184 * This will be called when a player's state changes 1185 */ 1186 1187 1188 em.youtubeAPIPlayer.onPlayerStateChange = function (event) { 1189 var player = event.target; 1190 var $el = $(player.getIframe().parentNode); 1191 }; 1192 1193 em.inViewPort = function (el) { 1194 var rect = el.getBoundingClientRect(); 1195 return rect.top >= -el.offsetHeight && rect.left >= -el.offsetWidth && rect.bottom <= el.offsetHeight + (window.innerHeight || document.documentElement.clientHeight) && rect.right <= el.offsetWidth + (window.innerWidth || document.documentElement.clientWidth); 1196 }; 1197 /** 1198 * Start a player if it's in the viewport 1199 */ 1200 1201 1202 em.youtubeAPIPlayer.playIfInViewport = function (player, $el, loop) { 1203 // var scrollTop = window.pageYOffset; 1204 // var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 1205 if (em.inViewPort($el[0])) { 1206 // in viewport, start playing 1207 if (!$el.data('playing')) { 1208 $el.data('playing', 1); 1209 player.playVideo(); 1210 1211 if (loop) { 1212 em.youtubeAPIPlayer.makeLoop(player); 1213 } 1214 } 1215 } else { 1216 // not in viewport - stop playback 1217 if ($el.data('playing')) {
1218 $el.data('playing', 0); 1219 player.pauseVideo(); 1220 } 1221 } 1222 }; 1223 /** 1224 * Make a player loop without a gap by rewinding the video just before it ends 1225 */ 1226 1227 1228 em.youtubeAPIPlayer.makeLoop = function (player) { 1229 var id = $(player.getIframe()).attr('id'); 1230 var videoStartOffset = 0; // if there's a fade-in or glitch, try changing this to 0.5 (seconds) (NEEDS TO BE LESS THAN EndOffset) 1231 1232 var videoEndOffset = 1; // don't let video run all the way because it'll stop. in case of looping problems, try tweaking this 1233 1234 var duration = player.getDuration() - videoEndOffset; // clear the old timing loop if exists 1235 1236 if (typeof em.youtubeAPIPlayer.loopRefs[id] != 'undefined') { 1237 player.seekTo(videoStartOffset); //console.log('go to '+videoStartOffset); 1238 1239 clearInterval(em.youtubeAPIPlayer.loopRefs[id]); //console.log('clear interval'); 1240 } // create timing 1241 //console.log('set interval'); 1242 1243 1244 em.youtubeAPIPlayer.loopRefs[id] = setInterval(function () { 1245 if (player.getPlayerState() == YT.PlayerState.PLAYING) { 1246 // video is still playing, rewind to the beginning 1247 player.seekTo(videoStartOffset); //console.log('go to '+videoStartOffset); 1248 } 1249 }, duration * 1000); 1250 }; 1251 /** 1252 * Make the player behave exactly like the background-size: cover css attribute 1253 */ 1254 1255 1256 em.youtubeAPIPlayer.videoFill = function ($player, aspectRatio) { 1257 var videoHeight, videoWidth; 1258 aspectRatio = typeof aspectRatio === 'undefined' ? 16 / 9 : aspectRatio; // calculate height and width based on container size 1259 1260 if ($player.width() / $player.height() < aspectRatio) { 1261 videoHeight = $player.height(); 1262 videoWidth = videoHeight * aspectRatio; 1263 } else { 1264 videoWidth = $player.width(); 1265 videoHeight = videoWidth / aspectRatio; 1266 } // set video dimensions 1267 1268 1269 $player.find('iframe').css({ 1270 'height': videoHeight + 'px', 1271 'width': videoWidth + 'px' 1272 }); 1273 }; 1274 /** 1275 * Handle browser window resizing 1276 */ 1277 1278 1279 em.youtubeAPIPlayer.onResize = function ($el) { 1280 var cover = Number($el.data('cover')) || 0; 1281 1282 if (cover) { 1283 em.youtubeAPIPlayer.videoFill($el); 1284 } 1285 }; 1286 1287 em.youtubeAPIPlayer.init(); 1288 }; 1289 1290 wpbase.youtubePlayer = { 1291 init: youtubePlayer 1292 }; 1293 1294}( window.wpbase = window.wpbase || {}, jQuery ) ); 1295 1296jQuery( document ).ready( function() { 1297 var base = window.wpbase; 1298 1299 base.plugins.init(); 1300 base.animation.init(); 1301 base.blogs.init(); 1302 base.flickityCarousels.init(); 1303 base.forms.init(); 1304 base.pageNavigation.init(); 1305 base.stickyKit.init(); 1306 base.toolbox.init(); 1307 base.smoothSlide.init(); 1308 base.countdownScript.init(); 1309 base.reModal.init(); 1310 base.programme.init(); 1311 base.speakers.init(); 1312 base.sessions.init(); 1313 base.youtubePlayer.init(); 1314 1315 base.utm.init(); 1316 1317} );
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.