PageSourceSearch

https://www.ashleighbrittenmedia.com/static/_common/image_sets/ima…7c6b726be610ffb30f17881f41f82efebc30b461.js

js ashleighbrittenmedia.com collected 2026-10-06 18:40:45 UTC 11,081 bytes, 274 lines download raw bytes

1(function() {
2  (function() {
3    var $, allImagesReady, debounce, imageSet;
4    $ = this.jQuery;
5    allImagesReady = function(wrapper, cb) {
6      var imgs;
7      imgs = Array.from(wrapper.querySelectorAll("img"));
8      return Promise.all(imgs.map((function(_this) {
9        return function(imgElem) {
10          return new Promise(function(resolve, reject) {
11            if (imgElem.complete) {
12              return resolve();
13            }
14            imgElem.addEventListener("load", function() {
15              return resolve();
16            });
17            return imgElem.addEventListener("error", function() {
18              return resolve();
19            });
20          });
21        };
22      })(this))).then(function() {
23        return cb();
24      });
25    };
26    debounce = function(func, wait) {
27      var timeout;
28      timeout = void 0;
29      return function() {
30        var args, context;
31        context = this;
32        args = arguments;
33        clearTimeout(timeout);
34        return timeout = setTimeout((function() {
35          timeout = null;
36          func.apply(context, args);
37        }), wait);
38      };
39    };
40    imageSet = this.imageSet = {
41      initLightbox: function() {
42        var $captionWrapper, $items, $toggleButton, shouldShowCaptions;
43        $items = $('.format-image-set-items').not('.slideshow');
44        $toggleButton = $('<button class="image-set-lightbox-caption-toggle">');
45        $captionWrapper = $('<div class="image-set-lightbox-caption">');
46        shouldShowCaptions = true;
47        if (!$items.length) {
48          return;
49        }
50        $('.format-image-set-item').featherlightGallery({
51          galleryFadeIn: 300,
52          openSpeed: 300,
53          afterContent: function() {
54            var caption;
55            $(this.$content).fadeTo(0, 0);
56            caption = this.$currentTarget.find('img').data('caption');
57            this.$instance.find('.image-set-lightbox-caption, .image-set-lightbox-caption-toggle').remove();
58            if (caption) {
59              $toggleButton.appendTo(this.$instance.find('.featherlight-content'));
60              $captionWrapper.text(caption).appendTo(this.$instance.find('.featherlight-content'));
61              if (shouldShowCaptions) {
62                $toggleButton.addClass("active");
63                return $captionWrapper.addClass("active");
64              }
65            }
66          },
67          afterOpen: function() {
68            return $(this.$content).fadeTo(this.galleryFadeIn, 1);
69          }
70        });
71        return $('body').on('click', '.image-set-lightbox-caption-toggle', function(e) {
72          shouldShowCaptions = !shouldShowCaptions;
73          $(this).toggleClass('active');
74          return $(this).next('.image-set-lightbox-caption').toggle();
75        });
76      },
77      initSlideshow: function() {
78        var $slideshows;
79        $slideshows = $('.format-image-set-items.slideshow');
80        if (!$slideshows.length) {
81          return;
82        }
83        return $slideshows.each(function() {
84          var $captionContents, $captionWrapper, $showCaptionBtn, $slideshow, $wrapper, autoplayOn, autoplaySpeed, moduleMeta, slideshow;
85          $slideshow = $(this);
86          $wrapper = $slideshow.parents('.format-image-set-wrapper');
87          moduleMeta = $wrapper.data('module-meta');
88          autoplayOn = moduleMeta.autoplay_toggle === "true";
89          autoplaySpeed = parseInt(moduleMeta.autoplay_speed, 10) * 1000;
90          if (isNaN(autoplaySpeed)) {
91            autoplaySpeed = 2000;
92          }
93          $showCaptionBtn = $wrapper.find('.image-set-slideshow-show-caption');
94          $captionWrapper = $wrapper.find('.image-set-slideshow-item-caption');
95          $captionContents = $captionWrapper.children('.image-set-slideshow-item-caption-contents');
96          slideshow = $slideshow.addClass('owl-carousel').owlCarousel({
97            items: 1,
98            center: true,
99            loop: true,
100            nav: false,
101            autoHeight: true,
102            autoplay: autoplayOn,
103            autoplayTimeout: autoplaySpeed,
104            autoplayHoverPause: autoplayOn,
105            onInitialized: function() {
106              var caption;
107              caption = $slideshow.find('.owl-item').not('.cloned').eq(0).find('img').data('caption');
108              if (caption) {
109                $captionContents.text(caption);
110                return $showCaptionBtn.show();
111              } else {
112                $captionWrapper.hide();
113                return $showCaptionBtn.hide();
114              }
115            },
116            onChanged: function(e) {
117              var caption;
118              if (e.page.index < 0) {
119                return;
120              }
121              caption = $slideshow.find('.owl-item').not('.cloned').eq(e.page.index).find('img').data('caption');
122              $slideshow.parents('.format-image-set-wrapper').find('.image-set-slideshow-thumb').removeClass('active').eq(e.page.index).addClass('active');
123              if (caption) {
124                $captionWrapper.hide();
125                $captionContents.text(caption);
126                return $showCaptionBtn.show();
127              } else {
128                $captionWrapper.hide();
129                return $showCaptionBtn.hide();
130              }
131            }
132          });
133          $wrapper.find('.image-set-slideshow-nav').on('click', function(e) {
134            if ($(this).hasClass('next')) {
135              return $slideshow.trigger('next.owl.carousel');
136            } else {
137              return $slideshow.trigger('prev.owl.carousel');
138            }
139          });
140          $wrapper.find('.image-set-slideshow-autoplay-toggle').on('click', function(e) {
141            if ($(this).hasClass('paused')) {
142              $(this).removeClass('paused');
143              return $slideshow.trigger('play.owl.autoplay');
144            } else {
145              $(this).addClass('paused');
146              return $slideshow.trigger('stop.owl.autoplay');
147            }
148          });
149          $wrapper.find('.image-set-slideshow-show-caption').on('click', function(e) {
150            $(this).hide();
151            $captionWrapper = $('.image-set-slideshow-item-caption');
152            $captionWrapper.children('.image-set-slideshow-item-caption-contents');
153            return $captionWrapper.show();
154          });
155          $wrapper.find('.image-set-slideshow-item-caption-hide-button').on('click', function(e) {
156            $(this).parents('.image-set-slideshow-item-caption').hide();
157            return $('.image-set-slideshow-show-caption').show();
158          });
159          $wrapper.find('.image-set-slideshow-thumb').on('click', function(e) {
160            var index;
161            index = $(this).index();
162            return $slideshow.trigger('to.owl.carousel', [index, 250]);
163          });
164          $wrapper.on('mouseover', function(e) {
165            if (autoplayOn) {
166              return $slideshow.trigger('stop.owl.autoplay');
167            }
168          });
169          return $wrapper.on('mouseout', function(e) {
170            if (autoplayOn && !$wrapper.find('.image-set-slideshow-autoplay-toggle').hasClass('paused')) {
171              return $slideshow.trigger('play.owl.autoplay');
172            }
173          });
174        });
175      },
176      scrollLimitForHorizontalSet: function($horizontalSet) {
177        var totalWidth;
178        totalWidth = Array.from($horizontalSet.find(".image-placeholder")).reduce(function(total, elem) {
179          var width;
180          width = parseInt(elem.parentNode.getBoundingClientRect().width, 10);
181          return total + (isNaN(width) ? 0 : width);
182        }, 0);
183        return -(totalWidth - $horizontalSet.width());
184      },
185      initHorizontal: function() {
186        var $horizontalSets;
187        $horizontalSets = $(".format-image-set-items.horizontal");
188        return $horizontalSets.each(function() {
189          var $horizontalSet, lowerLimit, scrollPos, wheelHandler;
190          $horizontalSet = $(this);
191          scrollPos = 0;
192          lowerLimit = imageSet.scrollLimitForHorizontalSet($horizontalSet);
193          window.addEventListener('load', (function(_this) {
194            return function() {
195              return lowerLimit = imageSet.scrollLimitForHorizontalSet($horizontalSet);
196            };
197          })(this));
198          window.addEventListener('resize', debounce((function(_this) {
199            return function() {
200              return lowerLimit = imageSet.scrollLimitForHorizontalSet($horizontalSet);
201            };
202          })(this), 200));
203          wheelHandler = function(event) {
204            var scrollTarget;
205            scrollTarget = scrollPos - (event.originalEvent.deltaY + event.originalEvent.deltaX);
206            if (scrollTarget < lowerLimit) {
207              scrollPos = lowerLimit;
208            } else if (scrollTarget > 0) {
209              scrollPos = 0;
210            } else {
211              scrollPos = scrollTarget;
212              event.preventDefault();
213            }
214            return $horizontalSet.get(0).scrollLeft = -scrollPos;
215          };
216          $horizontalSet.on("wheel", wheelHandler);
217          return $(document).one("touchstart", function() {
218            $horizontalSet.off("wheel", wheelHandler);
219            return $horizontalSet.css("overflow-x", "scroll");
220          });
221        });
222      },
223      layoutMasonrySets: function() {
224        var $sets;
225        $sets = $(".format-image-set-items.masonry-image-set");
226        if (!$sets.length) {
227          return;
228        }
229        return $sets.each(function() {
230          var $set, $wrapper, keepOrderOn, moduleMeta, uuid;
231          $set = $(this);
232          uuid = Math.random().toString(36).slice(2);
233          $set.attr('data-masonry-id', uuid);
234          $wrapper = $($set[0]).parents('.format-image-set-wrapper');
235          moduleMeta = $wrapper.data('module-meta');
236          keepOrderOn = moduleMeta.keep_order === "true";
237          return allImagesReady(document.querySelector("[data-masonry-id='" + uuid + "']"), function() {
238            return waterfall($set[0], {
239              keepOrder: keepOrderOn
240            });
241          });
242        });
243      }
244    };
245    return $(function() {
246      var debouncedInit, initializeWaterfall;
247      imageSet.initLightbox();
248      imageSet.layoutMasonrySets();
249      imageSet.initSlideshow();
250      imageSet.initHorizontal();
251      initializeWaterfall = function() {
252        var $sets;
253        $sets = $(".format-image-set-items.masonry-image-set");
254        if (!$sets.length) {
255          return;
256        }
257        return $sets.each(function() {
258          var $set, $wrapper, keepOrderOn, moduleMeta;
259          $set = $(this);
260          $wrapper = $($set[0]).parents('.format-image-set-wrapper');
261          moduleMeta = $wrapper.data('module-meta');
262          keepOrderOn = moduleMeta.keep_order === "true";
263          return waterfall($set[0], {
264            keepOrder: keepOrderOn
265          });
266        });
267      };
268      debouncedInit = debounce(initializeWaterfall, 500);
269      window.addEventListener('load', debouncedInit);
270      return window.addEventListener('resize', debouncedInit);
271    });
272  }).call(_4ORMAT);
273
274}).call(this);

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.