PageSourceSearch

https://www.longwoodlibrary.org/themes/custom/lm_base_theme/js/scripts.js?v=1.x

js longwoodlibrary.org collected 2026-09-28 09:19:45 UTC 3,732 bytes, 135 lines download raw bytes

1/**
2 * @file
3 * Scripts file
4 *
5 * =============================
6 * === DO NOT EDIT THIS FILE ===
7 * =============================
8 *
9 * General scripting file. This file is compiled
10 * via the `scripts` task in gulp, and is built using
11 * all of the JS files inside of the sass directory.
12 *
13 * To add new code to this file, add a new
14 * component-name.behaviors.js file in the directory for
15 * that particular component in the sass directory.
16 *
17 * For an example, see `sass/components/main-menu/`
18 */
19(function ($, Drupal) {
20
21  //'use strict';
22
23  $('body').removeClass('no-js');
24
25  /**
26   * =============================
27   * ==== BEGIN COMPONENTS JS ====
28   * =============================
29   */
30
31
32
33  /**
34   * Initialise the behavior
35   */
36  Drupal.behaviors.browserClasses = {
37    attach: function (context, settings) {
38      if (navigator.userAgent.match(/msie/i) || navigator.userAgent.match(/trident/i) ){
39        $ie_class = 'ie ie' + document.documentMode;
40        $('html').addClass($ie_class);
41      }
42    }
43  };
44
45  /**
46   * Initialise the behavior
47   */
48  Drupal.behaviors.faqSectionCollapse = {
49    attach: function (context, settings) {
50      if ( context === document) {
51        var $faq_header = $('.faq-section__dropdown');
52        var $faqContentWrapper = $('.faq-section__content-wrapper');
53        var $faqContent = $('.test');
54        var $faqButton;
55        var $faqContents;
56
57        // Add collapsed class.
58        $faq_header.addClass('collapsed');
59        $faqContentWrapper.addClass('collapsed');
60
61        // Toggle classes.
62        $faq_header.on('click', function(event) {
63          $faqButton = $(this);
64          $faqContents = $faqButton.siblings($faqContentWrapper);
65          $faqButton.toggleClass('collapsed');
66          $faqContents.toggleClass('collapsed');
67
68          // toggle menu
69          if ($faqContents.hasClass('collapsed')) {
70            $faqContents.css('max-height', 0);
71          } else {
72            $faqContents.css('max-height', $faqContent.height() + 40);
73          }
74        });
75      }
76    }
77  };
78
79  /**
80   * Initialise the behavior
81   */
82  Drupal.behaviors.search = {
83    attach: function (context, settings) {
84      if ( context === document) {
85        var $search = $('.layout__section--search');
86        var $searchToggle = $('.search__toggle');
87
88        // Toggle classes.
89        $searchToggle.on('click', function(event) {
90          event.preventDefault();
91          $search.toggleClass('active');
92          $searchToggle.toggleClass('active');
93        });
94      }
95    }
96  };
97
98Drupal.behaviors.viewFilters = {
99  attach: function (context, settings) {
100    // Initialize variables
101    var $view = $('.l-collapsing-filter', context);
102    var $viewFilters = $view.find('.view-filters', context);
103    var $viewContents = $view.find('.views-exposed-form', context);
104    var $filterButton = $('.js-menu-toggle__filter', context);
105    var buttonHTML = '<div class="menu-toggle__wrapper"><a href="#" class="menu-toggle__filter js-menu-toggle__filter collapsed">Choose Category</a></div>';
106
107    // Add the button
108    if (context === document) {
109      $viewFilters.before(buttonHTML);
110    }
111
112    // Toggle the menu on click, set height statically
113    $view.on('click', '.js-menu-toggle__filter', function(event) {
114      // toggle menu
115      $filterButton.toggleClass('collapsed');
116      $view.toggleClass('collapsed');
117
118      if ($view.hasClass('collapsed') == false) {
119        $viewFilters.css('max-height', $viewContents.height() + 800)
120      } else {
121        $viewFilters.css('max-height',0)
122      }
123
124      return false;
125    });
126  }
127};
128
129  /**
130   * =============================
131   * ===== END COMPONENTS JS =====
132   * =============================
133   */
134
135})(jQuery, Drupal);

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.