PageSourceSearch

https://www.rosier.de/wp-content/plugins/ts-mobilede/public/js/pswp_slick.js?ver=1.1.7

js rosier.de collected 2026-10-02 18:03:31 UTC 7,038 bytes, 230 lines download raw bytes

1(function(window, document, $) {
2'use strict';
3
4
5var initPhotoSwipeFromDOM = function (gallerySelector) {
6  var gItems = [];
7
8  var galleryElements = document.querySelectorAll( gallerySelector );
9
10  for(var i = 0, l = galleryElements.length; i < l; i++) {
11    galleryElements[i].setAttribute('data-pswp-uid', i+1);
12  }
13
14  $(gallerySelector).each(function(){
15    var thumbElements = $(this).find('.img-holder');
16
17    var numNodes = thumbElements.length,
18      items = [],
19      divEl,
20      linkEl,
21      item;
22
23    for(var i = 0; i < numNodes; i++) {
24
25      divEl = thumbElements[i]; // <div> element
26      //console.log(divEl.nodeType);
27      // include only element nodes
28      if(divEl.nodeType !== 1) {
29        continue;
30      }
31
32      if(divEl.className.indexOf('slick-cloned') > 0) {
33        continue;
34      }
35
36      linkEl = divEl.children[0]; // <a> element
37
38
39      // create slide object
40      item = {
41        src: divEl.getAttribute('data-src'),
42        w: 0,
43        h: 0
44      };
45
46
47      item.el = divEl; // save link to element for getThumbBoundsFn
48      items.push(item);
49    }
50
51    //console.log(numNodes);
52    //console.log(items);
53
54    gItems = items;
55
56    thumbElements.each(function (){
57      $(this).on('click.open.pswp',function(){
58        let index = $(this).data('slick-index') ?? $(this).data('index') ?? 0;
59        openPhotoSwipe( index , $(this).closest(gallerySelector) );
60      });
61    });
62  });
63
64  var openPhotoSwipe = function(index, galleryElement, disableAnimation, fromURL) {
65    $('body').addClass('photoSwipeOpen');
66
67    var pswpElement = document.querySelectorAll('.pswp')[0],
68      gallery,
69      options,
70      items;
71
72    items = gItems;
73    //console.log(items);
74    // index -= 1;
75    //console.log(index);
76    // define options (if needed)
77    options = {
78
79      // define gallery index (for URL)
80      galleryUID: galleryElement.data('pswp-uid'),
81
82      getThumbBoundsFn: function(index) {
83        // See Options -> getThumbBoundsFn section of documentation for more info
84        var thumbnail = items[index].el.getElementsByTagName('img')[0], // find thumbnail
85          pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
86          rect = thumbnail.getBoundingClientRect();
87
88        return {x:rect.left, y:rect.top + pageYScroll, w:rect.width};
89      }
90
91    };
92
93    options.index = parseInt(index, 10);
94
95    // exit if index not found
96    if( isNaN(options.index) ) {
97      return;
98    }
99
100    // Pass data to PhotoSwipe and initialize it
101    gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);
102    console.log('gallery');
103    gallery.listen('gettingData', function(index, item) {
104      if (item.w < 1 || item.h < 1) { // unknown size
105        var img = new Image();
106        img.onload = function() { // will get size after load
107          item.w = this.width; // set image width
108          item.h = this.height; // set image height
109          gallery.invalidateCurrItems(); // reinit Items
110          gallery.updateSize(true); // reinit Items
111        }
112        img.src = item.src; // let's download image
113      }
114    });
115    gallery.init();
116
117    gallery.listen('close', function() {
118      $('body').removeClass('photoSwipeOpen');
119    });
120
121    gallery.listen('afterChange', function() {
122
123      var curr = gallery.currItem;
124      var index2 = curr.el.dataset.slickIndex;
125      //console.log(index2);
126      // $('.slider-main').slick('slickGoTo', index);
127
128      // $('.slider-main').slick("slickSetOption", 'speed', 1, true);
129      // $('.slider-main').slick("slickSetOption", 'waitForAnimate', false, false);
130      $('.slider-main').slick('slickGoTo', index2);
131      // $('.slider-main').slick("slickSetOption", 'speed', 300, true);
132      // $('.slider-main').slick("slickSetOption", 'waitForAnimate', true, false);
133
134    });
135
136  };
137};
138
139//console.log('pswp slicked');
140// execute above function
141initPhotoSwipeFromDOM('.tsmd-widget .image-holder-wrap');
142
143/*
144*
145*
146var openPhotoSwipe = function(index, galleryElement, disableAnimation, fromURL) {
147        $('body').addClass('photoSwipeOpen');
148        var pswpElement = document.querySelectorAll('.pswp')[0],
149            gallery,
150            options,
151            items;
152
153        items = parseThumbnailElements(galleryElement);
154
155        index -= 1;
156        // console.log(index);
157
158        // define options (if needed)
159        options = {
160
161            // define gallery index (for URL)
162            galleryUID: galleryElement.getAttribute('data-pswp-uid'),
163
164            getThumbBoundsFn: function(index) {
165                // See Options -> getThumbBoundsFn section of documentation for more info
166                var thumbnail = items[index].el.getElementsByTagName('img')[0], // find thumbnail
167                    pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
168                    rect = thumbnail.getBoundingClientRect();
169
170                return {x:rect.left, y:rect.top + pageYScroll, w:rect.width};
171            }
172
173        };
174
175        // PhotoSwipe opened from URL
176        if(fromURL) {
177            if(options.galleryPIDs) {
178                // parse real index when custom PIDs are used
179                // http://photoswipe.com/documentation/faq.html#custom-pid-in-url
180                for(var j = 0; j < items.length; j++) {
181                    if(items[j].pid == index) {
182                        options.index = j;
183                        break;
184                    }
185                }
186            } else {
187                // in URL indexes start from 1
188                options.index = parseInt(index, 10) - 1;
189            }
190        } else {
191            options.index = parseInt(index, 10);
192        }
193
194        // exit if index not found
195        if( isNaN(options.index) ) {
196            return;
197        }
198
199        if(disableAnimation) {
200            options.showAnimationDuration = 0;
201        }
202
203        // Pass data to PhotoSwipe and initialize it
204        gallery = new PhotoSwipe( pswpElement, PhotoSwipeUI_Default, items, options);
205        gallery.init();
206
207        gallery.listen('close', function() {
208            $('body').removeClass('photoSwipeOpen');
209        });
210
211        gallery.listen('afterChange', function() {
212
213            var curr = gallery.currItem;
214            var index2 = curr.el.dataset.slickIndex;
215            console.log(index2);
216            // $('.slider-main').slick('slickGoTo', index);
217
218            // $('.slider-main').slick("slickSetOption", 'speed', 1, true);
219            // $('.slider-main').slick("slickSetOption", 'waitForAnimate', false, false);
220            $('.slider-main').slick('slickGoTo', index2);
221            // $('.slider-main').slick("slickSetOption", 'speed', 300, true);
222            // $('.slider-main').slick("slickSetOption", 'waitForAnimate', true, false);
223
224        });
225
226    };
227*
228*/
229
230}(window, document, jQuery));

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.