PageSourceSearch

https://my.theford.com/bundles/madelaphil/js/build/app.js

js theford.com collected 2026-09-25 19:11:54 UTC 34,175 bytes, 1,154 lines download raw bytes

1/*!
2 * LA Phil Blocksoffice - Made Media Ltd. - Build 1.0.0 
3 */
4(function(){
5
6    var Util = (function(){
7
8        /**
9         * Determines if a given module can run
10         *
11         * If the module has and `init` method and a `run` expression which returns true
12         * then the init() method will be called.
13         *
14         * @param  {String} module Name of module within the App namespace
15         * @return {Boolean}
16         */
17        var canRun = function( module ) {
18            return ( App[ module ].init !== undefined && App[ module ].run() === true );
19        };
20
21        /**
22         * Determines if it's safe to use console.log for debug logging
23         *
24         * @return {Boolean}
25         */
26        var canLog = function() {
27            return (App.config.dev === true && typeof(console) !== 'undefined');
28        };
29
30        /**
31         * Will log any arguments (arrays, objects, strings etc.) to the console if it exists.
32         * Only logs to console if App.config.dev is set to true
33         */
34        var log = function() {
35            if ( canLog() === true ) {
36                console.log( Array.prototype.join.call(arguments, ' ') );
37            }
38        };
39
40        /**
41         * Gets appropriate redirect method based on url,
42         * hash, pathname or href.
43         *
44         * @return {String} redirect method
45         */
46        var getRedirectPart = function( url ) {
47            if ( url.charAt(0) === "#" ) {
48                return "hash";
49            } else if ( url.charAt(0) === "/" ) {
50                return "pathname";
51            } else {
52                return "href";
53            }
54        };
55
56        /**
57         * Redirect to a URL using the appropriate method
58         * based on the URL string provided.
59         * #hash, /relative-pathname, http://url.com
60         *
61         * @param  {String} url URL to redirect to
62         * @return {Redirect}
63         */
64        var redirectTo = function( url ) {
65            window.location[ getRedirectPart( url ) ] = url;
66        };
67
68        return {
69            log: log,
70            canRun: canRun,
71            canLog: canLog,
72            getRedirectPart: getRedirectPart,
73            redirectTo: redirectTo
74        };
75
76    }());
77
78    /**
79     * Expose our global object
80     */
81    window.Util = Util;
82
83}());
84;var App = App || {};
85(function( $, window, undefined ){
86
87    App.append = (function() {
88
89        var settings = {
90            selectors: {
91                elem: '.js--append'
92            }
93        };
94        var cache = {};
95        cache.$elem = $( settings.selectors.elem );
96
97        var run = function() {
98            return ( $.fn.appendAround !== 'undefined' ) ? true : false;
99        };
100
101        var init = function () {
102            cache.$elem.appendAround();
103        };
104
105        return {
106            run: run,
107            init: init,
108            settings: settings,
109            cache: cache
110        };
111
112    }());
113
114}( jQuery, window ));
115;var App = App || {};
116(function( $, window, undefined ){
117
118    App.cart = (function() {
119
120        var settings = {
121            selectors: {
122                field: '#basket_donation_option',
123                form: 'body.section-basket #page-content form'
124            },
125            cookie_name: 'donation_amount'
126        };
127        var cache = {};
128        cache.$fieldElem = $( settings.selectors.field );
129        cache.$formElem = $( settings.selectors.form );
130
131        function updateDonationAmountCookie() {
132          $.cookie('donation_amount', cache.$fieldElem.val());
133        }
134
135        function clearDonationAmountCookie() {
136          $.removeCookie(settings.cookie_name);
137        }
138
139        function updateDonationAmountFromCookieIfSet() {
140          if ($.cookie(settings.cookie_name)) {
141            cache.$fieldElem.val($.cookie(settings.cookie_name));
142          }
143        }
144
145        var run = function() {
146          return cache.$fieldElem.length > 0;
147        };
148
149        var init = function () {
150          updateDonationAmountFromCookieIfSet();
151          cache.$fieldElem.on('change', updateDonationAmountCookie);
152          cache.$formElem.on('submit', clearDonationAmountCookie);
153        };
154
155        return {
156            run: run,
157            init: init
158        };
159
160    }());
161
162}( jQuery, window ));
163;var App = App || {};
164(function( $, window, undefined ){
165
166    App.faq = (function() {
167
168        var run = function() {
169            return $(".faq-container").length ? true : false;
170        };
171
172        var init = function () {
173
174            var $faqQuestion = $(".faq-row .faq-question");
175
176            $faqQuestion.click(function(){
177
178                var $faqContainer = $(this).parents(".faq-container");
179                var $faqModal = $faqContainer.find(".modal");
180                var questionIndex = $faqQuestion.index(this);
181
182                if (!$faqModal.length) {
183                    $('<div>', {
184                        'class': 'modal content-width-modal'
185                    }).appendTo($faqContainer);
186
187                    $faqModal = $faqContainer.find(".modal");
188                    $('<div>', {
189                        'class': 'modal-content'
190                    }).appendTo($faqModal);
191
192                    $faqModalContainer = $faqContainer.find(".modal .modal-content");
193
194                    $faqContainer.parent().find('h3').clone().wrap("<div class='popup-header'></div>").parent().appendTo($faqModalContainer);
195
196                    $faqContainer.find('.faq-row').each(function(){
197                        var faqRow = '<div class="faq-modal-row">' + $(this).html() + '</div>';
198                        $(faqRow).appendTo($faqModalContainer);
199                    });
200
201                    $faqContainer.find('.btn').clone().appendTo($faqModalContainer);
202                }
203
204                $faqModal.modal("open");
205                $faqModal.find(".faq-modal-row").removeClass("open");
206                $faqModal.find(".faq-modal-row:eq(" + questionIndex + ")").addClass("open");
207
208            });
209
210            $("body").on({
211                click: function() {
212
213                    var $faqContainer = $(this).parents(".modal");
214                    var $faqRow = $(this).parents(".faq-modal-row");
215
216                    if ($faqRow.hasClass("open")) {
217                        return false;
218                    }
219
220                    $faqContainer.find(".faq-modal-row.open").removeClass("open");
221                    $faqRow.addClass("open");
222
223                }
224            }, ".modal .faq-question");
225
226        };
227
228        return {
229            run: run,
230            init: init
231        };
232
233    }());
234
235}( jQuery, window ));
236;var App = App || {};
237(function( $, window, undefined ){
238  window.force_single_submit_on_forms_selector = window.force_single_submit_on_forms_selector || '#none';
239  window.force_single_submit_on_buttons_selector = window.force_single_submit_on_buttons_selector || '#none';
240
241
242    App.forms = (function() {
243
244        var run = function() {
245            return true;
246        };
247
248        var init = function () {
249            loginRegister();
250            disableClipboard();
251            contextualField();
252            fieldHelp();
253            singleSubmit();
254
255            // IE10 hack to fix IE10 bug
256            // https://connect.microsoft.com/IE/feedback/details/776537/text-in-right-aligned-input-gets-cuts-off-when-using-ms-clear
257            var ie_version = getIEVersion();
258            if(parseInt(ie_version.major, 10) === 10){
259                updatePasswordFields();
260            }
261
262        };
263
264        function getIEVersion(){
265            var agent = navigator.userAgent;
266            var reg = /MSIE\s?(\d+)(?:\.(\d+))?/i;
267            var matches = agent.match(reg);
268            if (matches !== null) {
269                return { major: matches[1], minor: matches[2] };
270            }
271            return { major: '-1', minor: '-1' };
272        }
273
274        function updatePasswordFields(){
275
276            $('input[type="password"]').each(function (i, element){
277                $(element).on('keyup blur', function(e){
278                    $(this).val($(this).val());
279                });
280            });
281
282        }
283
284
285        /**
286         * Login / Register toggle
287         */
288        function loginRegister() {
289            var form = $('.js-login-register-form'),
290                options = $('.js-login-register-options'),
291                action = $('.js-login-register-action');
292
293            options.find('input').on('change', function( event ) {
294                form.attr('action', this.getAttribute('data-form-action') );
295                action.val( this.getAttribute('data-label') );
296                if ( this.value === 'register' ) {
297                    form.addClass('is-registration');
298                } else {
299                    form.removeClass('is-registration');
300                }
301            });
302        }
303
304
305        /**
306         * Disable past on certain fields
307         */
308        function disableClipboard() {
309            $('.js-disable-paste, input[name="gatewayCardSecurityCode"]').on('cut copy paste', function(event) {
310                event.preventDefault();
311            });
312        }
313
314
315        /**
316         * Toggle contextual field items
317         */
318        var contextualField = function() {
319            $('.js-contextual-field').on('change', function( e ) {
320                var toggleEl = $(this).data('toggle');
321                $(toggleEl).toggleClass('is-active');
322            });
323        };
324
325
326        /**
327         * Show contextual messaging about the selected option
328         */
329        var fieldHelp = function() {
330            var formEl = $('.js-field-help'),
331                textEl = $('.js-field-help-text');
332            formEl.on('change.fieldHelp', function(event) {
333                event.preventDefault();
334                textEl.text( $(this).find(':selected').data('description') );
335            }).trigger('change.fieldHelp');
336        };
337
338      /**
339       * Allow to submit forms or click buttons just once
340       */
341      var singleSubmit = function() {
342          $(document).on('submit', window.force_single_submit_on_forms_selector, function(e) {
343            var $target = $(this);
344            if ($target.hasClass('is-submitted')) {
345              // If form is already submitted, do not allow to submit is again
346              e.preventDefault();
347              e.stopPropagation();
348            } else {
349              var $submitter = e.originalEvent && e.originalEvent.submitter
350                ? $(e.originalEvent.submitter)
351                : $target.find('button[type=submit], input[type=submit]').first();
352              $submitter.addClass('btn--disabled btn--loading').attr('disabled', 'disabled');
353
354              // Mark form as submitted
355              $target.addClass('is-submitted');
356            }
357          });
358
359          $(document).on('click', window.force_single_submit_on_buttons_selector, function(e) {
360            var $clickedButton = $(this);
361            var $target = $(this);
362
363            if ($target.parents('form').length) {
364              $target = $target.parents('form');
365            }
366
367            if ($target.hasClass('is-submitted')) {
368              // If form is already submitted, do not allow to submit is again
369              e.preventDefault();
370              e.stopPropagation();
371            } else {
372              setTimeout(function () {
373                $clickedButton.addClass('btn--disabled btn--loading').attr('disabled', 'disabled');
374
375                // Mark form as submitted
376                $target.addClass('is-submitted');
377              }, 10)
378            }
379          });
380        };
381
382        return {
383            run: run,
384            init: init
385        };
386
387    }());
388
389}( jQuery, window ));
390;var App = App || {};
391(function( $, window, undefined ){
392
393    App.headroom = (function() {
394
395      var settings = {
396        selectors: {
397            elem: 'header.site-header',
398            offset: 150
399        }
400      };
401
402      var body = $('body');
403      if(body.hasClass('section-login')) settings.selectors.offset = 25;
404
405      var cache = {};
406      cache.$elem = $( settings.selectors.elem );
407
408      var run = function() {
409        return ( cache.$elem.length ) ? true : false;
410      };
411
412      var init = function () {
413        var myElement = document.querySelector('header.site-header');
414        var options = {
415          offset: settings.selectors.offset,
416          tolerance: 0,
417          classes: {
418              initial: "headroom",
419              pinned: "headroom--pinned",
420              unpinned: "headroom--unpinned",
421          },
422          onPin : function() {
423            $("#secondary-content").addClass("header-pin");
424          },
425          onUnpin : function() {
426            $("#secondary-content").removeClass("header-pin");
427          }
428        };
429
430        var headroom = new Headroom(myElement, options);
431        headroom.init();
432      }
433
434      return {
435        run: run,
436        init: init,
437        settings: settings,
438        cache: cache
439      };
440
441    }());
442
443}( jQuery, window ));
444;var App = App || {};
445(function( $, window, undefined ){
446
447    App.memberships = (function() {
448
449        var settings = {
450            selectors: {
451                elem: '.membership-packages'
452            }
453        };
454        var cache = {};
455        cache.$elem = $( settings.selectors.elem );
456
457        var run = function() {
458           return ( cache.$elem.length ) ? true : false;
459        };
460
461        var init = function () {
462
463            var levelRewardsContainer = $('.membership-benefits__level-benefits');
464            var levelRewards = $('.membership-level-rewards')
465            levelRewards.detach().appendTo(levelRewardsContainer);
466
467
468            $(document).on('click', '.membership-level__input', function(){
469
470                // ADD active class to membership benefits
471                $(".membership-benefits").addClass("membership-selected");
472
473                // UPDATING MEMBERSHIP LEVEL TITLE
474                // find parent tr
475                var membershipParent = $(this).parents(".membership-level");
476
477                // find active membership name and price
478                var membershipName = membershipParent.find(".membership-level__label").html();
479                var membershipPrice = membershipParent.find(".membership-level__price").html();
480
481                // combine for active membership name and price
482                var currentMembershipLevel = "Available Benefits: <span class='membership-benefits__level'>" + membershipName + membershipPrice + "</span>";
483
484                // Replace header contents with active membership level
485                $(".membership-benefits__header").html(currentMembershipLevel);
486
487
488                // HIGHLIGHTING BENEFITS
489                // Find current level
490                var level = $(this).data('level');
491                var category = $(this).data('category');
492                var rewards = $('.membership-level-rewards');
493
494                rewards.addClass('inactive').removeClass('active');
495
496                rewards.each(function () {
497                    var categories = $(this).data('categories');
498                    if (categories[category] <= level) {
499                        $(this).removeClass('inactive').addClass('active');
500                    }
501                });
502
503
504            });
505
506        };
507
508        return {
509            run: run,
510            init: init
511        };
512
513    }());
514
515}( jQuery, window ));
516;var App = App || {};
517(function( $, window, undefined ){
518
519    App.modals = (function() {
520
521        var settings = {
522            selectors: {
523                elem: '.magnific'
524            }
525        };
526        var cache = {};
527        cache.$elem = $( settings.selectors.elem );
528
529        var run = function() {
530            return ( $.fn.appendAround !== 'undefined' ) ? true : false;
531        };
532
533        var init = function () {
534
535            if (!Modernizr.touch) {   
536                $('.magnific').magnificPopup({type:'iframe'});
537            }
538           
539        };
540
541        return {
542            run: run,
543            init: init,
544            settings: settings,
545            cache: cache
546        };
547
548    }());
549
550}( jQuery, window ));
551;var App = App || {};
552(function( $, window, undefined ){
553
554  App.nameCorrect = (function() {
555
556    var settings = {
557      selectors: {
558        field: '#register_first_name, #register_last_name, #delivery_first_name, #delivery_last_name',
559        form: '#register-form, #billing_address_new'
560      },
561      correctionMessage: "We have corrected the case in one of the name fields from all caps, if this is incorrect then please change it back"
562    };
563    
564    if (window.caseCorrectionMessage) {
565      settings.correctionMessage = window.caseCorrectionMessage;
566    }
567
568    var cache = {};
569    cache.$fieldElem = $( settings.selectors.field );
570    cache.$formElem = $( settings.selectors.form );
571
572    var hasCorrectedFirstName = false;
573    var hasCorrectedLastName = false;
574
575    var $alertBox = $("<div class='field-error warning'>" + settings.correctionMessage + "</div>");
576
577    function addAlert() {
578      cache.$formElem.prepend($alertBox);
579    }
580
581    function correctCaseOfField($field) {
582      var val = $field.val();
583
584      val = val.split(" ").map(function(w){ return w.substring(0,1).toUpperCase() + w.substring(1).toLowerCase(); }).join(" ");
585      $field.val(val);
586      addAlert();
587    }
588
589    function isAllCaps(str) {
590      return str == str.toUpperCase();
591    }
592
593    function isAllLowerCase(str) {
594      return str == str.toLowerCase();
595    }
596
597    function checkForAllCaps(e) {
598      var $field = $(e.target);
599      var isFirstName = $field.attr("id").indexOf("first") > -1;
600
601      var allLettersHaveSameCase = $field.val().length > 2 && (isAllCaps($field.val()) || isAllLowerCase($field.val()));
602
603      if (allLettersHaveSameCase) {
604        if (isFirstName && !hasCorrectedFirstName) {
605          correctCaseOfField($field);
606          hasCorrectedFirstName = true;
607        }
608        if (!isFirstName && !hasCorrectedLastName) {
609          correctCaseOfField($field);
610          hasCorrectedLastName = true;
611        }
612      }
613
614    }
615
616    var run = function() {
617      return cache.$formElem.length > 0;
618    };
619
620    var init = function () {
621      cache.$fieldElem.on('blur', checkForAllCaps);
622    };
623
624    return {
625      run: run,
626      init: init
627    };
628
629  }());
630
631}( jQuery, window ));
632;var App = App || {};
633(function( $, window, undefined ){
634
635    App.packages = (function() {
636
637        var settings = {
638            selectors: {
639                zoneSelector: '#main_seating_zone_id'
640            }
641        };
642        var cache = {};
643        cache.$zoneSelectorElem = $( settings.selectors.zoneSelector );
644
645        var run = function() {
646            return ( cache.$zoneSelectorElem.length > 0 );
647        };
648
649        var init = function () {
650            if (cache.$zoneSelectorElem.children('option[value!=""]').length <= 1) {
651              var firstOption = $(cache.$zoneSelectorElem.children('option[value!=""]').get(0));
652              cache.$zoneSelectorElem.val(firstOption.attr('value'));
653              cache.$zoneSelectorElem.closest('tr').hide();
654            }
655
656        };
657
658        return {
659            run: run,
660            init: init
661        };
662
663    }());
664
665}( jQuery, window ));
666;var App = App || {};
667(function ($, window, undefined) {
668  App.pagination = (function () {
669
670    var settings = {
671      selectors: {
672        parent: '.js-pagination',
673        prev: '.pagination-prev',
674        next: '.pagination-next',
675        state: '.pagination-state',
676        elem: '.js-select-all__item',
677        selectAll: '.select-all-tickets'
678      },
679      classes: {
680        active: 'active-row',
681        hidden: 'btn-hidden',
682        notReturnable: 'not-returnable'
683      }
684    };
685
686    var cache = {};
687
688    cache.parent = $(settings.selectors.parent);
689    cache.prev = $(settings.selectors.prev);
690    cache.next = $(settings.selectors.next);
691    cache.elem = $(settings.selectors.elem);
692    cache.state = $(settings.selectors.state);
693    cache.selectAll = $(settings.selectors.selectAll);
694
695    var currentPage = 1;
696    var elemsPerPage = 6;
697    var pages;
698
699    var setSelectAllStatus = function() {
700      var availableToSelect = cache.modal.find('.' + settings.classes.active).find(settings.selectors.elem + '.returnable').not(':disabled');
701      var selectedOnPage = cache.modal.find('.' + settings.classes.active).find(settings.selectors.elem + '.returnable:checked');
702
703      if (availableToSelect.length === selectedOnPage.length && availableToSelect.length !== 0) {
704        cache.selectAll.prop('checked', true);
705      } else {
706        cache.selectAll.prop('checked', false);
707      }
708    }
709
710    var setCurrentPage = function (page, initial) {
711      if (pages > 1) {
712        if (page === 1) {
713          cache.prev.addClass(settings.classes.hidden);
714        } else {
715          cache.prev.removeClass(settings.classes.hidden);
716        }
717
718        if (pages === page) {
719          cache.next.addClass(settings.classes.hidden);
720        } else {
721          cache.next.removeClass(settings.classes.hidden);
722        }
723      }
724
725      var activeTickets = cache.modal.find('.' + settings.classes.active).length,
726        nonReturnableTickets = cache.modal.find('.' + settings.classes.active + '.' + settings.classes.notReturnable).length;
727
728      if (activeTickets === nonReturnableTickets) {
729        cache.selectAll.prop('disabled', true);
730      } else {
731        cache.selectAll.prop('disabled', false);
732      }
733
734      if (!initial) {
735        setSelectAllStatus();
736      }
737
738      cache.state.text('Page ' + page + ' / ' + pages);
739    }
740
741    var nextPage = function () {
742      if (currentPage >= pages) return false;
743      ++currentPage;
744
745      var lastActiveRow = cache.modal.find('.' + settings.classes.active + ':last');
746
747      if (lastActiveRow) {
748        cache.elem.closest('tr').hide().removeClass(settings.classes.active);
749        lastActiveRow.closest('tr').nextAll("*:not(.ticket-error-row):lt(6)").show().addClass(settings.classes.active);
750      }
751
752      setCurrentPage(currentPage);
753    }
754
755    var prevPage = function () {
756      if (currentPage <= 1) return false;
757      --currentPage;
758
759      var firstActiveRow = cache.modal.find('.' + settings.classes.active + ':first');
760
761      if (firstActiveRow) {
762        cache.elem.closest('tr').hide().removeClass(settings.classes.active);
763        firstActiveRow.closest('tr').prevAll("*:not(.ticket-error-row):lt(6)").show().addClass(settings.classes.active);
764      }
765
766      setCurrentPage(currentPage);
767    }
768
769    var modalListenerOpen = function () {
770      $('html').addClass('block-scroll');
771
772      var modal = $(this);
773      var elems = modal.find(settings.selectors.elem);
774
775      currentPage = 1;
776
777      cache.modal = modal;
778      cache.elem = elems;
779      cache.selectAll = modal.find(settings.selectors.selectAll);
780
781      pages = Math.ceil(elems.length/elemsPerPage)
782
783      modal.find(settings.selectors.elem).closest('tr').hide().removeClass(settings.classes.active);
784      modal.find(settings.selectors.elem).closest('tr:not(.ticket-error-row):lt(' + (elemsPerPage + 1) + ')').show().addClass(settings.classes.active);
785
786      if (pages <= 1) {
787        modal.find('.pagination').hide();
788      }
789
790      setCurrentPage(1, true)
791    }
792
793    var modalListenerClose = function () {
794      $('html').removeClass('block-scroll');
795    }
796
797    var selectAllListener = function() {
798      var returnableSeatsSelected = cache.modal.find('.' + settings.classes.active).find(settings.selectors.elem + '.returnable:checked');
799      var returnableSeatsToSelect = cache.modal.find('.' + settings.classes.active).find(settings.selectors.elem + '.returnable');
800      var selectedTicketsAmount = cache.modal.find(settings.selectors.elem + '.returnable:checked');
801
802      if (!this.checked && selectedTicketsAmount.length === 10) {
803        cache.modal.find('.tickets-selected-error').text('');
804      }
805
806      if (this.checked && returnableSeatsToSelect.length) {
807        returnableSeatsToSelect.each(function () {
808          if (!this.checked) {
809            $(this).click();
810          }
811        })
812      } else {
813        returnableSeatsSelected.each(function () {
814          this.click();
815        })
816      }
817    }
818
819    var bindEvents = function () {
820      cache.next.click(nextPage)
821      cache.prev.click(prevPage)
822      cache.parent.on($.modal.OPEN, modalListenerOpen)
823      cache.parent.on($.modal.CLOSE, modalListenerClose)
824      cache.elem.on('change', setSelectAllStatus)
825      cache.selectAll.on('change', selectAllListener)
826    }
827
828    var run = function () {
829      return !!(cache.elem.length);
830    };
831
832    var init = function () {
833      bindEvents()
834    };
835
836    return {
837      run: run,
838      init: init,
839      settings: settings,
840      cache: cache
841    };
842  }());
843}(jQuery, window));
844;var App = App || {};
845(function( $, window, undefined ){
846
847    App.sidebarNav = (function() {
848
849        var settings = {
850            selectors: {
851                elem: '.unit-secondary-navigation',
852                button: '.side-mobile'
853            }
854        };
855        var cache = {};
856        cache.$elem = $( settings.selectors.elem );
857
858        var run = function() {
859            return ( cache.$elem.length ) ? true : false;
860        };
861
862        var init = function () {
863
864            $(document).on("click", settings.selectors.button, function(){
865                if ($(this).hasClass('open')){
866                    $(this).removeClass('open').closest("#secondary-content").removeClass('open');
867                } else {
868                    $(this).addClass('open').closest("#secondary-content").addClass('open');
869                }
870            });
871        };
872
873        return {
874            run: run,
875            init: init,
876            settings: settings,
877            cache: cache
878        };
879
880    }());
881
882}( jQuery, window ));
883;var App = App || {};
884(function($, window, undefined) {
885  App.stickySidebar = (function() {
886    var settings = {
887      selectors: {
888        elem: ".cart"
889      }
890    };
891
892    var cache = {};
893    cache.$elem = $(settings.selectors.elem);
894
895    var run = function() {
896      return cache.$elem.length ? true : false;
897    };
898
899    var init = function() {
900      $(".cart").stickySidebar({
901        containerSelector: '.cyo-widget ',
902        innerWrapperSelector: '.sidebar__inner',
903        topSpacing: 140,
904        bottomSpacing: 20
905      });
906    };
907
908    return {
909      run: run,
910      init: init
911    };
912  })();
913})(jQuery, window);
914;var App = App || {};
915(function( $, window, undefined ){
916
917    App.toggle = (function() {
918
919        var settings = {
920            selectors: {
921                behaviour: '.js-behaviour-toggle'
922            },
923            classNames: {
924                active: 'is-active',
925                toggled: 'is-toggled'
926            }
927        };
928        var cache = {};
929        cache.$elem = $( settings.selectors.behaviour );
930
931        var run = function() {
932            return ( cache.$elem.length ) ? true : false;
933        };
934
935        var init = function () {
936
937            $(document).on('click.toggle', settings.selectors.behaviour, function( event ) {
938
939                var $this = $(this);
940                var target = $this.data('target');
941                var parent = $this.data('parent');
942                var exclusive = $this.data('exclusive');
943                var labelOriginal = $this.data('labelOriginal');
944                var labelToggle = $this.data('labelToggle');
945                var unfocusToggle = $this.data('unfocusToggle');
946                var el;
947
948                $this.toggleClass( settings.classNames.toggled );
949                if ( exclusive ) {
950                    $( '.' + settings.classNames.toggled ).not( $this ).removeClass( settings.classNames.toggled );
951                }
952
953                // If they unfocus the parent element
954                $(target).on('focusout', function (e) {
955                  el.toggleClass( settings.classNames.active );
956                });
957
958                if ( parent ) {
959                    el = $this.closest( parent ).find( target );
960                    if ( exclusive ) { $( '.' + settings.classNames.active ).not(el).removeClass( settings.classNames.active ); }
961                    el.toggleClass( settings.classNames.active );
962                } else {
963                    el = $( target );
964                    if ( exclusive ) { $( '.' + settings.classNames.active ).not(el).removeClass( settings.classNames.active ); }
965                    el.toggleClass( settings.classNames.active );
966                }
967
968                if ( labelToggle && $this.hasClass( settings.classNames.toggled ) ) {
969                    $this.text( labelToggle );
970                } else {
971                    $this.text( labelOriginal );
972                }
973
974                event.preventDefault();
975
976            });
977
978        };
979
980        return {
981            run: run,
982            init: init,
983            settings: settings,
984            cache: cache
985        };
986
987    }());
988
989}( jQuery, window ));
990;/* globals google: true */
991var App = App || {};
992(function( $, window, undefined ){
993
994    App.translate = (function() {
995        var selectors = {
996                el: '.js-translate'
997            },
998            el = $( selectors.el );
999
1000        function run() {
1001            return ( el.length ) ? true : false;
1002        }
1003
1004        /**
1005         * [1] Don't even load the translate JS until the user clicks on the live chat button.
1006         * [2] If we've not loaded the script before, load it now. Otherwise translate straight away.
1007         * [2] Cache chosen langauge so we can reference it in loaded()  callback.
1008         */
1009        var initialised = false;
1010        var initialLanguage;
1011        var chosenLanguage = false;
1012        var ls = window.localStorage;
1013
1014        function init() {
1015            var initialLang = ls.getItem('lang');
1016
1017            // getting save lang from local storage
1018            // If we have one that isnt en then set the chosen lang
1019            // and call load script.
1020            if(initialLang !== undefined && initialLang !== 'en'){
1021                chosenLanguage = initialLang;
1022                $('.select-language .current').removeClass('current');
1023                $('button[data-lang='+initialLang+']').parent().addClass('current');
1024                loadScript();
1025            }
1026
1027            $(document).on('click.translate', '.js-translate', function( event ) {
1028                event.preventDefault();
1029                $('.select-language .current').removeClass('current');
1030                $(this).parent().addClass('current');
1031                chosenLanguage = $(this).data('lang');
1032                ls.setItem('lang', chosenLanguage);
1033                loadScript();
1034
1035                $('.nav-toggle--language').trigger('click');
1036            });
1037        }
1038
1039        function loadScript(){
1040            if ( ! initialised ) {
1041                /**
1042                 * This is slightly idionsyncratic due to how element.js works:
1043                 * [1] element.js has its own callback paramenter, and requires the cb fn to be in global scope.
1044                 * [2] The getScript call is the part which actually loads the JS but as element.js has its own
1045                 *     callback fn so the only thing we need to do in the getScript cb is set the initialised flag.
1046                 */
1047                var url = 'https://translate.google.com/translate_a/element.js?cb=App.translate.loaded';
1048                $.getScript( url, function() {
1049                    initialised = true;
1050                });
1051            } else {
1052                setLang( chosenLanguage );
1053            }
1054        }
1055
1056        /**
1057         * Callback for when translate API is loaded.
1058         */
1059        function loaded() {
1060            var translateEl = new google.translate.TranslateElement({
1061                pageLanguage: 'en',
1062                includedLanguages: 'es,en,zh-CN,ja,ko',
1063                autoDisplay: false
1064            }, 'google_translate_element');
1065            _hideTranslateBar();
1066            setTimeout(function() {
1067                setLang( chosenLanguage );
1068            }, 500);
1069        }
1070
1071        /**
1072         * Trigger language change events
1073         */
1074        function setLang( lang ) {
1075            var evt = document.createEvent( 'HTMLEvents' );
1076            evt.initEvent( 'change', false, true );
1077            $('.goog-te-combo').val( lang )[0].dispatchEvent( evt );
1078            _hideTranslateBar();
1079        }
1080
1081        /**
1082         * Hide google translate bar
1083         */
1084        function _hideTranslateBar(){
1085            $( '#google_translate_element, .skiptranslate, #translation' ).hide();
1086            $('body').removeAttr('style');
1087        }
1088
1089        return {
1090            run: run,
1091            init: init,
1092            loaded: loaded,
1093            setLang: setLang
1094        };
1095
1096    }());
1097
1098}( jQuery, window ));
1099;// Setup our global Application object
1100window.App = App || {};
1101(function( $, window ){
1102
1103  /**
1104   * Application configuration settings
1105   */
1106  App.config = {
1107    /**
1108     * Enabled if hostname includes .site (i.e. local development) otherwise false.
1109     *
1110     * If enabled, this will output useful debug information to the console.
1111     * @type {Boolean}
1112     */
1113    dev: ( window.location.hostname.indexOf('.site') !== -1 ) ? true : false,
1114
1115    /**
1116     * To load a module add its name to this array, e.g., App.example should be listed as just 'example'
1117     * The modules init() method will be called, in the order listed here, on document ready.
1118     * @type {Array}
1119     */
1120    runList: [
1121      'append',
1122      'toggle',
1123      'modals',
1124      'forms',
1125      'packages',
1126      'cart',
1127      'sidebarNav',
1128      'memberships',
1129      'translate',
1130      'nameCorrect',
1131      'faq',
1132      'headroom',
1133      'pagination'
1134      // 'stickySidebar',
1135    ]
1136  };
1137
1138  $(function() {
1139    /**
1140     * Loop through all the modules in the runList
1141     * check if the init() method exists and is a function and `run` is true.
1142     */
1143    var runList = App.config.runList;
1144    for ( var i = 0; i < runList.length; i++ ) {
1145      if ( Util.canRun( runList[i] ) ) {
1146        // Run the module.
1147        App[ runList[i] ].init();
1148        // Output some life-cycle logging if enabled.
1149        if ( Util.canLog() ) { Util.log("Initialising App." + runList[i]); }
1150      }
1151    }
1152  });
1153
1154}( jQuery, window, undefined ));

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.