PageSourceSearch

https://thechuckwagongang.net/js/fsgen.js

js thechuckwagongang.net collected 2026-09-26 08:33:38 UTC 4,393 bytes, 153 lines download raw bytes

1jQuery(document).ready(function(){
2
3  if (typeof SmoothScroll !== 'undefined') {
4    new SmoothScroll('a[href*="#section-"]',{
5      // Speed & Duration
6      speed: 1000,
7      speedAsDuration: false, // If true, use speed as the total duration of the scroll animation
8      // easing
9      easing: 'easeInOutCubic', // Easing pattern to use
10      // offset
11      offset: 0,
12      // History
13      updateURL: true, // Update the URL on scroll
14      popstate: true, // Animate scrolling with the forward/backward browser buttons (requires updateURL to be true)
15      // selectors
16      header: '.navbar' // Selector for fixed headers (must be a valid CSS selector)
17    });
18  }
19
20  if (typeof Swiper !== 'undefined') {
21    new Swiper('.swiper-container', {
22      navigation: {
23        nextEl: '.swiper-button-next',
24        prevEl: '.swiper-button-prev'
25      },
26      loop: true,
27      pagination: {
28        el: '.swiper-pagination',
29        clickable: true
30      }
31    });
32  }
33
34  if (typeof gsap !== 'undefined') {
35    gsap.registerPlugin(ScrollTrigger);
36    gsap.config({nullTargetWarn:false});
37
38    // bg-image lazy load.
39    gsap.utils.toArray('.lazy-load-bg-image').forEach(function(item) {
40      ScrollTrigger.create({
41        trigger: item,
42        start: 'top-=100 bottom',
43        end: 'top bottom',
44        markers: false,
45        once: true,
46        onEnter: function() {
47          item.classList.add('bg-image');
48        }
49      });
50    });
51
52    const nav = jQuery('#site-header');
53    const position = nav.css('position');
54    if (position === 'fixed'){
55      // Set padding ONLY on the iframe body, not the drupal body.
56      gsap.set('body:not(.site-preview)', {paddingTop:nav.prop('offsetHeight')});
57    }
58  }
59
60  if (typeof jQuery !== 'undefined') {
61    // Magnific Popup.
62    jQuery(".mfp-video-embed-first-item, .mfp-video-embed-all-items").each(function () {
63      var gallery_items = [];
64
65      jQuery(this).find(".mfp-video-embed-popup").each(function () {
66        gallery_items.push({
67          src:
68              '<div class="mfp-embedded-video-popup">'+
69              jQuery(this).data("mfp-video-embed") +
70              '</div>'
71        });
72      });
73
74      jQuery(this).magnificPopup({
75        items: gallery_items,
76        gallery: {
77          enabled: true
78        },
79        type: 'inline'
80      });
81    });
82
83    jQuery(".mfp-video-embed-separate-items").each(function () {
84      jQuery(this).find(".mfp-video-embed-popup").one('click', function (e) {
85        // Stop linking to video URL instead of showing popup.
86        // See video-embed-field.colorbox.js in video_embed_field for more.
87        e.preventDefault();
88
89        $.magnificPopup.open({
90          items: {
91            src:
92                '<div class="mfp-embedded-video-popup">'+
93                jQuery(this).data("mfp-video-embed") +
94                '</div>'
95          },
96          type: 'inline'
97        });
98      });
99    });
100    // Gallery.
101    let $items = jQuery.find('.mfp-all-items, .mfp-first-item, .mfp-random-item');
102    if ($items.length > 0) {
103      $items.each( function() {
104        jQuery(this).magnificPopup({
105          delegate: 'a',
106          type: 'image',
107          gallery: {
108            enabled: true
109          },
110          image: {
111            titleSrc: function (item) {
112              return item.img.attr('alt') || '';
113            }
114          }
115        });
116      });
117    }
118
119    // Separate items.
120    let $separateItems = jQuery.find('.mfp-separate-items');
121    if ($separateItems.length > 0) {
122      $separateItems.each(function () {
123        jQuery(this).magnificPopup({
124          delegate: 'a',
125          type: 'image',
126          image: {
127            titleSrc: function (item) {
128              return item.img.attr('alt') || '';
129            }
130          }
131        });
132      });
133    }
134  }
135
136  const sleep = sec => {
137    return new Promise(resolve => setTimeout(resolve, (sec * 1000)));
138  };
139
140  // Form submissions animation (legacy native-POST contact forms only).
141  // FileSwift AJAX forms show their success message inline and must not be
142  // reloaded out from under the user.
143  jQuery('#contact :submit').click(function(e) {
144    if (jQuery(this).closest('form').hasClass('fileswift-form')) {
145      return;
146    }
147    jQuery('#contact-form-overlay').show();
148    sleep(5).then(function() {
149      jQuery('#contact-form-overlay').hide();
150      location.reload();
151    })
152  })
153});

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.