PageSourceSearch

https://www.sai-national.org/templates/hannush/javascript/custom.js?v=1.1790915178

js sai-national.org collected 2026-10-02 04:26:38 UTC 8,792 bytes, 282 lines download raw bytes

1jQuery(document).ready(function()
2{
3  jQuery('table.dataTable tr:nth-child(even)').addClass('striped');
4
5  /* Begin custom jQuery */
6  jQuery('#clr_provinces').on('click', function(e)
7  {
8    e.preventDefault();
9    e.stopPropagation();
10    jQuery('input[name="cats[]"]').prop('checked', false);
11  });
12
13  /* jQuery('[name="order_type"]').on('change', function(e)
14  {
15    if(jQuery(this).val() == 'chapter')
16      jQuery('#order_type_name').show();
17    else
18      jQuery('#order_type_name').hide();
19  }) */
20  // End custom jQuery
21
22  // Start copying here
23  /*************************
24  ***** CREATE ACCOUNT *****
25  *************************/
26  // First Name and Last Name copy to billing information if empty
27  jQuery('input[name="first_name"]').change(function()
28  {
29    if( jQuery('input[name="bill_first_name"]').val() == '' )
30    {
31      jQuery('input[name="bill_first_name"]').val( jQuery(this).val() );
32    }
33  });
34  jQuery('input[name="last_name"]').change(function()
35  {
36    if( jQuery('input[name="bill_last_name"]').val() == '' )
37    {
38      jQuery('input[name="bill_last_name"]').val( jQuery(this).val() );
39    }
40  });
41  // "Same as Billing Information" checkbox copies information from billing to shipping
42  jQuery('#use_billing').change(function()
43  {
44    if( jQuery(this).is(':checked') )
45    {
46      jQuery('input[name="ship_first_name"]').val(jQuery('input[name="bill_first_name"]').val());
47      jQuery('input[name="ship_last_name"]').val(jQuery('input[name="bill_last_name"]').val());
48      jQuery('input[name="ship_address"]').val(jQuery('input[name="bill_address"]').val());
49      jQuery('input[name="ship_address_two"]').val(jQuery('input[name="bill_address_two"]').val());
50      jQuery('input[name="ship_city"]').val(jQuery('input[name="bill_city"]').val());
51      jQuery('select[name="ship_state"]').val(jQuery('select[name="bill_state"]').val());
52      jQuery('input[name="ship_zip"]').val(jQuery('input[name="bill_zip"]').val());
53      jQuery('select[name="ship_country"]').val(jQuery('select[name="bill_country"]').val());
54    }
55  });
56
57  // If PayPal Direct is selected show extra fields on payments page
58  jQuery('input[name="payment_id"]').change(function()
59  {
60    pay_type = jQuery(this).data('payment-type').toLowerCase();
61    if(/authorize.net/i.test(pay_type) || /paypal direct/i.test(pay_type))
62    {
63      jQuery('#paypal-direct').show();
64    }
65    else
66    {
67      jQuery('#paypal-direct').hide();
68    }
69  });
70
71  // Automatically select CC type based on CC number
72  jQuery('input[name="cc_num"]').keyup( function()
73  {
74    var start = parseInt(jQuery(this).val().charAt(0));
75    if(start >= 3 && start <= 6)
76    {
77      jQuery('select[name="cc_type"]').val(start);
78    }
79  });
80  /* End custom jQuery */
81});
82
83window.addEventListener('DOMContentLoaded', function() {
84  // Cycle through anchor links and attach click listeners
85  document.addEventListener('click', clickListener);
86  document.addEventListener('touch', clickListener);
87
88  function clickListener(event) {
89    const href = event.target.getAttribute('href');
90
91    if(href !== null) {
92      let hash_split    = href.split('#'),
93          target        = document.querySelector('[id="'+hash_split[1]+'"]'),
94          target_legacy = document.querySelector('[name="'+hash_split[1]+'"]'),
95          coords        = null,
96          target_valid  = false;
97
98      /**
99       * IDXBroker's toggles target the ID of their parent wrapper, so we want to
100       * exclude them.
101       */
102      if(event.target.classList.contains('IDX-panel-collapse-toggle')) {
103        target = null;
104      }
105
106      switch(true) {
107        case (target !== null && typeof target === 'object') :
108          target_valid = true;
109          break;
110
111        case (target_legacy !== null && typeof target_legacy === 'object') :
112          target = target_legacy;
113          target_valid = true;
114          break;
115
116        default :
117          break;
118      }
119
120      // Attempt to parse the link as a URL and determine if it is a local link
121      try {
122        url = new URL(hash_split[0]);
123
124        if (url.host === window.location.host) {
125          localLink = true;
126        } else {
127          localLink = false;
128        }
129      } catch(err) {
130        url = false;
131
132        if (hash_split[0].length === 0) {
133          localLink = true;
134        }
135      }
136
137      if((hash_split.length === 2 && localLink === true) && target_valid === true) {
138        try {
139          coords = target.getBoundingClientRect();
140
141          event.preventDefault();
142          target.scrollIntoView({behavior: 'smooth'});
143        } catch(e) {
144          // Scroll to top if we can't find a target to scroll to
145          coords = document.body.getBoundingClientRect();
146          // console.warn('No anchor available to scroll to or something hecked up.\r\n'+e);
147
148          event.preventDefault();
149          window.scrollTo({left: coords['x'], top: coords['y'], behavior: 'smooth'});
150        }
151
152        // Scroll the window to the anchor
153        // event.preventDefault();
154        // window.scrollTo({left: coords['x'], top: coords['y'], behavior: 'smooth'});
155      }
156    }
157  }
158
159  const pushybtn = document.getElementById('pushy-menu-btn')
160
161  if(pushybtn && typeof pushybtn !== 'undefined') {
162    pushybtn.addEventListener('click', function() {
163      let pushy    = document.querySelector('.pushy'),
164          computed = window.getComputedStyle(pushy).visibility
165
166      if(typeof pushy == 'object' && computed == 'hidden') {
167        pushy.style.visibility = 'visible'
168      }
169    })
170  }
171
172  if(typeof jQuery.fn.foundation !== 'undefined' && jQuery.isFunction(jQuery.fn.foundation)) {
173    jQuery(document).foundation();
174  }
175
176  if(typeof lightcase !== 'undefined' && jQuery.isFunction(jQuery.fn.lightcase)) {
177    // Lightbox
178    jQuery('a[data-rel^=lightcase]').lightcase();
179  }
180
181  if(typeof flatpickr !== 'undefined') {
182    dateboxes = document.querySelectorAll('.datepicker');
183
184    for(i = 0, dlen = dateboxes.length; i < dlen; i++) {
185      flatpickr(dateboxes[i], { allowInput: true, altFormat: 'M j, Y \@ h:iK', altInput: true, dateFormat: 'Y-m-d H:i:00', enableTime: true });
186    }
187  }
188
189  // Height matching script
190  if(typeof rightHeight !== 'undefined') {
191    rightHeight.init();
192  }
193
194  // Sliders and slideshows
195  if(typeof tns !== 'undefined') {
196    try {
197      let slider = tns ({
198        autoplay: false,
199        autoplayButtonOutput: false,
200        autoplayTimeout: 7000,
201        // autoHeight: true,
202        container: '.slideshow__player',
203        controls: true,
204        // controlsContainer: '.ss-controls',
205        gutter: 15,
206        items: 2,
207        lazyLoad: true,
208        loop: false,
209        nav: false,
210        // nextButton: '.tns-next',
211        // prevButton: '.tns-prev',
212        /* responsive: {
213          450: {
214            items: 3,
215          },
216          640: {
217            items: 4,
218          },
219          900: {
220            items: 6,
221          }
222        }, */
223        rewind: true,
224        slideBy: 1, // or 'page'
225        touch: false,
226      })
227    } catch(err) {
228      // console.error('Caught error: '+err.toString())
229    }
230  }
231
232  // bxSlider
233  // Mode choices: horizontal, fade
234  if(typeof jQuery.fn.bxSlider !== 'undefined' && jQuery.isFunction(jQuery.fn.bxSlider)) {
235    slider = jQuery('.bxslider').bxSlider({
236      adaptiveHeight: true,
237      auto:           true,
238      autoHover:      true,
239      controls:       false,
240      mode:           'fade',
241      pager:          false,
242      pause:          7000,
243      speed:          400,
244      touchEnabled:   false,
245      onSliderLoad:   function() {
246        let s = this[0],
247            redraw = false,
248            slides = s.querySelectorAll('.bannerslide');
249
250        // Unhide slides (and redraw) if necessary
251        // slides.forEach(function(v, k) {
252        for(let i = 0, lgt = slides.length; i < lgt; i++) {
253          let v = slides[i];
254
255          if(v.classList.contains('hide')) {
256            redraw = true;
257
258            v.classList.remove('hide');
259          }
260        }
261
262        if(redraw === true) {
263          // console.log('All slides unhidden, redrawing slider.');
264          this.redrawSlider();
265        }
266      }
267    });
268  }
269  // End sliders and slideshows
270})
271
272// Function to re-adjust the heights of copy and sidebar
273function adjustCopy() {
274  if(typeof rightHeight !== 'undefined') {
275    let container = document.querySelector('.copyarea > div.row');
276
277    setTimeout(function() {
278      rightHeight.adjustContainerHeight(container);
279      console.log(rightHeight);
280    }, 1000);
281  }
282}

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.