PageSourceSearch

https://www.calendar.com/wp-content/themes/stack/style/js/scripts.js?ver=1.2.4.1

js calendar.com collected 2026-09-24 09:02:38 UTC 78,966 bytes, 2,170 lines download raw bytes

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