PageSourceSearch

https://www.boell.de/themes/theodor/js/script.js?v=1.2.45

js boell.de collected 2026-09-24 07:31:26 UTC 13,785 bytes, 425 lines download raw bytes

1/**
2 * standard general scripts
3 *
4 * @author Kim-Christian Meyer <[email protected]>
5 * @modified 2013-08-13
6 */
7
8(function ($, Drupal, once) {
9  Drupal.behaviors.ph_layout_container_padding_adjust = {
10    attach: function (context, settings) {
11      const gridBreakingNewsBox = document.querySelector('.breaking_news-box');
12      const adminToolbar = document.getElementById('toolbar-bar');
13      const adminToolbarMenu = document.getElementById('toolbar-item-administration-tray');
14      const regionTabs = document.querySelector('.layout-tabs .region-tabs');
15      const layoutContainer = document.querySelector('.layout-container');
16
17      const topPadding = regionTabs ? regionTabs.offsetHeight : 0;
18
19
20      if (gridBreakingNewsBox) {
21        gridBreakingNewsBox.style['top'] = (adminToolbar ? adminToolbar.offsetHeight : 0) + (adminToolbarMenu ? adminToolbarMenu.offsetHeight : 0) + topPadding + 'px';
22        layoutContainer.style['padding-top'] = (topPadding + gridBreakingNewsBox.offsetHeight) + 'px';
23        const isOnlyBoxInContainer = gridBreakingNewsBox.closest('.grid-slot-has-one-box');
24        if (isOnlyBoxInContainer) {
25          const gridContainer = gridBreakingNewsBox.closest('.grid-container');
26          gridContainer.style['margin-bottom'] = '0';
27        }
28      } else {
29        layoutContainer.style['padding-top'] = topPadding + 'px';
30      }
31    }
32  };
33
34  /**
35   * Banner-Box close button
36   */
37  Drupal.behaviors.ph_banner_box_closing = {
38    attach: function (context, settings) {
39      $(function () {
40        var storageKey = "BoxClosable";
41        var validSeconds = 60 * 60 * 3;
42
43        function getStore() {
44          var store = localStorage.getItem(storageKey) || {};
45          if (typeof store !== typeof {}) store = JSON.parse(store);
46          return store;
47        }
48
49        function setStore(store) {
50          localStorage.setItem(storageKey, JSON.stringify(store));
51        }
52
53        function hideBox() {
54          var store = getStore();
55          store[window.location.href] = Date.now();
56          setStore(store);
57        }
58
59        function isHidden() {
60          var store = getStore();
61          var stamp = store[window.location.href];
62          return (
63              typeof stamp !== typeof undefined &&
64              Date.now() - stamp < 1000 * validSeconds
65          );
66        }
67
68        var $closable_boxes = $(
69            ".js-closable-grid-box",
70            context
71        );
72
73        $closable_boxes.each(function (i, element) {
74          var $container = $(element);
75
76          if (isHidden()) {
77            $closable_boxes.hide();
78          }
79        });
80
81        $closable_boxes.on(
82            "click",
83            ".js-closable-grid-box__button",
84            function (e) {
85              var $c = $(e.delegateTarget);
86              jQuery($c).unstick();
87              hideBox();
88              $c.hide();
89            }
90        );
91      });
92    }
93  };
94
95  /**
96   * Banner-Box toggle button
97   */
98  Drupal.behaviors.ph_banner_box_minimize = {
99    attach: function (context, settings) {
100      $(function () {
101
102        var $toggable_boxes = $(
103            ".js-toggable-grid-box",
104            context
105        );
106
107        $toggable_boxes.on(
108            "click",
109            ".js-toggable-grid-box__button",
110            function (e) {
111              var $c = $(e.delegateTarget);
112              jQuery($c).unstick();
113              $c.toggleClass('is-toggled');
114            }
115        );
116      });
117    }
118  };
119
120  $(".comment-form-toggler").click(function (e) {
121    e.preventDefault();
122    $(this)
123        .closest(".field--type-comment")
124        .find(".comment-form.hidden")
125        .removeClass("hidden");
126    $(this)
127        .closest(".field--type-comment")
128        .find(".comment-form.hidden")
129        .slideDown();
130    $(this).remove();
131  });
132
133
134  /**
135   * YouTube channel changer by Edward
136   */
137  var $grid = $(".grid");
138  $grid
139      .find(".grid-box .boe-youtube-channel .video:first-child")
140      .css("display", "block");
141  $grid.on("mouseenter", ".grid-box .boe-youtube-channel .thumb", function (e) {
142    var $this = $(this);
143    var key = $this.attr("rel");
144    var $channel = $this.closest(".boe-youtube-channel");
145    var $active = null;
146    $.each($channel.find(".video"), function (index, vid) {
147      var $vid = $(vid);
148      if ($vid.css("display") == "block") {
149        $active = $vid;
150        return false;
151      }
152    });
153    // ignore if same
154    if ($active.attr("target") == key) return;
155
156    // show new video
157    $channel.find(".video").hide();
158    $channel.find(".video[target=" + key + "]").show();
159
160    // stop old video in case if it is playing
161    var $clone = $active.clone();
162    $active.replaceWith($clone);
163  });
164
165  /**
166   * Black Grid Container JS
167   */
168  Drupal.behaviors.ph_black_grid_container = {
169    attach: function (context, settings) {
170      $(function () {
171        var storageKey = "blackgridcontainerState";
172        var validSeconds = 60 * 60 * 3;
173
174        function getStore() {
175          var store = localStorage.getItem(storageKey) || {};
176          if (typeof store !== typeof {}) store = JSON.parse(store);
177          return store;
178        }
179
180        function setStore(store) {
181          localStorage.setItem(storageKey, JSON.stringify(store));
182        }
183
184        function setClosedHighlight() {
185          var store = getStore();
186          store[window.location.href] = Date.now();
187          setStore(store);
188        }
189
190        function isClosedHighlight() {
191          var store = getStore();
192          var stamp = store[window.location.href];
193          return (
194              typeof stamp !== typeof undefined &&
195              Date.now() - stamp < 1000 * validSeconds
196          );
197        }
198
199        var $black_containers = $(".grid-container--black", context);
200
201        $black_containers.each(function (i, element) {
202          var $container = $(element);
203          if ($container.index() !== 0) return;
204
205          if (!isClosedHighlight()) {
206            $container.attr("data-is-black-highlight", true);
207            $container.prepend(
208                $("<span aria-label='Close' tabindex='0'>&times;</span>").addClass(
209                    "grid-container--black__button-hide"
210                )
211            );
212
213            jQuery(document).ready(function () {
214              // jQuery('[data-is-black-highlight=true]')
215              if (document.body.clientWidth > 1000) {
216                jQuery($container).sticky({
217                  topSpacing: 0,
218                  responsiveWidth: true // recalculate widths on window resize
219                });
220              }
221            });
222          } else {
223            $container.attr("data-is-black-highlight", false);
224          }
225
226          // var viewportHeight = $(window).height();
227          // if ($container.height() > (viewportHeight / 100) * 30) {
228          //   $container.addClass("short");
229          //   $container.append(
230          //     '<a href="#" class="expand">' + Drupal.t("read more") + "</a>"
231          //   );
232          //
233          //   $container.find(".expand").click(function(e) {
234          //     e.preventDefault();
235          //     $container.removeClass("short");
236          //     $container.find("a.expand").remove();
237          //   });
238          // }
239        });
240
241        $black_containers.on(
242            "click",
243            ".grid-container--black__button-hide",
244            function (e) {
245              var $c = $(e.delegateTarget);
246              if ($c.attr("data-is-black-highlight") === false) return;
247              $c.attr("data-is-black-highlight", false);
248              jQuery($c).unstick();
249              setClosedHighlight();
250            }
251        );
252      });
253    }
254  };
255
256  // Highlighting the Glossary Navigation, ben_
257  jQuery(document).ready(function () {
258
259    // First on the Overview
260    jQuery(".view-tags-glossary .attachment-before a.is-active").parent().addClass("active");
261
262    // Then on the Single Tag Site
263    if (jQuery(".route-view-mediatags-page1 h1.page-title").length > 0) {
264      var mypagecharacter = jQuery(".route-view-mediatags-page1 h1.page-title").html().substring(0, 1).toLowerCase();
265      var query = '.block-tags-glossary a[href="/de/tags-glossary/' + mypagecharacter + '"]';
266      jQuery(query).addClass("active");
267      jQuery(".block-tags-glossary a.active").parent().addClass("active");
268    }
269
270    //START control of .button-product--download - button on product-site
271    var toggleDownloadOverlay = function () {
272      var $wrapper = $(this).parents('.button-product-wrapper');
273      $wrapper.find('.download-overlay--wrapper').toggleClass('hide');
274      $wrapper.find('.download-overlay--wrapper').toggleClass('show');
275    };
276
277    var $closeButton = $('.download-overlay--content .close-button');
278    $closeButton.on('click', toggleDownloadOverlay);
279
280    var $downloadButton = $('.button-product--download');
281    $downloadButton.on('click', toggleDownloadOverlay)
282
283    jQuery(document).keyup(function(e) {
284      // hide download modal if escape key (=code 27) is pressed - #3923
285      if (e.keyCode == 27) {
286        jQuery('.part--teaser__overlay.show').addClass('hide');
287        jQuery('.download-overlay--wrapper.show').addClass('hide');
288      }
289    });
290
291    jQuery(document).keydown(function(e) {
292      // trap user inside download modal if tab key (=code 9) is pressed / escape via esc-key still possible - #3963
293      if (e.keyCode == 9) {
294        var target = e.target;
295        var shiftPressed = e.shiftKey;
296        // only inside .download-overlay--wrapper
297        if (jQuery(target).parents('.download-overlay--wrapper').length) {
298          var borderElem = shiftPressed ?
299              jQuery(target).closest('.download-overlay--wrapper').find('.button-product').first()
300              :
301              jQuery(target).closest('.download-overlay--wrapper').find('.button-product').last();
302          if (jQuery(borderElem).length) {
303            if (jQuery(target).is(jQuery(borderElem))) {
304              return false;
305            } else {
306              return true;
307            }
308          }
309        }
310      }
311      return true;
312    });
313    //END .button-product--download
314
315
316    // New for component Teaser Revised
317    $('.part--teaser__button_download').on('click', function () {
318      var $wrapper = $(this).parents('.component--teaser-revised');
319      var nodeid = $wrapper.attr('data-nodeid');
320      revisedToggleDownloadOverlay(nodeid);
321    });
322
323    function revisedToggleDownloadOverlay(nodeid){
324      $("#overlay-nodeid-"+nodeid).toggleClass('hide');
325      $("#overlay-nodeid-"+nodeid).toggleClass('show');
326      $("#overlay-nodeid-"+nodeid+" .download-overlay--wrapper").toggleClass('hide');
327      $("#overlay-nodeid-"+nodeid+" .download-overlay--wrapper").toggleClass('show');
328    }
329
330    $('.part--teaser__overlay .close-button').on('click', function () {
331      var $wrapper = $(this).parents('.part--teaser__overlay');
332      var nodeid = $wrapper.attr('data-nodeid');
333      revisedToggleDownloadOverlay(nodeid);
334    });
335
336
337    // End Teaser Revised
338
339
340
341
342    if (typeof littlefoot !== 'undefined') {
343      littlefoot.default({
344        anchorPattern: /footnote[\d]+_/gi,
345        buttonTemplate: '<button\n' +
346            '  aria-expanded="false"\n' +
347            '  aria-label="Footnote <% number %>"\n' +
348            '  class="littlefoot-footnote__button"\n' +
349            '  id="<% reference %>"\n' +
350            '  title="See Footnote <% number %>"\n' +
351            '/>\n' +
352            '  <% number %>\n' +
353            '</button>'
354      });
355    }
356  });
357
358  Drupal.behaviors.ph_mobile_search_toggle = {
359    attach: function (context, settings) {
360      $('#ph-new-search--mobile-filter-toggle', context).on('click', () => {
361        $('#ph-new-search--filter').toggleClass('active')
362      });
363    }
364  }
365
366
367  Drupal.behaviors.before_print_hook = {
368    attach: function (context, settings) {
369      let copyrightFooter = once('ph-before_print_hook-copyright-footer', '.boell-copyright-footer-btn', context);
370      if (copyrightFooter.length) {
371        copyrightFooter = copyrightFooter[0]
372        addEventListener("beforeprint", (event) => {
373          copyrightFooter.click() //adds copyrights to the printcss before the browser generates the print page
374        })
375      }
376    }
377  }
378
379  Drupal.behaviors.ph_footify = {
380    attach: function (context, settings) {
381
382
383      const footifyBlocks = once('ph-footify-blocks', '.region-footer-content .block', context);
384
385      if (footifyBlocks.length === 0) return;
386
387      footifyBlocks.forEach(contentBlock => {
388        if (!contentBlock.classList.contains('block-footify-block')) contentBlock.classList.add('block-footify-block')
389      })
390
391      const regionFooterContent = once('ph-footer-submenu', '.site-footer--tabs .site-footer-middle-wrapper .inner')
392
393      const $footifyBlocks = $(footifyBlocks);
394
395      $(regionFooterContent).append('<div class="region region-footify-submenu"></div>')
396
397
398/*      let firstTabContent = $footifyBlocks.first().addClass('active').find('.menu')
399      if (firstTabContent.length === 0) firstTabContent = $footifyBlocks.first().find('.field--name-body')
400
401      $('.region-footify-submenu').append(firstTabContent.clone())*/
402
403
404      $footifyBlocks.each((index, block) => {
405        $(block).on('click', (event) => {
406
407          const isAlreadyActive = event.currentTarget.classList.contains('active')
408
409          $footifyBlocks.each((index, block) => {
410            $(block).removeClass('active')
411          })
412          if (!isAlreadyActive) $(block).addClass('active')
413
414          let menu = $('.menu', block).clone();
415          if (menu.length === 0) menu = $('.field--name-body', block).clone();
416
417          $('.region-footify-submenu').empty()
418          $('.region-footify-submenu').append(menu)
419
420        });
421      })
422    }
423  }
424
425})(jQuery, Drupal, once);

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.