PageSourceSearch

https://www.buergerhaeuser-dreieich.de/media/showtime/adapters/lightbox/module-slides.js?1.0.0

js buergerhaeuser-dreieich.de collected 2026-10-09 17:13:15 UTC 3,781 bytes, 144 lines download raw bytes

1/**
2 * @author      Lefteris Kavadas
3 * @copyright   Copyright (c) 2016 - 2026 Lefteris Kavadas / firecoders.com
4 * @license     GNU General Public License version 3 or later
5 */
6
7(function(window, document, $) {
8  "use strict";
9
10  var registrations = [];
11  var active = null;
12  var registrationId = 0;
13  var patched = false;
14
15  function patchLightbox() {
16    if (patched || !window.lightbox) {
17      return;
18    }
19
20    patched = true;
21
22    var originalStart = window.lightbox.start;
23    var originalChangeImage = window.lightbox.changeImage;
24    var originalEnd = window.lightbox.end;
25
26    window.lightbox.start = function(link) {
27      var element = link && link.get ? link.get(0) : null;
28
29      active = null;
30      registrations.some(function(registration) {
31        if (element && registration.gallery.contains(element)) {
32          active = registration;
33          return true;
34        }
35
36        return false;
37      });
38
39      return originalStart.apply(this, arguments);
40    };
41
42    window.lightbox.changeImage = function(index) {
43      var item = active && active.ordered[index];
44      var result;
45
46      if (!active || !item) {
47        return originalChangeImage.apply(this, arguments);
48      }
49
50      active.controller.deactivateAll(item.type === "module" ? item.id : null);
51      this.$outerContainer.removeClass("showtime-module-slide-active");
52
53      result = originalChangeImage.apply(this, arguments);
54
55      if (item.type === "module") {
56        if (!active.host) {
57          active.host = document.createElement("div");
58          active.host.className = "showtime-module-slide-host";
59          this.$outerContainer.append(active.host);
60        }
61
62        this.$outerContainer.addClass("showtime-module-slide-active");
63        active.controller.activate(item.id, active.host, index);
64      }
65
66      return result;
67    };
68
69    window.lightbox.end = function() {
70      var result;
71
72      if (active) {
73        active.controller.destroy();
74        this.$outerContainer.removeClass("showtime-module-slide-active");
75      }
76
77      result = originalEnd.apply(this, arguments);
78      active = null;
79
80      return result;
81    };
82  }
83
84  window.ShowtimeLightboxModuleSlidesAdapter = {
85    prepare: function(gallery, controller) {
86      if (!gallery || !controller || !window.lightbox) {
87        return false;
88      }
89
90      var config = controller.getConfig();
91
92      controller.createItems(function(slide) {
93        var item = document.createElement("a");
94        var image = document.createElement("img");
95
96        item.id = slide.id + "-item";
97        item.className = "showtime-module-slide-item";
98        item.href = config.assets.placeholder;
99        item.tabIndex = -1;
100        item.setAttribute("hidden", "");
101        item.setAttribute("aria-hidden", "true");
102        item.setAttribute("data-showtime-width", "1600");
103        item.setAttribute("data-showtime-height", "900");
104
105        image.src = config.assets.thumbnail;
106        image.alt = "";
107        item.appendChild(image);
108
109        return item;
110      });
111
112      registrationId++;
113      var group =
114        "showtime-module-slides-" +
115        config.galleryId +
116        "-" +
117        registrationId;
118      var itemSelector =
119        config.imageSelector + ", a[data-showtime-module-slide]";
120
121      $(gallery)
122        .find(itemSelector)
123        .each(function() {
124          var item = $(this);
125          item.attr("data-lightbox", group);
126          item.attr(
127            "data-title",
128            item.attr("data-showtime-caption") || ""
129          );
130        });
131
132      registrations.push({
133        gallery: gallery,
134        controller: controller,
135        ordered: controller.getOrderedItems(),
136        host: null
137      });
138
139      patchLightbox();
140
141      return true;
142    }
143  };
144})(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.