PageSourceSearch

https://www.morrisseycentral.com/static/_common/slideshows/slidesh…013613fe132bfc7d3f2b153ed75ce21f224c96ea.js

js morrisseycentral.com collected 2026-10-02 07:32:26 UTC 8,547 bytes, 195 lines download raw bytes

1(function() {
2  var indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
3
4  (function() {
5    var $, DEFAULT_TRANSITION_SPEED, GALLERY_SETTINGS, SLIDESHOWS_THAT_LOOP, assignAnimationClasses, clearAnimationClasses, convertTransitionSpeedStringToMs, getNextSlide, getPreviousSlide, getSlideCSS, getTransitionDirection, initializeSlideshows;
6    $ = this.jQuery;
7    GALLERY_SETTINGS = {
8      items: 1,
9      mode: "gallery",
10      controls: true,
11      autoplayButtonOutput: false,
12      autoplayHoverPause: false,
13      animateIn: "in",
14      animateOut: "out",
15      mouseDrag: false,
16      preventScrollOnTouch: "auto"
17    };
18    DEFAULT_TRANSITION_SPEED = 700;
19    SLIDESHOWS_THAT_LOOP = ["slideshow_01"];
20    initializeSlideshows = (function(_this) {
21      return function() {
22        return $('.format-slideshow').each(function(domIndex, domElement) {
23          var $arrowLeft, $arrowRight, $nav, $slideshow, allowClickableSlides, designVariables, loopSlides, ref, showDots, slideCSS, slider, slides, transitionSpeed;
24          $slideshow = $(domElement);
25          slides = domElement.querySelectorAll('.format-slideshow__slide');
26          if (!(slides.length > 1)) {
27            return;
28          }
29          designVariables = $slideshow.data();
30          if (slides.length === 2 && designVariables.animationStyle === "side_by_side") {
31            slides.forEach(function(slide) {
32              return slide.classList.add("two-up");
33            });
34          }
35          $nav = $slideshow.find(".format-slideshow__dots")[0];
36          $arrowLeft = $slideshow.find('.format-slideshow__arrow--left');
37          $arrowRight = $slideshow.find('.format-slideshow__arrow--right');
38          loopSlides = (ref = designVariables.slideshowTag, indexOf.call(SLIDESHOWS_THAT_LOOP, ref) >= 0);
39          showDots = designVariables.pageCountStyle === "dots" || designVariables.slideshowTag === "slideshow_05";
40          allowClickableSlides = designVariables.slideshowTag === "slideshow_02";
41          slideCSS = getSlideCSS($slideshow);
42          if (!loopSlides) {
43            $arrowLeft.prop('disabled', true);
44          }
45          if (slideCSS) {
46            transitionSpeed = convertTransitionSpeedStringToMs(slideCSS["transition-duration"]);
47          } else {
48            transitionSpeed = DEFAULT_TRANSITION_SPEED;
49          }
50          slider = tns($.extend({
51            container: $slideshow.find(".slider")[0]
52          }, GALLERY_SETTINGS, {
53            prevButton: $arrowLeft[0],
54            nextButton: $arrowRight[0],
55            autoplay: designVariables.autoPlaySpeed !== false,
56            autoplayTimeout: designVariables.autoPlaySpeed * 1000,
57            nav: showDots,
58            navContainer: $nav,
59            speed: transitionSpeed,
60            loop: loopSlides
61          }));
62          if (allowClickableSlides) {
63            $(slides).click(function(event) {
64              if (event.target.tagName !== "A") {
65                slider.pause();
66                slider.play();
67                return slider.goTo(event.currentTarget.dataset.index - 1);
68              }
69            });
70          }
71          slider.events.on("transitionStart", function(event) {
72            slides = Array.from(event.slideItems);
73            clearAnimationClasses(slides);
74            assignAnimationClasses(slides, event.index, event.indexCached, loopSlides, designVariables);
75            $slideshow.addClass("transitioning");
76            $arrowLeft.prop('disabled', true);
77            return $arrowRight.prop('disabled', true);
78          });
79          return slider.events.on("transitionEnd", function(event) {
80            $slideshow.removeClass("transitioning");
81            $arrowLeft.prop('disabled', false);
82            $arrowRight.prop('disabled', false);
83            if (!loopSlides) {
84              if (event.index === 0) {
85                return $arrowLeft.prop('disabled', true);
86              } else if (event.index === event.slideCount - 1) {
87                return $arrowRight.prop('disabled', true);
88              }
89            }
90          });
91        });
92      };
93    })(this);
94    clearAnimationClasses = function(slides) {
95      var allAnimationClasses;
96      allAnimationClasses = ['entering-from-left', 'entering-from-right', 'entering-from-far-right', 'entering-from-far-left', 'on-stage', 'exiting-to-left', 'exiting-to-right', 'exiting-to-far-left', 'exiting-to-far-right'];
97      return slides.forEach(function(slide) {
98        return allAnimationClasses.forEach(function(className) {
99          return slide.classList.remove(className);
100        });
101      });
102    };
103    assignAnimationClasses = function(slides, currentSlideIndex, previousSlideIndex, loopSlides, designVariables) {
104      var currentSlide, direction, exitingSlide, farExitingSlide, farLeftSlide, farRightSlide, leftSlide, rightSlide;
105      direction = getTransitionDirection(currentSlideIndex, previousSlideIndex, slides.length);
106      currentSlide = slides[currentSlideIndex];
107      exitingSlide = slides[previousSlideIndex];
108      rightSlide = getNextSlide(currentSlide, slides, loopSlides);
109      leftSlide = getPreviousSlide(currentSlide, slides, loopSlides);
110      if (!(designVariables.animationStyle === "side_by_side" && slides.length < 4)) {
111        farRightSlide = getNextSlide(rightSlide, slides, loopSlides);
112        farLeftSlide = getPreviousSlide(leftSlide, slides, loopSlides);
113      }
114      if (direction === "left") {
115        farExitingSlide = getPreviousSlide(exitingSlide, slides, loopSlides);
116      } else {
117        farExitingSlide = getNextSlide(exitingSlide, slides, loopSlides);
118      }
119      currentSlide.classList.add("on-stage");
120      exitingSlide.classList.add("exiting-to-" + direction);
121      if (rightSlide) {
122        rightSlide.classList.add("entering-from-right");
123      }
124      if (leftSlide) {
125        leftSlide.classList.add("entering-from-left");
126      }
127      if (!(designVariables.animationStyle === "side_by_side" && slides.length < 4)) {
128        if (farRightSlide) {
129          farRightSlide.classList.add('entering-from-far-right');
130        }
131        if (farLeftSlide) {
132          farLeftSlide.classList.add('entering-from-far-left');
133        }
134        if (farExitingSlide) {
135          return farExitingSlide.classList.add("exiting-to-far-" + direction);
136        }
137      }
138    };
139    getTransitionDirection = function(currentIndex, previousIndex, count) {
140      var direction;
141      if (previousIndex === 0 && currentIndex > 1) {
142        direction = "right";
143      } else if (currentIndex === 0 && previousIndex === count - 1) {
144        direction = "left";
145      } else if (currentIndex < previousIndex) {
146        direction = "right";
147      } else if (currentIndex > previousIndex) {
148        direction = "left";
149      }
150      return direction;
151    };
152    getNextSlide = function(currentSlide, slides, loopSlides) {
153      var currentSlideIndex, nextIndex;
154      currentSlideIndex = currentSlide ? currentSlide.dataset.index - 1 : void 0;
155      if (loopSlides) {
156        nextIndex = (currentSlideIndex + 1) % slides.length;
157      } else if (!currentSlide || currentSlideIndex === slides.length) {
158        return false;
159      } else {
160        nextIndex = currentSlideIndex + 1;
161      }
162      return slides[nextIndex];
163    };
164    getPreviousSlide = function(currentSlide, slides, loopSlides) {
165      var currentSlideIndex, previousIndex;
166      currentSlideIndex = currentSlide ? currentSlide.dataset.index - 1 : void 0;
167      if (loopSlides) {
168        previousIndex = (currentSlideIndex - 1 + slides.length) % slides.length;
169      } else if (!currentSlide || currentSlideIndex === 0) {
170        return false;
171      } else {
172        previousIndex = currentSlideIndex - 1;
173      }
174      return slides[previousIndex];
175    };
176    getSlideCSS = function($slideshow) {
177      var $firstSlide;
178      $firstSlide = $slideshow.find(".format-slideshow__inner").children()[0];
179      if (!$firstSlide) {
180        return null;
181      }
182      return typeof window.getComputedStyle === "function" ? window.getComputedStyle($firstSlide) : void 0;
183    };
184    convertTransitionSpeedStringToMs = function(transitionSpeedString) {
185      var transitionSeconds;
186      if (!transitionSpeedString) {
187        return 0;
188      }
189      transitionSeconds = parseFloat(transitionSpeedString.slice(0, transitionSpeedString.length - 1), 10);
190      return transitionSeconds * 1000;
191    };
192    return $(initializeSlideshows);
193  }).call(_4ORMAT);
194
195}).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.