PageSourceSearch

https://orel-eparhia.ru/files/js/js_lHb14HyBHFpCl46t0p1ly6srxOhIQQYeV0brKXdpZUw.js

js orel-eparhia.ru collected 2026-10-02 14:34:55 UTC 6,107 bytes, 190 lines download raw bytes

1(function ($, Drupal, PhotoSwipe, PhotoSwipeUI_Default) {
2  Drupal.behaviors.photoswipe = {
3    /**
4     * PhotoSwipe Options, coming from Drupal.settings.
5     */
6    photoSwipeOptions: {},
7    /**
8     * Instantiated galleries.
9     */
10    galleries: [],
11    /**
12     * Load PhotoSwipe once page is ready
13     */
14    attach: function (context, settings) {
15      this.photoSwipeOptions = settings.photoswipe ? settings.photoswipe.options : {};
16
17      var $galleries = $('.photoswipe-gallery', context);
18      if ($galleries.length) {
19        // loop through all gallery elements and bind events
20        $galleries.each( function (index) {
21          var $gallery = $(this);
22          $gallery.attr('data-pswp-uid', index + 1);
23          $gallery.once('photoswipe').on('click', Drupal.behaviors.photoswipe.onThumbnailsClick);
24        });
25      }
26      var $imagesWithoutGalleries = $('a.photoswipe', context).filter( function(elem) {
27        return !$(this).closest('.photoswipe-gallery').length;
28      });
29
30      if ($imagesWithoutGalleries.length) {
31        // We have no galleries just individual images.
32        $imagesWithoutGalleries.each(function (index) {
33          var $imageLink = $(this);
34          // Fallback to group by field, as we did in the past, if this is a field.
35          // @see https://www.drupal.org/project/photoswipe/issues/3179987
36          var $imageLinkParentFieldItems = $imageLink.closest('.field-items');
37          if ($imageLinkParentFieldItems.length > 0) {
38            $imageLinkParentFieldItems.addClass('photoswipe-gallery');
39          } else {
40            $imageLink.wrap('<div class="photoswipe-gallery"></div>');
41          }
42
43          var $gallery = $imageLink.closest('.photoswipe-gallery');
44          if(!$gallery.attr('data-pswp-uid')){
45            $gallery.attr('data-pswp-uid', index + 1);
46            $gallery.once('photoswipe').on('click', Drupal.behaviors.photoswipe.onThumbnailsClick);
47            $galleries.push($gallery);
48          }
49        });
50      }
51
52      // Parse URL and open gallery if it contains #&pid=3&gid=1
53      var hashData = this.parseHash();
54      if (hashData.pid > 0 && hashData.gid > 0) {
55        this.openPhotoSwipe(hashData.pid - 1, $($galleries[hashData.gid - 1]));
56      }
57    },
58    /**
59     * Triggers when user clicks on thumbnail.
60     *
61     * Code taken from http://photoswipe.com/documentation/getting-started.html
62     * and adjusted accordingly.
63     */
64    onThumbnailsClick: function (e) {
65      e = e || window.event;
66
67      var $clickedGallery = $(this);
68
69      var eTarget = e.target || e.srcElement;
70      var $eTarget = $(eTarget);
71
72      // find root element of slide
73      var clickedListItem = $eTarget.closest('.photoswipe');
74
75      if (!clickedListItem) {
76        return true;
77      }
78
79      // Get the index of the clicked element.
80      var index = clickedListItem.closest('.photoswipe-gallery').find('.photoswipe').index(clickedListItem);
81      if (index >= 0) {
82        // Open PhotoSwipe if a valid index was found.
83        Drupal.behaviors.photoswipe.openPhotoSwipe(index, $clickedGallery);
84
85        // Prevent default:
86        e.preventDefault ? e.preventDefault() : e.returnValue = false;
87        return false;
88      }
89      return true;
90    },
91    /**
92     * Code taken from http://photoswipe.com/documentation/getting-started.html
93     * and adjusted accordingly.
94     */
95    openPhotoSwipe: function (index, galleryElement, options) {
96      var pswpElement = $('.pswp')[0];
97      var items = [];
98      options = options || Drupal.behaviors.photoswipe.photoSwipeOptions;
99
100      var images = galleryElement.find('a.photoswipe');
101      images.each(function (index) {
102        var $image = $(this);
103        size = $image.data('size') ? $image.data('size').split('x') : ['', ''];
104        items.push(
105          {
106            src: $image.attr('href'),
107            w: size[0],
108            h: size[1],
109            title: $image.data('overlay-title'),
110            msrc: $image.find('img').attr('src')
111          }
112        );
113      })
114
115      // define options
116      options.index = index;
117      // define gallery index (for URL)
118      options.galleryUID = galleryElement.data('pswp-uid');
119
120      // Add zoom animation function:
121      options.getThumbBoundsFn = function (index) {
122        var tn = galleryElement.find('a.photoswipe:eq(' + index + ') img');
123        if (tn.length == 0) {
124          tn = galleryElement.find('a.photoswipe:eq(0) img');
125        }
126        if (tn.length == 0) {
127          // Return undefined if still null, see https://www.drupal.org/project/photoswipe/issues/3023442
128          return undefined;
129        }
130        var tw = tn.width();
131        var tpos = tn.offset();
132        return { x: tpos.left, y: tpos.top, w: tw };
133      }
134
135      // Pass data to PhotoSwipe and initialize it
136      var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
137      gallery.init();
138      this.galleries.push(gallery);
139    },
140    /**
141     * Parse picture index and gallery index from URL (#&pid=1&gid=2)
142     *
143     * Code taken from http://photoswipe.com/documentation/getting-started.html
144     * and adjusted accordingly.
145     */
146    parseHash: function () {
147      var hash = window.location.hash.substring(1),
148        params = {};
149
150      if (hash.length < 5) {
151        return params;
152      }
153
154      var vars = hash.split('&');
155      for (var i = 0; i < vars.length; i++) {
156        if (!vars[i]) {
157          continue;
158        }
159        var pair = vars[i].split('=');
160        if (pair.length < 2) {
161          continue;
162        }
163        params[pair[0]] = pair[1];
164      }
165
166      if (params.gid) {
167        params.gid = parseInt(params.gid, 10);
168      }
169
170      if (!params.hasOwnProperty('pid')) {
171        return params;
172      }
173      params.pid = parseInt(params.pid, 10);
174
175      return params;
176    }
177  };
178})(jQuery, Drupal, PhotoSwipe, PhotoSwipeUI_Default);
179;
180(function ($) {
181  $(document).ready(function() {
182    $.ajax({
183      type: "POST",
184      cache: false,
185      url: Drupal.settings.statistics.url,
186      data: Drupal.settings.statistics.data
187    });
188  });
189})(jQuery);
190;

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.