1/** 2 * File changes 3 * 4 * 1. check for variant-active --- lines 16 - 19 5 * 2. Remove all form handlers --- no specific lines 6 * 3. Add instagram client ID & access token references --- search "instagram" 7 * 4. Add google maps pointer image full URL --- search ".png", 2 instances 8 * 5. Remove datepicker section 9 * 6. Smoothscroll, add admin-bar checks var offset = ( $('body').hasClass('admin-bar') ) ? 32 : 0; 10 * 7. Typed headline effect speed parseInt(stack_data.typed_speed) 11 * 8. Changes to flickity call to include linkable thumbnails 12 */ 13 14var mr = (function ($, window, document){ 15 "use strict"; 16 17 var mr = {}, 18 components = {documentReady: [],documentReadyDeferred: [], windowLoad: [], windowLoadDeferred: []}; 19 20 mr.status = {documentReadyRan: false, windowLoadPending: false}; 21 22 if( !jQuery('body').hasClass('variant-active') ){ 23 $(document).ready(documentReady); 24 $(window).on("load", windowLoad); 25 } 26 27 function documentReady(context){ 28 29 context = typeof context === typeof undefined ? $ : context; 30 components.documentReady.concat(components.documentReadyDeferred).forEach(function(component){ 31 component(context); 32 }); 33 mr.status.documentReadyRan = true; 34 if(mr.status.windowLoadPending){ 35 windowLoad(mr.setContext()); 36 } 37 } 38 39 function windowLoad(context){ 40 if(mr.status.documentReadyRan){ 41 mr.status.windowLoadPending = false; 42 context = typeof context === "object" ? $ : context; 43 components.windowLoad.concat(components.windowLoadDeferred).forEach(function(component){ 44 component(context); 45 }); 46 }else{ 47 mr.status.windowLoadPending = true; 48 } 49 } 50 51 mr.setContext = function (contextSelector){ 52 var context = $; 53 if(typeof contextSelector !== typeof undefined){ 54 return function(selector){ 55 return $(contextSelector).find(selector); 56 }; 57 } 58 return context; 59 }; 60 61 mr.components = components; 62 mr.documentReady = documentReady; 63 mr.windowLoad = windowLoad; 64 65 return mr; 66}(jQuery, window, document)); 67 68 69//////////////// Utility Functions 70mr = (function (mr, $, window, document){ 71 "use strict"; 72 mr.util = {}; 73 74 mr.util.requestAnimationFrame = window.requestAnimationFrame || 75 window.mozRequestAnimationFrame || 76 window.webkitRequestAnimationFrame || 77 window.msRequestAnimationFrame; 78 79 mr.util.documentReady = function($){ 80 var today = new Date(); 81 var year = today.getFullYear(); 82 $('.update-year').text(year); 83 }; 84 85 mr.util.windowLoad = function($){ 86 $('[data-delay-src]').each(function(){ 87 var $el = $(this); 88 $el.attr('src', $el.attr('data-delay-src')); 89 $el.removeAttr('data-delay-src'); 90 }); 91 }; 92 93 mr.util.getURLParameter = function(name) { 94 return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [undefined, ""])[1].replace(/\+/g, '%20')) || null; 95 }; 96 97 98 mr.util.capitaliseFirstLetter = function(string) { 99 return string.charAt(0).toUpperCase() + string.slice(1); 100 }; 101 102 mr.util.slugify = function(text, spacesOnly){ 103 if(typeof spacesOnly !== typeof undefined){ 104 return text.replace(/ +/g, ''); 105 }else{ 106 return text 107 .toLowerCase() 108 .replace(/[\~\!\@\#\$\%\^\&\*\(\)\-\_\=\+\]\[\}\{\'\"\;\\\:\?\/\>\<\.\,]+/g, '') 109 .replace(/ +/g, '-'); 110 } 111 }; 112 113 mr.util.sortChildrenByText = function(parentElement, reverse){ 114 var $parentElement = $(parentElement); 115 var $showAll = jQuery('[data-masonry-filter="*"]', $parentElement).eq(0); 116 var items = $parentElement.children().not('[data-masonry-filter="*"]').get(); 117 var order = -1; 118 var order2 = 1; 119 if(typeof reverse !== typeof undefined){order = 1; order2 = -1;} 120 121 items.sort(function(a,b){ 122 var keyA = $(a).text(); 123 var keyB = $(b).text(); 124 125 if (keyA < keyB) return order; 126 if (keyA > keyB) return order2; 127 return 0; 128 }); 129 130 // Append back into place 131 $parentElement.empty().append($showAll); 132 $(items).each(function(i, itm){ 133 $parentElement.append(itm); 134 }); 135 }; 136 137 // Set data-src attribute of element from src to be restored later 138 mr.util.idleSrc = function(context, selector){ 139 140 selector = (typeof selector !== typeof undefined) ? selector : '';
141 var elems = context.is(selector+'[src]') ? context : context.find(selector+'[src]'); 142 143 elems.each(function(index, elem){ 144 elem = $(elem); 145 var currentSrc = elem.attr('src'), 146 dataSrc = elem.attr('data-src'); 147 148 // If there is no data-src, save current source to it 149 if(typeof dataSrc === typeof undefined){ 150 elem.attr('data-src', currentSrc); 151 } 152 153 // Clear the src attribute 154 elem.attr('src', ''); 155 156 }); 157 }; 158 159 // Set src attribute of element from its data-src where it was temporarily stored earlier 160 mr.util.activateIdleSrc = function(context, selector){ 161 162 selector = (typeof selector !== typeof undefined) ? selector : ''; 163 var elems = context.is(selector+'[data-src]') ? context : context.find(selector+'[data-src]'); 164 165 elems.each(function(index, elem){ 166 elem = $(elem); 167 var dataSrc = elem.attr('data-src'); 168 169 // Write the 'src' attribute using the 'data-src' value 170 elem.attr('src', dataSrc); 171 }); 172 }; 173 174 mr.util.pauseVideo = function(context){ 175 var elems = context.is('video') ? context : context.find('video'); 176 177 elems.each(function(index, video){ 178 var playingVideo = $(video).get(0); 179 playingVideo.pause(); 180 }); 181 }; 182 183 // Take a text value in either px (eg. 150px) or vh (eg. 65vh) and return a number in pixels. 184 mr.util.parsePixels = function(text){ 185 var windowHeight = $(window).height(), value; 186 187 // Text text against regular expression for px value. 188 if(/^[1-9]{1}[0-9]*[p][x]$/.test(text)){ 189 return parseInt(text.replace('px', ''),10); 190 } 191 // Otherwise it is vh value. 192 else if(/^[1-9]{1}[0-9]*[v][h]$/.test(text)){ 193 value = parseInt(text.replace('vh', ''),10); 194 // Return conversion to percentage of window height. 195 return windowHeight * (value/100); 196 }else{ 197 // If it is not proper text, return -1 to indicate bad value. 198 return -1; 199 } 200 }; 201 202 mr.components.documentReady.push(mr.util.documentReady); 203 mr.components.windowLoad.push(mr.util.windowLoad); 204 return mr; 205 206}(mr, jQuery, window, document)); 207 208//////////////// Window Functions 209mr = (function (mr, $, window, document){ 210 "use strict"; 211 212 mr.window = {}; 213 mr.window.height = $(window).height(); 214 mr.window.width = $(window).width(); 215 216 $(window).on('resize',function(){ 217 mr.window.height = $(window).height(); 218 mr.window.width = $(window).width(); 219 }); 220 221 return mr; 222}(mr, jQuery, window, document)); 223 224 225//////////////// Scroll Functions 226mr = (function (mr, $, window, document){ 227 "use strict"; 228 229 230 mr.scroll = {}; 231 var raf = window.requestAnimationFrame || 232 window.mozRequestAnimationFrame || 233 window.webkitRequestAnimationFrame || 234 window.msRequestAnimationFrame; 235 mr.scroll.listeners = []; 236 mr.scroll.busy = false; 237 mr.scroll.y = 0; 238 mr.scroll.x = 0; 239 240 var documentReady = function($){ 241
242 //////////////// Capture Scroll Event and fire scroll function 243 jQuery(window).off('scroll.mr'); 244 jQuery(window).on('scroll.mr', function(evt) { 245 if(mr.scroll.busy === false){ 246 247 mr.scroll.busy = true; 248 raf(function(evt){ 249 mr.scroll.update(evt); 250 }); 251 252 } 253 if(evt.stopPropagation){ 254 evt.stopPropagation(); 255 } 256 }); 257 258 }; 259 260 mr.scroll.update = function(event){ 261 262 // Loop through all mr scroll listeners 263 var parallax = typeof window.mr_parallax !== typeof undefined ? true : false; 264 mr.scroll.y = (parallax ? mr_parallax.mr_getScrollPosition() : window.pageYOffset); 265 mr.scroll.busy = false; 266 if(parallax){ 267 mr_parallax.mr_parallaxBackground(); 268 } 269 270 271 if(mr.scroll.listeners.length > 0){ 272 for (var i = 0, l = mr.scroll.listeners.length; i < l; i++) { 273 mr.scroll.listeners[i](event); 274 } 275 } 276 277 }; 278 279 mr.scroll.documentReady = documentReady; 280 281 mr.components.documentReady.push(documentReady); 282 283 return mr; 284 285}(mr, jQuery, window, document)); 286 287 288//////////////// Scroll Class Modifier 289mr = (function (mr, $, window, document){ 290 "use strict"; 291 292 mr.scroll.classModifiers = {}; 293 // Globally accessible list of elements/rules 294 mr.scroll.classModifiers.rules = []; 295 296 mr.scroll.classModifiers.parseScrollRules = function(element){ 297 var text = element.attr('data-scroll-class'), 298 rules = text.split(";"); 299
300 rules.forEach(function(rule){ 301 var ruleComponents, scrollPoint, ruleObject = {}; 302 ruleComponents = rule.replace(/\s/g, "").split(':'); 303 if(ruleComponents.length === 2){ 304 scrollPoint = mr.util.parsePixels(ruleComponents[0]); 305 if(scrollPoint > -1){ 306 ruleObject.scrollPoint = scrollPoint; 307 if(ruleComponents[1].length){ 308 var toggleClass = ruleComponents[1]; 309 ruleObject.toggleClass = toggleClass; 310 // Set variable in object to indicate that element already has class applied 311 ruleObject.hasClass = element.hasClass(toggleClass); 312 ruleObject.element = element.get(0); 313 mr.scroll.classModifiers.rules.push(ruleObject); 314 }else{ 315 // Error: toggleClass component does not exist. 316 //console.log('Error - toggle class not found.'); 317 return false; 318 } 319 }else{ 320 // Error: scrollpoint component was malformed 321 //console.log('Error - Scrollpoint not found.'); 322 return false; 323 } 324 } 325 }); 326 327 if(mr.scroll.classModifiers.rules.length){ 328 return true; 329 }else{ 330 return false; 331 } 332 }; 333 334 mr.scroll.classModifiers.update = function(event){ 335 var currentScroll = mr.scroll.y, 336 scrollRules = mr.scroll.classModifiers.rules, 337 l = scrollRules.length, 338 currentRule; 339 340 // Given the current scrollPoint, check for necessary changes 341 while(l--) { 342 343 currentRule = scrollRules[l]; 344 345 if(currentScroll > currentRule.scrollPoint && !currentRule.hasClass){ 346 // Set local copy and glogal copy at the same time; 347 currentRule.element.classList.add(currentRule.toggleClass); 348 currentRule.hasClass = mr.scroll.classModifiers.rules[l].hasClass = true; 349 } 350 if(currentScroll < currentRule.scrollPoint && currentRule.hasClass){ 351 // Set local copy and glogal copy at the same time; 352 currentRule.element.classList.remove(currentRule.toggleClass); 353 currentRule.hasClass = mr.scroll.classModifiers.rules[l].hasClass = false; 354 } 355 } 356 }; 357 358 var fixedElementSizes = function(){ 359 $('.main-container [data-scroll-class*="pos-fixed"]').each(function(){ 360 var element = $(this); 361 element.css('max-width',element.parent().outerWidth()); 362 element.parent().css('min-height',element.outerHeight()); 363 }); 364 }; 365 366 var documentReady = function($){ 367 // Collect info on all elements that require class modification at load time 368 // Each element has data-scroll-class with a formatted value to represent class to add/remove at a particular scroll point. 369 $('[data-scroll-class]').each(function(){ 370 var element = $(this); 371 372 // Test the rules to be added to an array of rules. 373 if(!mr.scroll.classModifiers.parseScrollRules(element)){ 374 console.log('Error parsing scroll rules on: '+element); 375 } 376 }); 377 378 // For 'position fixed' elements, give them a max-width for correct fixing behaviour 379 fixedElementSizes(); 380 $(window).on('resize', fixedElementSizes); 381 382 // If there are valid scroll rules add classModifiers update function to the scroll event processing queue. 383 if(mr.scroll.classModifiers.rules.length){ 384 mr.scroll.listeners.push(mr.scroll.classModifiers.update); 385 } 386 }; 387 388 mr.components.documentReady.push(documentReady); 389 mr.scroll.classModifiers.documentReady = documentReady; 390 391 392 393 return mr; 394 395}(mr, jQuery, window, document)); 396 397 398//////////////// Accordions 399mr = (function (mr, $, window, document){ 400 "use strict"; 401 402 mr.accordions = {}; 403 404 405 mr.accordions.documentReady = function($){ 406 $('.accordion__title').on('click', function(){ 407 mr.accordions.activatePanel($(this)); 408 }); 409 410 $('.accordion').each(function(){ 411 var accordion = $(this); 412 var minHeight = accordion.outerHeight(true); 413 accordion.css('min-height',minHeight); 414 }); 415 416 if(window.location.hash !== '' && window.location.hash !== '#' && window.location.hash.match(/#\/.*/) === null){ 417 if($('.accordion > li > .accordion__title'+window.location.hash).length){ 418 mr.accordions.activatePanelById(window.location.hash, true); 419 } 420 } 421 422 $('a[href^="#"]').on('click', function(){ 423 mr.accordions.activatePanelById($(this).attr('href'), true); 424 }); 425 }; 426 427 428 429 mr.accordions.activatePanel = function(panel, forceOpen){ 430 var $panel = $(panel), 431 accordion = $panel.closest('.accordion'), 432 li = $panel.closest('li'), 433 openEvent = document.createEvent('Event'), 434 closeEvent = document.createEvent('Event'); 435 436 openEvent.initEvent('panelOpened.accordions.mr', true, true); 437 closeEvent.initEvent('panelClosed.accordions.mr', true, true); 438 439 if(li.hasClass('active')){ 440 if(forceOpen !== true){ 441 li.removeClass('active'); 442 $panel.trigger('panelClosed.accordions.mr').get(0).dispatchEvent(closeEvent); 443 } 444 }else{ 445 if(accordion.hasClass('accordion--oneopen')){ 446 var wasActive = accordion.find('li.active'); 447 if(wasActive.length){ 448 wasActive.removeClass('active'); 449 wasActive.trigger('panelClosed.accordions.mr').get(0).dispatchEvent(closeEvent); 450 } 451 li.addClass('active'); 452 li.trigger('panelOpened.accordions.mr').get(0).dispatchEvent(openEvent); 453 454 }else{ 455 if(!li.is('.active')){ 456 li.trigger('panelOpened.accordions.mr').get(0).dispatchEvent(openEvent); 457 } 458 li.addClass('active'); 459 } 460 } 461 } 462 463 mr.accordions.activatePanelById = function(id, forceOpen){ 464 var panel; 465 466 if(id !== '' && id !== '#'){ 467 panel = $('.accordion > li > .accordion__title#'+id.replace('#', '')); 468 if(panel.length){ 469 $('html, body').stop(true).animate({ 470 scrollTop: (panel.offset().top - 50) 471 }, 1200); 472 mr.accordions.activatePanel(panel, forceOpen); 473 } 474 } 475 }; 476 477 mr.components.documentReady.push(mr.accordions.documentReady); 478 return mr; 479 480}(mr, jQuery, window, document)); 481 482
483//////////////// Alerts 484mr = (function (mr, $, window, document){ 485 "use strict"; 486 487 var documentReady = function($){ 488 $('.alert__close').on('click touchstart', function(){ 489 jQuery(this).closest('.alert').addClass('alert--dismissed'); 490 }); 491 }; 492 493 mr.alerts = { 494 documentReady : documentReady 495 }; 496 497 mr.components.documentReady.push(documentReady); 498 return mr; 499 500}(mr, jQuery, window, document)); 501 502 503//////////////// Backgrounds 504mr = (function (mr, $, window, document){ 505 "use strict"; 506 507 var documentReady = function($){ 508 509 //////////////// Append .background-image-holder <img>'s as CSS backgrounds 510 $('.background-image-holder').each(function() { 511 var imgSrc = $(this).children('img').attr('src'); 512 $(this).css('background', 'url("' + imgSrc + '")').css('background-position', 'initial').css('opacity','1'); 513 }); 514 }; 515 516 mr.backgrounds = { 517 documentReady : documentReady 518 }; 519 520 mr.components.documentReady.push(documentReady); 521 return mr; 522 523}(mr, jQuery, window, document)); 524 525//////////////// Bars 526mr = (function (mr, $, window, document){ 527 "use strict"; 528 529 var documentReady = function($){ 530 $('.nav-container .bar[data-scroll-class*="fixed"]:not(.bar--absolute)').each(function(){ 531 var bar = $(this), 532 barHeight = bar.outerHeight(true); 533 bar.closest('.nav-container').css('min-height',barHeight); 534 }); 535 }; 536 537 mr.bars = { 538 documentReady : documentReady 539 }; 540 541 mr.components.documentReady.push(documentReady); 542 return mr; 543 544}(mr, jQuery, window, document)); 545 546//////////////// Cookies 547mr = (function (mr, $, window, document){ 548 "use strict"; 549 550 mr.cookies = { 551 552 getItem: function (sKey) { 553 if (!sKey) { return null; } 554 return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null; 555 }, 556 setItem: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) { 557 if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return false; } 558 var sExpires = ""; 559 if (vEnd) { 560 switch (vEnd.constructor) { 561 case Number: 562 sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd; 563 break; 564 case String: 565 sExpires = "; expires=" + vEnd; 566 break; 567 case Date: 568 sExpires = "; expires=" + vEnd.toUTCString(); 569 break; 570 } 571 } 572 document.cookie = encodeURIComponent(sKey) + "=" + encodeURIComponent(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : ""); 573 return true; 574 }, 575 removeItem: function (sKey, sPath, sDomain) { 576 if (!this.hasItem(sKey)) { return false; } 577 document.cookie = encodeURIComponent(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : ""); 578 return true; 579 }, 580 hasItem: function (sKey) { 581 if (!sKey) { return false; } 582 return (new RegExp("(?:^|;\\s*)" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie); 583 }, 584 keys: function () { 585 var aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "").split(/\s*(?:\=[^;]*)?;\s*/); 586 for (var nLen = aKeys.length, nIdx = 0; nIdx < nLen; nIdx++) { aKeys[nIdx] = decodeURIComponent(aKeys[nIdx]); } 587 return aKeys; 588 } 589 }; 590 591 return mr; 592 593}(mr, jQuery, window, document)); 594 595//////////////// Countdown 596mr = (function (mr, $, window, document){ 597 "use strict"; 598 599 var documentReady = function($){ 600 601 $('.countdown[data-date]').each(function(){ 602 var element = $(this), 603 date = element.attr('data-date'), 604 daysText = "days", 605 fallback; 606 607 if(typeof element.attr('data-date-fallback') !== typeof undefined){ 608 fallback = element.attr('data-date-fallback'); 609 } 610 611 if(typeof element.attr('data-days-text') !== typeof undefined){ 612 daysText = element.attr('data-days-text'); 613 } 614 615 element.countdown(date, function(event) { 616 if(event.elapsed){ 617 element.text(fallback); 618 }else{ 619 element.text( 620 event.strftime('%D '+daysText+' %H:%M:%S') 621 ); 622 } 623 }); 624 }); 625 626 }; 627 628 mr.countdown = { 629 documentReady : documentReady 630 }; 631 632 mr.components.documentReadyDeferred.push(documentReady); 633 return mr; 634 635}(mr, jQuery, window, document)); 636 637//////////////// Dropdowns 638mr = (function (mr, $, window, document){ 639 "use strict"; 640 mr.dropdowns = {}; 641 mr.dropdowns.done = false;
642 643 var documentReady = function($){ 644 645 var rtl = false; 646 647 if($('html[dir="rtl"]').length){ 648 rtl = true; 649 } 650 651 if(!mr.dropdowns.done){ 652 jQuery(document).on('click','body:not(.dropdowns--hover) .dropdown:not(.dropdown--hover), body.dropdowns--hover .dropdown.dropdown--click',function(event){ 653 var dropdown = jQuery(this); 654 if(jQuery(event.target).is('.dropdown--active > .dropdown__trigger')){ 655 dropdown.siblings().removeClass('dropdown--active').find('.dropdown').removeClass('dropdown--active'); 656 dropdown.toggleClass('dropdown--active'); 657 }else{ 658 $('.dropdown--active').removeClass('dropdown--active'); 659 dropdown.addClass('dropdown--active'); 660 } 661 }); 662 jQuery(document).on('click touchstart', 'body:not(.dropdowns--hover)', function(event){ 663 if(!jQuery(event.target).is('[class*="dropdown"], [class*="dropdown"] *')){ 664 $('.dropdown--active').removeClass('dropdown--active'); 665 } 666 }); 667 jQuery('body.dropdowns--hover .dropdown').on('click', function(event){ 668 event.stopPropagation(); 669 var hoverDropdown = jQuery(this); 670 hoverDropdown.toggleClass('dropdown--active'); 671 }); 672 673 // Append a container to the body for measuring purposes 674 jQuery('body').append('<div class="container containerMeasure" style="opacity:0;pointer-events:none;"></div>'); 675 676 677 678 679 // Menu dropdown positioning 680 if(rtl === false){ 681 repositionDropdowns($); 682 jQuery(window).on('resize', function(){repositionDropdowns($);}); 683 }else{ 684 repositionDropdownsRtl($); 685 jQuery(window).on('resize', function(){repositionDropdownsRtl($);}); 686 } 687 688 mr.dropdowns.done = true; 689 } 690 }; 691 692 function repositionDropdowns($){ 693 $('.dropdown__container').each(function(){ 694 var container, containerOffset, masterOffset, menuItem, content; 695 696 jQuery(this).css('left', ''); 697 698 container = jQuery(this); 699 containerOffset = container.offset().left; 700 masterOffset = jQuery('.containerMeasure').offset().left; 701 menuItem = container.closest('.dropdown').offset().left; 702 content = null; 703 704 container.css('left',((-containerOffset)+(masterOffset))); 705 706 if(container.find('.dropdown__content:not([class*="md-12"])').length){ 707 content = container.find('.dropdown__content'); 708 content.css('left', ((menuItem)-(masterOffset))); 709 } 710 711 }); 712 $('.dropdown__content').each(function(){ 713 var dropdown, offset, width, offsetRight, winWidth, leftCorrect; 714 715 dropdown = jQuery(this); 716 offset = dropdown.offset().left; 717 width = dropdown.outerWidth(true); 718 offsetRight = offset + width; 719 winWidth = jQuery(window).outerWidth(true); 720 leftCorrect = jQuery('.containerMeasure').outerWidth() - width; 721 722 if(offsetRight > winWidth){ 723 dropdown.css('left', leftCorrect); 724 } 725 726 }); 727 } 728 729 function repositionDropdownsRtl($){ 730 731 var windowWidth = jQuery(window).width(); 732 733 $('.dropdown__container').each(function(){ 734 var container, containerOffset, masterOffset, menuItem, content; 735 736 jQuery(this).css('left', ''); 737 738 container = jQuery(this); 739 containerOffset = windowWidth - (container.offset().left + container.outerWidth(true)); 740 masterOffset = jQuery('.containerMeasure').offset().left; 741 menuItem = windowWidth - (container.closest('.dropdown').offset().left + container.closest('.dropdown').outerWidth(true)); 742 content = null; 743 744 container.css('right',((-containerOffset)+(masterOffset))); 745 746 if(container.find('.dropdown__content:not([class*="md-12"])').length){ 747 content = container.find('.dropdown__content'); 748 content.css('right', ((menuItem)-(masterOffset))); 749 } 750 }); 751 $('.dropdown__content').each(function(){ 752 var dropdown, offset, width, offsetRight, winWidth, rightCorrect; 753 754 dropdown = jQuery(this); 755 offset = windowWidth - (dropdown.offset().left + dropdown.outerWidth(true)); 756 width = dropdown.outerWidth(true); 757 offsetRight = offset + width; 758 winWidth = jQuery(window).outerWidth(true); 759 rightCorrect = jQuery('.containerMeasure').outerWidth() - width; 760 761 if(offsetRight > winWidth){ 762 dropdown.css('right', rightCorrect); 763 } 764 765 }); 766 } 767 768 mr.dropdowns.documentReady = documentReady; 769 770 771 mr.components.documentReady.push(documentReady); 772 return mr; 773 774}(mr, jQuery, window, document)); 775 776//////////////// Granim 777mr = (function (mr, $, window, document){ 778 "use strict"; 779 780 var documentReady = function($){ 781 $('[data-gradient-bg]').each(function(index,element){ 782 var granimParent = $(this), 783 granimID = 'granim-'+index+'', 784 colours = granimParent.attr('data-gradient-bg'), 785 pairs = [], 786 tempPair = [], 787 count, 788 passes, 789 i; 790 791 // Canvas element forms the gradient background
792 granimParent.prepend('<canvas id="'+granimID+'"></canvas>'); 793 794 // Regular expression to match comma separated list of hex colour values 795 passes = /^(#[0-9|a-f|A-F]{6}){1}([ ]*,[ ]*#[0-9|a-f|A-F]{6})*$/.test(colours); 796 797 if(passes === true){ 798 colours = colours.replace(' ',''); 799 colours = colours.split(','); 800 count = colours.length; 801 // If number of colours is odd - duplicate last colour to make even array 802 if(count%2 !== 0){ 803 colours.push(colours[count-1]); 804 } 805 for(i = 0; i < (count/2); i++){ 806 tempPair = []; 807 tempPair.push(colours.shift()); 808 tempPair.push(colours.shift()); 809 pairs.push(tempPair); 810 } 811 } 812 813 var granimElement = $(this); 814 var granimInstance = new Granim({ 815 element: '#'+granimID, 816 name: 'basic-gradient', 817 direction: 'left-right', 818 opacity: [1, 1], 819 isPausedWhenNotInView: true, 820 states : { 821 "default-state": { 822 gradients: pairs 823 } 824 } 825 }); 826 }); 827 }; 828 829 mr.granim = { 830 documentReady : documentReady 831 }; 832 833 mr.components.documentReadyDeferred.push(documentReady); 834 return mr; 835 836}(mr, jQuery, window, document)); 837 838//////////////// Instagram 839mr = (function (mr, $, window, document){ 840 "use strict"; 841 842 var documentReady = function($){ 843 844 if($('.instafeed').length){ 845 846 // Replace with your own Access Token and Client ID 847 var token = stack_data.access_token, 848 client = stack_data.client_id, 849 elementToken, elementClient; 850 851 if($('.instafeed[data-access-token][data-client-id]').length){ 852 elementToken = $('.instafeed[data-access-token][data-client-id]').first().attr('data-access-token'); 853 elementClient = $('.instafeed[data-access-token][data-client-id]').first().attr('data-client-id'); 854 855 if(elementToken !== ""){token = elementToken;} 856 if(elementClient !== ""){client = elementClient;} 857 } 858 859 jQuery.fn.spectragram.accessData = { 860 accessToken: token, 861 clientID: client 862 }; 863 } 864 865 $('.instafeed').each(function(){ 866 var feed = $(this), 867 feedID = feed.attr('data-user-name'), 868 fetchNumber = 12; 869 if(typeof feed.attr('data-amount') !== typeof undefined){ 870 fetchNumber = parseInt(feed.attr('data-amount'), 10); 871 } 872 feed.append('<ul></ul>'); 873 feed.children('ul').spectragram('getUserFeed', { 874 query: feedID, 875 max: fetchNumber 876 }); 877 }); 878 }; 879 880 mr.instagram = { 881 documentReady : documentReady 882 }; 883 884 mr.components.documentReadyDeferred.push(documentReady); 885 return mr; 886 887}(mr, jQuery, window, document)); 888 889//////////////// Maps 890mr = (function (mr, $, window, document){ 891 "use strict"; 892 893 mr.maps = {}; 894 895 var documentReady = function($){ 896 // Interact with Map once the user has clicked (to prevent scrolling the page = zooming the map 897 898 $('.map-holder').on('click', function() { 899 $(this).addClass('interact'); 900 }).removeClass('interact'); 901 902 var mapsOnPage = $('.map-container[data-maps-api-key]'); 903 if(mapsOnPage.length){ 904 mapsOnPage.addClass('gmaps-active'); 905 mr.maps.initAPI($); 906 mr.maps.init(); 907 } 908 909 }; 910 mr.maps.documentReady = documentReady; 911 912 mr.maps.initAPI = function($){ 913 // Load Google MAP API JS with callback to initialise when fully loaded 914 if(document.querySelector('[data-maps-api-key]') && !document.querySelector('.gMapsAPI')){ 915 if($('[data-maps-api-key]').length){ 916 var script = document.createElement('script'); 917 var apiKey = $('[data-maps-api-key]:first').attr('data-maps-api-key'); 918 apiKey = typeof apiKey !== typeof undefined ? apiKey : ''; 919 if(apiKey !== ''){ 920 script.type = 'text/javascript'; 921 script.src = 'https://maps.googleapis.com/ma
921ps/api/js?key='+apiKey+'&callback=mr.maps.init'; 922 script.className = 'gMapsAPI'; 923 document.body.appendChild(script); 924 } 925 } 926 } 927 }; 928 929 mr.maps.init = function(){ 930 if(typeof window.google !== "undefined"){ 931 if(typeof window.google.maps !== "undefined"){ 932 933 jQuery('.gmaps-active').each(function(){ 934 var mapElement = this, 935 mapInstance = jQuery(this), 936 mapJSON = typeof mapInstance.attr('data-map-style') !== typeof undefined ? mapInstance.attr('data-map-style'): false, 937 mapStyle = JSON.parse(mapJSON) || [{"featureType":"landscape","stylers":[{"saturation":-100},{"lightness":65},{"visibility":"on"}]},{"featureType":"poi","stylers":[{"saturation":-100},{"lightness":51},{"visibility":"simplified"}]},{"featureType":"road.highway","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"road.arterial","stylers":[{"saturation":-100},{"lightness":30},{"visibility":"on"}]},{"featureType":"road.local","stylers":[{"saturation":-100},{"lightness":40},{"visibility":"on"}]},{"featureType":"transit","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"administrative.province","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":-25},{"saturation":-100}]},{"featureType":"water","elementType":"geometry","stylers":[{"hue":"#ffff00"},{"lightness":-25},{"saturation":-97}]}], 938 zoomLevel = (typeof mapInstance.attr('data-map-zoom') !== typeof undefined && mapInstance.attr('data-map-zoom') !== "") ? mapInstance.attr('data-map-zoom') * 1: 17, 939 showZoomControl = typeof mapInstance.attr('data-zoom-controls') !== typeof undefined ? true : false, 940 zoomControlPos = typeof mapInstance.attr('data-zoom-controls') !== typeof undefined ? mapInstance.attr('data-zoom-controls'): false, 941 latlong = typeof mapInstance.attr('data-latlong') !== typeof undefined ? mapInstance.attr('data-latlong') : false, 942 latitude = latlong ? 1 *latlong.substr(0, latlong.indexOf(',')) : false, 943 longitude = latlong ? 1 * latlong.substr(latlong.indexOf(",") + 1) : false, 944 geocoder = new google.maps.Geocoder(), 945 address = typeof mapInstance.attr('data-address') !== typeof undefined ? mapInstance.attr('data-address').split(';'): [""], 946 markerImage = typeof mapInstance.attr('data-marker-image') !== typeof undefined ? mapInstance.attr('data-marker-image'): stack_data.map_marker, 947 markerTitle = "We Are Here", 948 isDraggable = jQuery(document).width() > 766 ? true : false, 949 map, marker, 950 mapOptions = { 951 draggable: isDraggable, 952 scrollwheel: false, 953 zoom: zoomLevel, 954 disableDefaultUI: true, 955 zoomControl: showZoomControl, 956 zoomControlOptions: zoomControlPos !== false ? {position: google.maps.ControlPosition[zoomControlPos]} : null, 957 styles: mapStyle 958 }; 959 console.log(mapOptions); 960 961 if(typeof mapInstance.attr('data-marker-title') !== typeof undefined && mapInstance.attr('data-marker-title') !== "" ) 962 { 963 markerTitle = stack_data.map_marker_title; 964 } 965 966 if(address !== undefined && address[0] !== ""){ 967 geocoder.geocode( { 'address': address[0].replace('[nomarker]','')}, function(results, status) { 968 if (status === google.maps.GeocoderStatus.OK) { 969 var map = new google.maps.Map(mapElement, mapOptions); 970 map.setCenter(results[0].geometry.location); 971 972 address.forEach(function(address){ 973 var markerGeoCoder; 974 975 markerImage = {url: typeof window.mr_variant === typeof undefined ? typeof markerImage !== "object" ? markerImage: markerImage.url : stack_data.map_marker, scaledSize: new google.maps.Size(50,50)}; 976 977 if(/(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)/.test(address) ){ 978 var latlong = address.split(','), 979 marker = new google.maps.Marker({ 980 position: { lat: 1*latlong[0], lng: 1*latlong[1] }, 981 map: map, 982 icon: markerImage, 983 title: markerTitle, 984 optimised: fal
984se 985 }); 986 } 987 else if(address.indexOf('[nomarker]') < 0){ 988 markerGeoCoder = new google.maps.Geocoder(); 989 markerGeoCoder.geocode( { 'address': address.replace('[nomarker]','')}, function(results, status) { 990 if (status === google.maps.GeocoderStatus.OK) { 991 marker = new google.maps.Marker({ 992 map: map, 993 icon: markerImage, 994 title: markerTitle, 995 position: results[0].geometry.location, 996 optimised: false 997 }); 998 } 999 else{ 1000 console.log('Map marker error: '+status); 1001 } 1002 }); 1003 } 1004 1005 }); 1006 } else { 1007 console.log('There was a problem geocoding the address.'); 1008 } 1009 }); 1010 } 1011 else if(typeof latitude !== typeof undefined && latitude !== "" && latitude !== false && typeof longitude !== typeof undefined && longitude !== "" && longitude !== false ){ 1012 mapOptions.center = { lat: latitude, lng: longitude}; 1013 map = new google.maps.Map(mapInstance, mapOptions); 1014 marker = new google.maps.Marker({ 1015 position: { lat: latitude, lng: longitude }, 1016 map: map, 1017 icon: markerImage, 1018 title: markerTitle 1019 }); 1020 1021 } 1022 1023 }); 1024 } 1025 } 1026 }; 1027 1028 mr.components.documentReady.push(documentReady); 1029 return mr; 1030 1031}(mr, jQuery, window, document)); 1032 1033 1034//////////////// Masonry 1035mr = (function (mr, $, window, document){ 1036 "use strict"; 1037 1038 mr.masonry = mr.masonry || {}; 1039 1040 mr.masonry.documentReady = function($){ 1041 1042 mr.masonry.updateFilters(); 1043 1044 $(document).on('click touchstart', '.masonry__filters li:not(.js-no-action)', function(){ 1045 var masonryFilter = $(this); 1046 var masonryContainer = masonryFilter.closest('.masonry').find('.masonry__container'); 1047 var filterValue = '*'; 1048 if(masonryFilter.attr('data-masonry-filter') !== '*'){ 1049 filterValue = '.filter-'+masonryFilter.attr('data-masonry-filter'); 1050 } 1051 masonryFilter.siblings('li').removeClass('active'); 1052 masonryFilter.addClass('active'); 1053 masonryContainer.removeClass('masonry--animate'); 1054 masonryContainer.on('layoutComplete',function(){ 1055 $(this).addClass('masonry--active'); 1056 if(typeof mr_parallax !== typeof undefined){ 1057 setTimeout(function(){ mr_parallax.profileParallaxElements(); },100); 1058 } 1059 }); 1060 masonryContainer.isotope({ filter: filterValue }); 1061 1062 }); 1063 1064 }; 1065 1066 mr.masonry.windowLoad = function(){ 1067 1068 $('.masonry').each(function(){ 1069 var masonry = $(this).find('.masonry__container'), 1070 masonryParent = $(this), 1071 defaultFilter = '*', 1072 themeDefaults, ao = {}; 1073 1074 themeDefaults = { 1075 itemSelector: '.masonry__item', 1076 filter: '*', 1077 masonry: { 1078 columnWidth: '.masonry__item' 1079 } 1080 }; 1081 1082 // Check for a default filter attribute 1083 if(masonryParent.is('[data-default-filter]')){ 1084 defaultFilter = masonryParent.attr('data-default-filter').toLowerCase(); 1085 defaultFilter = '.filter-'+defaultFilter; 1086 masonryParent.find('li[data-masonry-filter]').removeClass('active'); 1087 masonryParent.find('li[data-masonry-filter="'+masonryParent.attr("data-default-filter").toLowerCase()+'"]').addClass('active'); 1088 } 1089 1090 // Use data attributes to override the default settings and provide a per-masonry customisation where necessary. 1091 ao.filter = defaultFilter !== '*' ? defaultFilter : undefined; 1092 1093 masonry.on('layoutComplete',function(){ 1094 masonry.addClass('masonry--active'); 1095 if(typeof mr_parallax !== typeof undefined){ 1096 setTimeout(function(){ mr_parallax.profileParallaxElements(); },100); 1097 } 1098 }); 1099 1100 1101 masonry.isotope(jQuery.extend({}, themeDefaults, mr.masonry.options, ao)); 1102 1103 }); 1104 }; 1105 1106 mr.masonry.updateFilters = function(masonry){ 1107 1108 // If no argument is supplied, just apply the update to all masonry sets on the page. 1109 masonry = typeof masonry !== typeof undefined ? masonry : '.masonry'; 1110 1111 var $masonry = $(masonry); 1112 1113 $masonry.each(function(){ 1114 var $masonry = $(this), 1115 masonryContainer = $masonry.find('.masonry__container'), 1116 filters = $masonry.find('.masonry__filters'), 1117 // data-filter-all-text can be used to set the word for "all" 1118 filterAllText = typeof filters.attr('data-filter-all-text') !== typeof undefined ? filters.attr('data-filter-all-text') : "All", 1119 filtersList; 1120 1121 // Ensure we are working with a .masonry element 1122 if($masonry.is('.masonry')){ 1123 // If a filterable masonry item exists 1124 if(masonryContainer.find('.masonry__item[data-masonry-filter]').length){ 1125 1126 // Create empty ul for filters 1127 filtersList = filters.find('> ul'); 1128 1129 if(!filtersList.length){ 1130 filtersList = filters.append('<ul></ul>').find('> ul'); 1131 } 1132 1133 // To avoid cases where user leave filter attribute blank 1134 // only take items that have filter attribute 1135 masonryContainer.find('.masonry__item[data-masonry-filter]').each(function(){ 1136 var masonryItem = $(this), 1137 filterString = masonryItem.attr('data-masonry-filter'), 1138 filtersArray = []; 1139 1140 // If not undefined or empty 1141 if(typeof filterString !== typeof undefined && filterString !== ""){ 1142 // Split tags from string into array 1143 filtersArray = filterString.split(','); 1144 } 1145 1146 // Remove all filter classes from item before re-adding them dynamically 1147 masonryItem.removeClass( function(index, className){ 1148 return (className.match (/(^|\s)filter-\S+/g) || []).join(' '); 1149 }); 1150 1151 $(filtersArray).each(function(index, tag){ 1152 1153 // Slugify the tag 1154 var slug = mr.util.slugify(tag); 1155 1156 // Add the filter class to the masonry item 1157 masonryItem.addClass('filter-'+slug); 1158 1159 // If this tag does not appear in the list already, add it 1160 if(!filtersList.find('[data-masonry-filter="'+slug+'"]').length){ 1161 filtersList.append('<li data-masonry-filter="'+slug+'">'+tag+'</li>'); 1162 } 1163 1164 }); 1165 }); 1166
1167 // Remove any unnused filter options in list 1168 filtersList.find('[data-masonry-filter]').each(function(){ 1169 var $this = $(this), 1170 filter = $this.text(); 1171 1172 if($(this).attr('data-masonry-filter') !== "*"){ 1173 if(!$masonry.find('.masonry__item[data-masonry-filter*="'+filter+'"]').length){ 1174 $this.remove(); 1175 } 1176 } 1177 }); 1178 1179 mr.util.sortChildrenByText($(this).find('.masonry__filters ul')); 1180 // Add a filter "all" option 1181 if(!filtersList.find('[data-masonry-filter="*"]').length){ 1182 filtersList.prepend('<li class="active" data-masonry-filter="*">'+filterAllText+'</li>'); 1183 } else { 1184 jQuery('[data-masonry-filter="*"]', filtersList).text(filterAllText); 1185 } 1186 1187 } 1188 //End of "if filterable masonry item exists" 1189 } 1190 //End of "if $masonry is .masonry" 1191 }); 1192 1193 }; 1194 1195 mr.masonry.updateLayout = function(masonry){ 1196 1197 // If no argument is supplied, just apply the update to all masonry sets on the page. 1198 masonry = typeof masonry !== typeof undefined ? masonry : '.masonry'; 1199 1200 var $masonry = $(masonry); 1201 1202 1203 $masonry.each(function(){ 1204 var collection = $(this), 1205 newItems = collection.find('.masonry__item:not([style])'), 1206 masonryContainer = collection.find('.masonry__container'); 1207 1208 if(collection.is('.masonry')){ 1209 if(newItems.length){ 1210 masonryContainer.isotope('appended', newItems).isotope( 'layout'); 1211 } 1212 1213 masonryContainer.isotope('layout'); 1214 } 1215 }); 1216 }; 1217 1218 mr.components.documentReady.push(mr.masonry.documentReady); 1219 mr.components.windowLoad.push(mr.masonry.windowLoad); 1220 return mr; 1221 1222}(mr, jQuery, window, document)); 1223 1224 1225//////////////// Modals 1226mr = (function (mr, $, window, document){ 1227 "use strict"; 1228 1229 mr.modals = {}; 1230 1231 var documentReady = function($){ 1232 var allPageModals = "<div class=\"all-page-modals\"></div>", 1233 mainContainer = $('div.main-container'); 1234 1235 if(mainContainer.length){ 1236 jQuery(allPageModals).insertAfter(mainContainer); 1237 mr.modals.allModalsContainer = $('div.all-page-modals'); 1238 } 1239 else{ 1240 jQuery('body').append(allPageModals); 1241 mr.modals.allModalsContainer = jQuery('body div.all-page-modals'); 1242 } 1243 1244 $('.modal-container').each(function(){ 1245 1246 // Add modal close if none exists 1247 1248 var modal = $(this), 1249 $window = $(window), 1250 modalContent = modal.find('.modal-content'); 1251 1252 1253 if(!modal.find('.modal-close').length){ 1254 modal.find('.modal-content').append('<div class="modal-close modal-close-cross"></div>'); 1255 } 1256 1257 // Set modal height 1258 1259 if(modalContent.attr('data-width') !== undefined){ 1260 var modalWidth = modalContent.attr('data-width').substr(0,modalContent.attr('data-width').indexOf('%')) * 1; 1261 modalContent.css('width',modalWidth + '%'); 1262 } 1263 if(modalContent.attr('data-height') !== undefined){ 1264 var modalHeight = modalContent.attr('data-height').substr(0,modalContent.attr('data-height').indexOf('%')) * 1; 1265 modalContent.css('height',modalHeight + '%'); 1266 } 1267 1268 // Set iframe's src to data-src to stop autoplaying iframes 1269 mr.util.idleSrc(modal, 'iframe'); 1270 1271 }); 1272 1273 1274 $('.modal-instance').each(function(index){ 1275 var modalInstance = $(this); 1276 var modal = modalInstance.find('.modal-container');
1277 var modalContent = modalInstance.find('.modal-content'); 1278 var trigger = modalInstance.find('.modal-trigger'); 1279 1280 // Link modal with modal-id attribute 1281 1282 trigger.attr('data-modal-index',index); 1283 modal.attr('data-modal-index',index); 1284 1285 // Set unique id for multiple triggers 1286 1287 if(typeof modal.attr('data-modal-id') !== typeof undefined){ 1288 trigger.attr('data-modal-id', modal.attr('data-modal-id')); 1289 } 1290 1291 1292 // Attach the modal to the body 1293 modal = modal.detach(); 1294 mr.modals.allModalsContainer.append(modal); 1295 }); 1296 1297 1298 $('.modal-trigger').on('click', function(){ 1299 1300 var modalTrigger = $(this); 1301 var uniqueID, targetModal; 1302 // Determine if the modal id is set by user or is set programatically 1303 1304 if(typeof modalTrigger.attr('data-modal-id') !== typeof undefined){ 1305 uniqueID = modalTrigger.attr('data-modal-id'); 1306 targetModal = mr.modals.allModalsContainer.find('.modal-container[data-modal-id="'+uniqueID+'"]'); 1307 }else{ 1308 uniqueID = $(this).attr('data-modal-index'); 1309 targetModal = mr.modals.allModalsContainer.find('.modal-container[data-modal-index="'+uniqueID+'"]'); 1310 } 1311 1312 mr.util.activateIdleSrc(targetModal, 'iframe'); 1313 mr.modals.autoplayVideo(targetModal); 1314 1315 mr.modals.showModal(targetModal); 1316 1317 return false; 1318 }); 1319 1320 jQuery(document).on('click', '.modal-close', mr.modals.closeActiveModal); 1321 1322 jQuery(document).keyup(function(e) { 1323 if (e.keyCode === 27) { // escape key maps to keycode `27` 1324 mr.modals.closeActiveModal(); 1325 } 1326 }); 1327 1328 $('.modal-container').on('click', function(e) { 1329 if( e.target !== this ) return; 1330 mr.modals.closeActiveModal(); 1331 }); 1332 1333 // Trigger autoshow modals 1334 $('.modal-container[data-autoshow]').each(function(){ 1335 var modal = $(this); 1336 var millisecondsDelay = modal.attr('data-autoshow')*1; 1337 1338 mr.util.activateIdleSrc(modal); 1339 mr.modals.autoplayVideo(modal); 1340 1341 // If this modal has a cookie attribute, check to see if a cookie is set, and if so, don't show it. 1342 if(typeof modal.attr('data-cookie') !== typeof undefined){ 1343 if(!mr.cookies.hasItem(modal.attr('data-cookie'))){ 1344 mr.modals.showModal(modal, millisecondsDelay); 1345 } 1346 }else{ 1347 mr.modals.showModal(modal, millisecondsDelay); 1348 } 1349 }); 1350 1351 // Exit modals 1352 $('.modal-container[data-show-on-exit]').each(function(){ 1353 var modal = jQuery(this), 1354 exitSelector = modal.attr('data-show-on-exit'), 1355 delay = 0; 1356 1357 if(modal.attr('data-delay')){ 1358 delay = parseInt(modal.attr('data-delay'), 10) || 0; 1359 } 1360 1361 // If a valid selector is found, attach leave event to show modal. 1362 if($(exitSelector).length){ 1363 modal.prepend($('<i class="ti-close close-modal">')); 1364 jQuery(document).on('mouseleave', exitSelector, function(){ 1365 if(!$('.modal-active').length){ 1366 if(typeof modal.attr('data-cookie') !== typeof undefined){ 1367 if(!mr.cookies.hasItem(modal.attr('data-cookie'))){ 1368 mr.modals.showModal(modal, delay); 1369 } 1370 }else{ 1371 mr.modals.showModal(modal, delay); 1372 } 1373 } 1374 }); 1375 } 1376 }); 1377 1378 1379 // Autoshow modal by ID from location href 1380 if(window.location.href.split('#').length === 2){ 1381 var modalID = window.location.href.split('#').pop(); 1382 if($('[data-modal-id="'+modalID+'"]').length){ 1383 mr.modals.closeActiveModal(); 1384 mr.modals.showModal($('[data-modal-id="'+modalID+'"]')); 1385 } 1386 } 1387 1388 jQuery(document).on('click','a[href^="#"]', function(){ 1389 var modalID = $(this).attr('href').replace('#', ''); 1390 mr.modals.closeActiveModal(); 1391 setTimeout(mr.modals.showModal, 500,'[data-modal-id="'+modalID+'"]', 0); 1392 }); 1393 1394 // Make modal scrollable 1395 jQuery(document).on('wheel mousewheel scroll','.modal-content, .modal-content .scrollable', function(evt){ 1396 if(evt.preventDefault){evt.preventDefault();} 1397 if(evt.stopPropagation){evt.stopPropagation();} 1398 this.scrollTop += (evt.originalEvent.deltaY); 1399 }); 1400 };
1401 //////////////// 1402 //////////////// End documentReady 1403 //////////////// 1404 1405 mr.modals.documentReady = documentReady; 1406 1407 mr.modals.showModal = function(modal, millisecondsDelay){ 1408 1409 var delay = (typeof millisecondsDelay !== typeof undefined) ? (1*millisecondsDelay) : 0; 1410 1411 setTimeout(function(){ 1412 $(modal).addClass('modal-active'); 1413 },delay); 1414 }; 1415 1416 mr.modals.closeActiveModal = function(){ 1417 var modal = jQuery('body div.modal-active'); 1418 mr.util.idleSrc(modal, 'iframe'); 1419 mr.util.pauseVideo(modal); 1420 1421 // If this modal requires to be closed permanently using a cookie, set the cookie now. 1422 if(typeof modal.attr('data-cookie') !== typeof undefined){ 1423 mr.cookies.setItem(modal.attr('data-cookie'), "true", Infinity, '/'); 1424 } 1425 1426 modal.removeClass('modal-active'); 1427 }; 1428 1429 mr.modals.autoplayVideo = function(modal){ 1430 // If modal contains HTML5 video with autoplay, play the video 1431 if(modal.find('video[autoplay]').length){ 1432 var video = modal.find('video').get(0); 1433 video.play(); 1434 } 1435 }; 1436 1437 mr.components.documentReady.push(documentReady); 1438 return mr; 1439 1440}(mr, jQuery, window, document)); 1441 1442//////////////// Notifications 1443mr = (function (mr, $, window, document){ 1444 "use strict"; 1445 1446 mr.notifications = {}; 1447 1448 var documentReady = function($){ 1449 1450 $('.notification').each(function(){ 1451 var notification = $(this); 1452 if(!notification.find('.notification-close').length){ 1453 notification.append('<div class="notification-close-cross notification-close"></div>'); 1454 } 1455 }); 1456 1457 1458 $('.notification[data-autoshow]').each(function(){ 1459 var notification = $(this); 1460 var millisecondsDelay = parseInt(notification.attr('data-autoshow'),10); 1461 1462 // If this notification has a cookie attribute, check to see if a cookie is set, and if so, don't show it. 1463 if(typeof notification.attr('data-cookie') !== typeof undefined){ 1464 if(!mr.cookies.hasItem(notification.attr('data-cookie'))){ 1465 mr.notifications.showNotification(notification, millisecondsDelay); 1466 } 1467 }else{ 1468 mr.notifications.showNotification(notification, millisecondsDelay); 1469 } 1470 }); 1471 1472 $('[data-notification-link]:not(.notification)').on('click', function(){ 1473 var notificationID = jQuery(this).attr('data-notification-link'); 1474 var notification = $('.notification[data-notification-link="'+notificationID+'"]'); 1475 jQuery('.notification--reveal').addClass('notification--dismissed'); 1476 notification.removeClass('notification--dismissed'); 1477 mr.notifications.showNotification(notification, 0); 1478 return false; 1479 }); 1480 1481 $('.notification-close').on('click', function(){ 1482 var closeButton = jQuery(this); 1483 // Pass the closeNotification function a reference to the close button 1484 mr.notifications.closeNotification(closeButton); 1485 1486 if(closeButton.attr('href') === '#'){ 1487 return false; 1488 } 1489 }); 1490 1491 $('.notification .inner-link').on('click', function(){ 1492 var notificationLink = jQuery(this).closest('.notification').attr('data-notification-link'); 1493 mr.notifications.closeNotification(notificationLink); 1494 }); 1495 1496 }; 1497 1498 mr.notifications.documentReady = documentReady; 1499 1500 mr.notifications.showNotification = function(notification, millisecondsDelay){ 1501 var delay = (typeof millisecondsDelay !== typeof undefined) ? (1*millisecondsDelay) : 0; 1502 setTimeout(function(){ 1503 notification.addClass('notification--reveal'); 1504 notification.closest('nav').addClass('notification--reveal'); 1505 if(notification.find('input').length){ 1506 notification.find('input').first().focus(); 1507 } 1508 },delay); 1509 // If notification has autohide attribute, set a timeout 1510 // for the autohide time plus the original delay time in case notification was called 1511 // on page load 1512 if(notification.is('[data-autohide]')){ 1513 var hideDelay = parseInt(notification.attr('data-autohide'),10); 1514 setTimeout(function(){ 1515 mr.notifications.closeNotification(notification); 1516 },hideDelay+delay); 1517 } 1518 }; 1519 1520 mr.notifications.closeNotification = function(notification){ 1521 var $notification = jQuery(notification); 1522 1523 notification = $notification.is('.notification') ? 1524 $notification : 1525 $notification.is('.notification-close') ? 1526 $notification.closest('.notification') : 1527 $('.notification[data-notification-link="'+notification+'"]'); 1528 1529 notification.addClass('notification--dismissed'); 1530 notification.closest('nav').removeClass('notification--reveal'); 1531 1532 // If this notification requires to be closed permanently using a cookie, set the cookie now. 1533 if(typeof notification.attr('data-cookie') !== typeof undefined){ 1534 mr.cookies.setItem(notification.attr('data-cookie'), "true", Infinity, '/'); 1535 } 1536 }; 1537 1538 mr.components.documentReady.push(documentReady); 1539 return mr; 1540 1541}(mr, jQuery, window, document)); 1542 1543//////////////// Parallax 1544mr = (function (mr, $, window, document){ 1545 "use strict"; 1546 1547 mr.parallax = {}; 1548 1549 var documentReady = function($){ 1550 1551 var $window = $(window); 1552 var windowWidth = $window.width(); 1553 var windowHeight = $window.height(); 1554 var navHeight = $('nav').outerHeight(true); 1555 1556 if (windowWidth > 768) { 1557 var parallaxHero = $('.parallax:nth-of-type(1)'), 1558 parallaxHeroImage = $('.parallax:nth-of-type(1) .background-image-holder'); 1559 1560 parallaxHeroImage.css('top', -(navHeight)); 1561 if(parallaxHero.outerHeight(true) === windowHeight){ 1562 parallaxHeroImage.css('height', windowHeight + navHeight); 1563 } 1564 } 1565 }; 1566 1567 1568 mr.parallax.documentReady = documentReady; 1569 1570 mr.parallax.update = function(){ 1571 if(typeof mr_parallax !== typeof undefined){ 1572 mr_parallax.profileParallaxElements();
1573 mr_parallax.mr_parallaxBackground(); 1574 } 1575 }; 1576 1577 mr.components.documentReady.push(documentReady); 1578 return mr; 1579 1580}(mr, jQuery, window, document)); 1581 1582//////////////// Progress Horizontal (bars) 1583mr = (function (mr, $, window, document){ 1584 "use strict"; 1585 1586 var documentReady = function($){ 1587 1588 var progressBars = []; 1589 1590 $('.progress-horizontal').each(function(){ 1591 var bar = jQuery(this).find('.progress-horizontal__bar'), 1592 barObject = {}, 1593 progress = jQuery('<div class="progress-horizontal__progress"></div>'); 1594 1595 bar.prepend(progress); 1596 1597 barObject.element = bar; 1598 barObject.progress = progress; 1599 barObject.value = parseInt(bar.attr('data-value'),10)+"%"; 1600 barObject.offsetTop = bar.offset().top; 1601 barObject.animate = false; 1602 1603 if(jQuery(this).hasClass('progress-horizontal--animate')){ 1604 barObject.animate = true; 1605 }else{ 1606 progress.css('width',barObject.value); 1607 } 1608 }); 1609 }; 1610 1611 mr.progressHorizontal = { 1612 documentReady : documentReady 1613 }; 1614 1615 mr.components.documentReady.push(documentReady); 1616 return mr; 1617 1618}(mr, jQuery, window, document)); 1619 1620//////////////// EasyPiecharts 1621mr = (function (mr, $, window, document){ 1622 "use strict"; 1623 1624 mr.easypiecharts = {}; 1625 mr.easypiecharts.pies = []; 1626 1627 var documentReady = function($){ 1628 1629 mr.easypiecharts.init = function(){ 1630 1631 mr.easypiecharts.pies = []; 1632 1633 $('.radial').each(function(){ 1634 var pieObject = {}, 1635 currentPie = jQuery(this); 1636 1637 pieObject.element = currentPie; 1638 pieObject.value = parseInt(currentPie.attr('data-value'),10); 1639 pieObject.top = currentPie.offset().top; 1640 pieObject.height = currentPie.height()/2; 1641 pieObject.active = false; 1642 mr.easypiecharts.pies.push(pieObject); 1643 }); 1644 }; 1645 1646 if ($(window).width() < 767) { 1647 mr.easypiecharts.activate = function(){ 1648 mr.easypiecharts.pies.forEach(function(pie){ 1649 pie.element.data('easyPieChart').enableAnimation(); 1650 pie.element.data('easyPieChart').update(pie.value); 1651 pie.element.addClass('radial--active'); 1652 pie.active = true; 1653 }); 1654 }; 1655 } else { 1656 mr.easypiecharts.activate = function(){ 1657 mr.easypiecharts.pies.forEach(function(pie){ 1658 if(Math.round((mr.scroll.y + mr.window.height)) >= Math.round(pie.top+pie.height)){ 1659 if(pie.active === false){ 1660 1661 pie.element.data('easyPieChart').enableAnimation(); 1662 pie.element.data('easyPieChart').update(pie.value); 1663 pie.element.addClass('radial--active'); 1664 pie.active = true; 1665 } 1666 } 1667 }); 1668 }; 1669 } 1670 1671 $('.radial').each(function(){ 1672 var chart = jQuery(this), 1673 value = 0, 1674 color = '#000000', 1675 time = 2000, 1676 pieSize = 110, 1677 barWidth = 3; 1678 1679 if(typeof chart.attr('data-timing') !== typeof undefined){ 1680 time = chart.attr('data-timing')*1; 1681 } 1682 if(typeof chart.attr('data-color') !== typeof undefined){ 1683 color = chart.attr('data-color'); 1684 } 1685 if(typeof chart.attr('data-size') !== typeof undefined){ 1686 pieSize = chart.attr('data-size'); 1687 } 1688 if(typeof chart.attr('data-bar-width') !== typeof undefined){ 1689 barWidth = chart.attr('data-bar-width'); 1690 } 1691 chart.css('height',pieSize).css('width',pieSize); 1692 1693 chart.easyPieChart({ 1694 animate: ({duration: time, enabled: true}), 1695 barColor: color, 1696 scaleColor: false, 1697 size: pieSize, 1698 lineWidth: barWidth 1699 }); 1700 chart.data('easyPieChart').update(0); 1701 }); 1702 1703 if($('.radial').length){ 1704 mr.easypiecharts.init(); 1705 mr.easypiecharts.activate(); 1706 mr.scroll.listeners.push(mr.easypiecharts.activate); 1707 } 1708 1709 }; 1710 1711 mr.easypiecharts.documentReady = documentReady; 1712 1713 mr.components.documentReadyDeferred.push(documentReady); 1714 return mr; 1715 1716}(mr, jQuery, window, document)); 1717 1718//////////////// Flickity 1719mr = (function (mr, $, window, document){ 1720 "use strict"; 1721 1722 mr.sliders = {}; 1723 mr.sliders.draggable = true; 1724 1725 var documentReady = function($){ 1726 1727 $('.slider').each(function(index){ 1728 1729 var slider = $(this); 1730 var sliderInitializer = slider.find('ul.slides'); 1731 sliderInitializer.find('>li').addClass('slide'); 1732 var childnum = sliderInitializer.find('li').length; 1733 var arrows = false;
1734 var paging = false; 1735 var timing = 7000; 1736 var autoplay = true; 1737 var draggable = mr.sliders.draggable; 1738 if(slider.attr('data-arrows') === 'true'){ 1739 arrows = true; 1740 }else{ 1741 arrows = false; 1742 } 1743 if(slider.attr('data-autoplay') === 'false'){ 1744 autoplay = false; 1745 }else{ 1746 autoplay = true; 1747 } 1748 if(slider.attr('data-paging') === 'true' && sliderInitializer.find('li').length > 1){ 1749 paging = true; 1750 }else{ 1751 paging = false; 1752 } 1753 if(slider.attr('data-timing')){ 1754 timing = slider.attr('data-timing')*1; 1755 } 1756 // Set data attribute to inidicate the number of children in the slider 1757 slider.attr('data-children',childnum); 1758 1759 if(childnum < 2){ 1760 draggable = false; 1761 } 1762 1763 var $carousel = $(sliderInitializer); 1764 1765 $carousel.flickity({ 1766 cellSelector: '.slide', 1767 cellAlign: 'left', 1768 wrapAround: true, 1769 pageDots: paging, 1770 prevNextButtons: arrows, 1771 autoPlay: timing, 1772 draggable: draggable, 1773 imagesLoaded: true 1774 }); 1775 1776 jQuery('.thumbnail-trigger').click(function(){ 1777 var index = $(this).index(); 1778 $carousel.flickity( 'select', index ); 1779 jQuery('.thumbnail-trigger').removeClass('active'); 1780 $(this).addClass('active'); 1781 }); 1782 1783 $carousel.on( 'settle.flickity', function() { 1784 var flkty = $carousel.data('flickity'); 1785 jQuery('.thumbnail-trigger').removeClass('active'); 1786 jQuery('.thumbnail-trigger').eq(flkty.selectedIndex).addClass('active'); 1787 }); 1788 1789 $carousel.on( 'scroll.flickity', function( event, progress ) { 1790 if(slider.find('.is-selected').hasClass('controls--dark')){ 1791 slider.addClass('controls--dark'); 1792 }else{ 1793 slider.removeClass('controls--dark'); 1794 } 1795 }); 1796 }); 1797 1798 mr.parallax.update(); 1799 1800 }; 1801 1802 mr.sliders.documentReady = documentReady; 1803 1804 mr.components.documentReadyDeferred.push(documentReady); 1805 return mr; 1806 1807}(mr, jQuery, window, document)); 1808 1809//////////////// Smoothscroll 1810mr = (function (mr, $, window, document){ 1811 "use strict"; 1812 1813 mr.smoothscroll = {}; 1814 mr.smoothscroll.sections = []; 1815 1816 mr.smoothscroll.init = function(){ 1817 mr.smoothscroll.sections = []; 1818 1819 var offset = ( $('body').hasClass('admin-bar') ) ? 32 : 0; 1820 1821 $('a.inner-link').each(function(){ 1822 var sectionObject = {}, 1823 link = $(this), 1824 href = link.attr('href'), 1825 validLink = new RegExp('^#[^\r\n\t\f\v\#\.]+$','gm'); 1826 1827 if(validLink.test(href)){ 1828 1829 if($('section'+href).length){ 1830 1831 sectionObject.id = href; 1832 sectionObject.top = Math.round($(href).offset().top); 1833 sectionObject.height = Math.round($(href).outerHeight()); 1834 sectionObject.link = link.get(0); 1835 sectionObject.active = false; 1836 1837 mr.smoothscroll.sections.push(sectionObject); 1838 } 1839 } 1840 }); 1841 1842 mr.smoothscroll.highlight(); 1843 }; 1844 1845 mr.smoothscroll.highlight = function(){ 1846 var offset = 0; 1847 if($('body[data-smooth-scroll-offset]').length){ 1848 offset = $('body').attr('data-smooth-scroll-offset'); 1849 offset = offset*1; 1850 } 1851 mr.smoothscroll.sections.forEach(function(section){ 1852 if(mr.scroll.y >= section.top + offset && mr.scroll.y < (section.top + section.height + offset)){ 1853 if(section.active === false){ 1854 section.link.classList.add("inner-link--active"); 1855 section.active = true; 1856 } 1857 }else{ 1858 section.link.classList.remove("inner-link--active"); 1859 section.active = false;
1860 } 1861 }); 1862 }; 1863 1864 mr.scroll.listeners.push(mr.smoothscroll.highlight); 1865 1866 var documentReady = function($){ 1867 // Smooth scroll to inner links 1868 var innerLinks = $('a.inner-link'); 1869 1870 if(innerLinks.length){ 1871 innerLinks.each(function(index){ 1872 var link = $(this), 1873 href = link.attr('href'); 1874 if(href.charAt(0) !== "#"){ 1875 link.removeClass('inner-link'); 1876 } 1877 }); 1878 1879 mr.smoothscroll.init(); 1880 $(window).on('resize', mr.smoothscroll.init); 1881 1882 var offset = 0; 1883 var offsetMobile = 0; 1884 if($('body[data-smooth-scroll-offset-mobile]').length){ 1885 offsetMobile = $('body').attr('data-smooth-scroll-offset-mobile'); 1886 offsetMobile = offsetMobile*1; 1887 } 1888 if($('body[data-smooth-scroll-offset]').length){ 1889 offset = $('body').attr('data-smooth-scroll-offset'); 1890 offset = offset*1; 1891 } 1892 1893 if ($(window).width() < 767) { 1894 smoothScroll.init({ 1895 selector: '.inner-link', 1896 selectorHeader: null, 1897 speed: 750, 1898 easing: 'easeInOutCubic', 1899 offset: offsetMobile 1900 }); 1901 } else { 1902 smoothScroll.init({ 1903 selector: '.inner-link', 1904 selectorHeader: null, 1905 speed: 750, 1906 easing: 'easeInOutCubic', 1907 offset: offset 1908 }); 1909 } 1910 1911 } 1912 }; 1913 1914 mr.smoothscroll.documentReady = documentReady; 1915 1916 mr.components.documentReady.push(documentReady); 1917 mr.components.windowLoad.push(mr.smoothscroll.init); 1918 return mr; 1919 1920}(mr, jQuery, window, document)); 1921 1922//////////////// Tabs 1923mr = (function (mr, $, window, document){ 1924 "use strict"; 1925 1926 mr.tabs = {}; 1927 1928 var documentReady = function($){ 1929 $('.tabs').each(function(){ 1930 var tabs = $(this); 1931 tabs.after('<ul class="tabs-content">'); 1932 tabs.find('li').each(function(){ 1933 var currentTab = $(this), 1934 tabContent = currentTab.find('.tab__content').wrap('<li></li>').parent(), 1935 tabContentClone = tabContent.clone(true,true), 1936 cf7Form = tabContentClone.find('div.wpcf7 > form'); 1937 tabContent.remove(); 1938 currentTab.closest('.tabs-container').find('.tabs-content').append(tabContentClone); 1939 if (typeof wpcf7 !== typeof undefined){ 1940 wpcf7.initForm(cf7Form); 1941 } 1942 }); 1943 }); 1944 1945 $('.tabs > li').on('click', function(){ 1946 var clickedTab = $(this), hash; 1947 mr.tabs.activateTab(clickedTab); 1948 1949 // Update the URL bar if the currently clicked tab has an ID 1950 if(clickedTab.is('[id]')){ 1951 // Create the hash from the tab's ID 1952 hash = '#'+ clickedTab.attr('id'); 1953 // Check we are in a newish browser with the history API 1954 if(history.pushState) { 1955 history.pushState(null, null, hash); 1956 } 1957 else { 1958 location.hash = hash; 1959 } 1960 window.dispatchEvent(new Event('resize')); 1961 } 1962 }); 1963 1964 $('.tabs li.active').each(function(){ 1965 mr.tabs.activateTab(this); 1966 }); 1967 1968 if(window.location.hash !== ''){ 1969 mr.tabs.activateTabById(window.location.hash); 1970 } 1971 1972 $('a[href^="#"]').on('click', function(){ 1973 mr.tabs.activateTabById($(this).attr('href')); 1974 }); 1975 1976 }; 1977 1978 mr.tabs.activateTab = function(tab){ 1979 var clickedTab = $(tab), 1980 tabContainer = clickedTab.closest('.tabs-container'), 1981 activeIndex = (clickedTab.index()*1)+(1), 1982 activeContent = tabContainer.find('> .tabs-content > li:nth-of-type('+activeIndex+')'), 1983 openEvent = document.createEvent('Event'), 1984 iframe, radial; 1985 1986 openEvent.initEvent('tabOpened.tabs.mr', true, true); 1987 1988 1989 tabContainer.find('> .tabs > li').removeClass('active'); 1990 tabContainer.find('> .tabs-content > li').removeClass('active'); 1991 1992 clickedTab.addClass('active').trigger('tabOpened.tabs.mr').get(0).dispatchEvent(openEvent); 1993 activeContent.addClass('active'); 1994 1995 1996 1997 // If there is an <iframe> element in the tab, reload its content when the tab is made active. 1998 iframe = activeContent.find('iframe'); 1999 if(iframe.length){ 2000 iframe.attr('src', iframe.attr('src')); 2001 } 2002 }; 2003 2004 2005 2006 mr.tabs.activateTabById = function(id){ 2007 if(id !== '' && id !== '#'){ 2008 $('.tabs > li#'+id.replace('#', '')).click(); 2009 } 2010 }; 2011 2012 mr.tabs.documentReady = documentReady; 2013 mr.components.documentReady.push(documentReady); 2014 return mr; 2015 2016}(mr, jQuery, window, document)); 2017 2018//////////////// Toggle Class 2019mr = (function (mr, $, window, document){ 2020 "use strict"; 2021 2022 var documentReady = function($){ 2023 $('[data-toggle-class]').each(function(){ 2024 var element = $(this), 2025 data = element.attr('data-toggle-class').split("|"); 2026 2027 2028 $(data).each(function(){ 2029 var candidate = element, 2030 dataArray = [], 2031 toggleClass = '', 2032 toggleElement = '', 2033 dataArray = this.split(";"); 2034 2035 if(dataArray.length === 2){ 2036 toggleElement = dataArray[0]; 2037 toggleClass = dataArray[1]; 2038 $(candidate).on('click',function(){ 2039 if(!candidate.hasClass('toggled-class')){ 2040 candidate.toggleClass('toggled-class'); 2041 }else{ 2042 candidate.removeClass('toggled-class'); 2043 } 2044 $(toggleElement).toggleClass(toggleClass); 2045 return false;
2046 }); 2047 }else{ 2048 console.log('Error in [data-toggle-class] attribute. This attribute accepts an element, or comma separated elements terminated witha ";" followed by a class name to toggle'); 2049 } 2050 }); 2051 }); 2052 }; 2053 2054 mr.toggleClass = { 2055 documentReady : documentReady 2056 }; 2057 2058 mr.components.documentReady.push(documentReady); 2059 return mr; 2060 2061}(mr, jQuery, window, document)); 2062 2063//////////////// Typed Headline Effect 2064mr = (function (mr, $, window, document){ 2065 "use strict"; 2066 2067 var documentReady = function($){ 2068 $('.typed-text').each(function(){ 2069 var text = $(this); 2070 var strings = text.attr("data-typed-strings") ? text.attr("data-typed-strings").split(",") : []; 2071 $(text).typed({ 2072 strings: strings, 2073 typeSpeed: parseInt(stack_data.typed_speed), 2074 loop: true, 2075 showCursor: false 2076 }); 2077 }); 2078 }; 2079 2080 mr.typed = { 2081 documentReady : documentReady 2082 }; 2083 2084 mr.components.documentReady.push(documentReady); 2085 return mr; 2086 2087}(mr, jQuery, window, document)); 2088 2089//////////////// Twitter Feeds 2090mr = (function (mr, $, window, document){ 2091 "use strict"; 2092 2093 var documentReady = function($){ 2094 $('.tweets-feed').each(function(index) { 2095 $(this).attr('id', 'tweets-' + index); 2096 }).each(function(index) { 2097 var element = $('#tweets-' + index); 2098 var TweetConfig = { 2099 "domId": '', 2100 "maxTweets": element.attr('data-amount'), 2101 "enableLinks": true, 2102 "showUser": true, 2103 "showTime": true, 2104 "dateFunction": '', 2105 "showRetweet": false, 2106 "customCallback": handleTweets 2107 }; 2108 2109 if(typeof element.attr('data-widget-id') !== typeof undefined){ 2110 TweetConfig.id = element.attr('data-widget-id'); 2111 }else if(typeof element.attr('data-feed-name') !== typeof undefined && element.attr('data-feed-name') !== ""){ 2112 TweetConfig.profile = {"screenName": element.attr('data-feed-name').replace('@', '')}; 2113 }else{ 2114 TweetConfig.profile = {"screenName": 'twitter'}; 2115 } 2116 2117 if(element.closest('.twitter-feed--slider').length){ 2118 element.addClass('slider'); 2119 } 2120 2121 function handleTweets(tweets) { 2122 var x = tweets.length; 2123 var n = 0; 2124 var html = '<ul class="slides">'; 2125 while (n < x) { 2126 html += '<li>' + tweets[n] + '</li>'; 2127 n++; 2128 } 2129 html += '</ul>'; 2130 element.html(html); 2131 2132 // Initialize twitter feed slider 2133 if(element.closest('.slider').length){ 2134 mr.sliders.documentReady(mr.setContext()); 2135 2136 return html; 2137 } 2138 } 2139 twitterFetcher.fetch(TweetConfig); 2140 }); 2141 }; 2142 2143 mr.twitter = { 2144 documentReady : documentReady 2145 }; 2146 2147 mr.components.documentReady.push(documentReady); 2148 2149 return mr; 2150 2151}(mr, jQuery, window, document)); 2152 2153//////////////// Video 2154mr = (function (mr, $, window, document){ 2155 "use strict"; 2156 2157 var documentReady = function($){ 2158
2159 //////////////// Youtube Background 2160 2161 if($('.youtube-background').length){ 2162 $('.youtube-background').each(function(){ 2163 var player = $(this); 2164 var vidURL = $(this).attr('data-video-url'); 2165 var startAt = $(this).attr('data-start-at'); 2166 player.attr('data-property','{videoURL:"'+vidURL+'",containment:"self",autoPlay:true, mute:true, startAt:'+startAt+', opacity:1, playerVars: {rel: 0}}'); 2167 player.closest('.videobg').append('<div class="loading-indicator"></div>'); 2168 player.YTPlayer(); 2169 player.on("YTPStart",function(){ 2170 player.closest('.videobg').addClass('video-active'); 2171 }); 2172 }); 2173 } 2174 2175 if($('.videobg').find('video').length){ 2176 $('.videobg').find('video').closest('.videobg').addClass('video-active'); 2177 } 2178 2179 //////////////// Video Cover Play Icons 2180 2181 $('.video-cover').each(function(){ 2182 var videoCover = $(this); 2183 if(videoCover.find('iframe[src]').length){ 2184 videoCover.find('iframe').attr('data-src', videoCover.find('iframe').attr('src')); 2185 videoCover.find('iframe').attr('src',''); 2186 } 2187 }); 2188 2189 $('.video-cover .video-play-icon').on("click", function(){ 2190 var playIcon = $(this); 2191 var videoCover = playIcon.closest('.video-cover'); 2192 if(videoCover.find('video').length){ 2193 var video = videoCover.find('video').get(0); 2194 videoCover.addClass('reveal-video'); 2195 video.play(); 2196 return false; 2197 }else if(videoCover.find('iframe').length){ 2198 var iframe = videoCover.find('iframe'); 2199 iframe.attr('src',iframe.attr('data-src')); 2200 videoCover.addClass('reveal-video'); 2201 return false; 2202 } 2203 }); 2204 }; 2205 2206 mr.video = { 2207 documentReady : documentReady 2208 }; 2209 2210 mr.components.documentReady.push(documentReady); 2211 return mr; 2212 2213}(mr, jQuery, window, document)); 2214 2215//////////////// Wizard 2216mr = (function (mr, $, window, document){ 2217 "use strict"; 2218 2219 var documentReady = function($){ 2220 2221 $('.wizard').each(function(){ 2222 var wizard = jQuery(this); 2223 2224 if(!wizard.is('[role="application"][id^="steps-uid"]')){ 2225 wizard.steps({ 2226 headerTag: "h5", 2227 bodyTag: "section", 2228 transitionEffect: "slideLeft", 2229 autoFocus: true 2230 }); 2231 2232 wizard.addClass('active'); 2233 } 2234 2235 }); 2236 }; 2237 2238 mr.wizard = { 2239 documentReady : documentReady 2240 }; 2241 2242 mr.components.documentReady.push(documentReady); 2243 return mr; 2244 2245}(mr, jQuery, 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.