PageSourceSearch

https://alice.ash-berlin.eu/_assets/b64d04ecd5d9c128a9fc8b46089395df/JavaScript/site-helpers.js?1782888913

js ash-berlin.eu collected 2026-09-24 21:13:43 UTC 10,864 bytes, 381 lines download raw bytes

1// TYPO3-spam-protection
2(function() {
3  /**
4   * @param {Function} callback
5   */
6  function ready(callback) {
7    if (document.readyState === 'complete') {
8      callback.call(null);
9      return;
10    }
11    var clearListeners = function() {
12      window.removeEventListener('load', delegate);
13      document.removeEventListener('DOMContentLoaded', delegate);
14    };
15    var delegate = function() {
16      clearListeners();
17      callback.call(null);
18    };
19    window.addEventListener('load', delegate);
20    document.addEventListener('DOMContentLoaded', delegate);
21  }
22  /**
23   * Decoding helper function
24   *
25   * @param {number} charCode
26   * @param {number} start
27   * @param {number} end
28   * @param {number} offset
29   * @return {string}
30   */
31  function decryptCharcode(charCode, start, end, offset) {
32    charCode = charCode + offset;
33    if (offset > 0 && charCode > end) {
34      charCode = start + (charCode - end - 1);
35    } else if (offset < 0 && charCode < start) {
36      charCode = end - (start - charCode - 1);
37    }
38    return String.fromCharCode(charCode);
39  }
40  /**
41   * Decodes string
42   *
43   * @param {string} value
44   * @param {number} offset
45   * @return {string}
46   */
47  function decryptString(value, offset) {
48    var result = '';
49    for (var i=0; i < value.length; i++) {
50      var charCode = value.charCodeAt(i);
51      if (charCode >= 0x2B && charCode <= 0x3A) {
52        result += decryptCharcode(charCode,0x2B,0x3A,offset); /* 0-9 . , - + / : */
53      } else if (charCode >
53= 0x40 && charCode <= 0x5A) {
54        result += decryptCharcode(charCode,0x40,0x5A,offset); /* A-Z @ */
55      } else if (charCode >= 0x61 && charCode <= 0x7A) {
56        result += decryptCharcode(charCode,0x61,0x7A,offset); /* a-z */
57      } else {
58        result += value.charAt(i);
59      }
60    }
61    return result;
62  }
63
64  /**
65   * Opens URL in new window.
66   *
67   * @param {string} url
68   * @param {string|null} target
69   * @param {string|null} features
70   * @return {Window}
71   */
72  function windowOpen(url, target, features) {
73    var windowRef = window.open(url, target, features);
74    if (windowRef) {
75      windowRef.focus();
76    }
77    return windowRef;
78  }
79
80  // @deprecated Will be removed in TYPO3 v12.0
81  if (typeof window['linkTo_UnCryptMailto'] === 'undefined') {
82    window['linkTo_UnCryptMailto'] = function(value, offset) {
83      console.warn('Function linkTo_UnCryptMailto() is deprecated and will be remove in TYPO3 v12.0');
84      if (value && offset) {
85        document.location.href = decryptString(value, offset);
86      }
87    };
88  }
89
90  ready(function() {
91    var mailtoElements = document.querySelectorAll('a[data-mailto-token][data-mailto-vector]');
92    // `Array.from` for IE compatibility
93    Array.from(mailtoElements).forEach(function(element) {
94        element.addEventListener('click', function(evt) {
95          evt.preventDefault();
96          var dataset = evt.currentTarget.dataset;
97          var value = dataset.mailtoToken;
98          var offset = parseInt(dataset.mailtoVector, 10) * -1;
99          document.location.href = decryptString(value, offset);
100        });
101      });
102    var openElements = document.querySelectorAll('a[data-window-url]');
103    // `Array.from` for IE compatibility
104    Array.from(openElements).forEach(function(element) {
105        element.addEventListener('click', function(evt) {
106          evt.preventDefault();
107          var dataset = evt.currentTarget.dataset;
108          var url = dataset.windowUrl;
109          var target = dataset.windowTarget || null;
110          var features = dataset.windowFeatures || null;
111          windowOpen(url, target, features);
112        });
113      });
114  });
115})();
116
117
118var menuOpen = 0;
119// --------------------------------------------
120// Shuffle-Elements-Plugin
121// --------------------------------------------
122
123(function($){
124 
125    $.fn.shuffle = function() {
126 
127        var allElems = this.get(),
128            getRandom = function(max) {
129                return Math.floor(Math.random() * max);
130            },
131            shuffled = $.map(allElems, function(){
132                var random = getRandom(allElems.length),
133                    randEl = $(allElems[random]).clone(true)[0];
134                allElems.splice(random, 1);
135                return randEl;
136           });
137 
138        this.each(function(i){
139            $(this).replaceWith($(shuffled[i]));
140        });
141 
142        return $(shuffled);
143 
144    };
145 
146})(jQuery);
147
148// some actions on esc down
149$( document ).on("keydown", function ( e ) {
150     if ( e.keyCode === 27 ) { // ESC
151          // parent.jQuery.fancybox.getInstance().close();
152          if (menuOpen == 1) {
153              $("body").removeClass('overlay-nav-open');
154              $("body > div, body > nav").attr('aria-hidden', 'false');
155              $(".overlay-nav-toggle.open-menu").first().focus();
156              menuOpen = 0;
157          }
158
159          // stop slick slider's autoplay
160          $('.slick-slider').slick('slickPause');
161
162     }
163});
164
165
166$(function(){
167  $(document).on("click", ".ke_search-filter-optionlist p.filter-option",function(){
168    var id = $(this).attr("data-checkboxId");
169    $('#'+id).prop( "checked", false );
170    $('#button_'+id).remove();
171    $(".degree_program").submit();
172  });
173});
174
175
176// --------------------------------------------
177// READY
178// --------------------------------------------
179
180$(document).ready(function(){
181
182
183
184
185
186// --------------------------------------------
187// fancy checkboxes for ke_search
188// --------------------------------------------
189
190  /*  start search on change */
191$('.degree_program .dropdown-menu').change(function() {
192   $('.degree_program').submit();
193});
194  
195
196$('.ke_search-checkbox-group label').on('click', function() {
197  var element = $(this);
198  var title = element.attr('data-title');
199  var id = element.attr('data-id');
200  var filterid = element.attr('data-filterId');
201
202  if ($('#'+id).is(':checked')) {
203    $('#button_'+id).remove();
204    $(".degree_program").submit();
205  } else {
206     var html = '<p id="button_'+id+'" class="filter-option" data-checkboxId="'+id+'"><span class="remove-circle"></span>' + title + '</p>';
207     $('.ke_search-filter-optionlist').prepend(html);
208  }
209
210});
211
212$('.remove-filters').on('click', function() {
213  $('.filter-option').remove();
214  $('.ke_search-checkbox-group input').prop( "checked", false );
215  $('.degree_program').submit();
216});
217
218const players = Plyr.setup('video, audio');
219
220$(".page-list-wrap p").click(function (){
221  $(this).parent().toggleClass("open");
222});
223
224
225
226// --------------------------------------------
227// Main-menu and Search
228// --------------------------------------------
229
230$(".open-menu").click(function (){
231  menuOpen = 1;
232  $("body").addClass("overlay-nav-open");
233  $("body > div, body > nav").attr('aria-hidden', 'true');
234  $("#main-menu a").first().focus();
235  $(".overlay-nav").attr('aria-hidden', 'false').scrollTop(0);
236});
237$(".close-menu").click(function (){
238  $("body").removeClass("overlay-nav-open");
239  $("body > div, body > nav").attr('aria-hidden', 'false');
240  $(".overlay-nav-toggle.open-menu").first().focus();
241    menuOpen = 0;
242});
243
244$(".overlay-search-open").click(function (){
245  menuOpen = 1;
246  $("body").addClass("overlay-nav-open");
247  $("body > div, body > nav").attr('aria-hidden', 'true');
248  $("#ke_search_searchfield_sword").focus();
249  $(".overlay-nav").attr('aria-hidden', 'false').scrollTop(0);
250});
251// Circle focus in menu
252$(".tabListLastEl").keydown(function(e){
253  if (e.shiftKey && e.which == 9) {
254
255  }
256  else if (e.which == 9) {
257    $(".tabListFirstEl").focus();
258    e.preventDefault(); 
259  }
260});
261
262$(".tabListFirstEl").keydown(function(e){
263  if (e.shiftKey && e.which == 9) {
264    $(".tabListLastEl").focus();
265    e.preventDefault(); 
266  }
267});
268
269// --------------------------------------------
270// cat-select in ke_search
271// --------------------------------------------
272$(".result-filter-list button").click(function(){ 
273  $(".result-filter-list input:checkbox").removeAttr('checked');
274  $(".result-filter-list #"+$(this).attr("data-field-id")).prop('checked',true);
275  $("#form_kesearch_pi1").submit();
276});
277
278
279// --------------------------------------------
280// Grid-lightbox
281// --------------------------------------------
282
283$(".gridLightbox button.close, .gridLightbox .modal-footer button").click(function(e){
284  if ($(".gridLightbox").attr("data-gridLightbox-show") == "oneTime") {
285    var cookieName = "lightbox"+$(this).attr("data-gridLightbox");
286    $.cookie(cookieName, "seen", { expires: 86400000 }); 
287  }
288});
289
290function openLightbox () {
291  var seen = $.cookie("lightbox"+$(".gridLightbox").attr("data-gridLightbox"));
292  var beUser = $.cookie("be_typo_user");
293  
294$(".modal").each(function(index){
295    if ( (( typeof seen == "undefined" || typeof beUser != "undefined") || ($(this).attr("data-gridLightbox-show") == "everyTime")) && ($(this).attr("data-gridLightbox-show") != "hidden") ){
296      $(this).modal('show');
297    }
298  });
299}
300openLightbox();
301
302// --------------------------------------------
303// Maps
304// --------------------------------------------
305// scroll-scale is disabled for iframes by css to prevent broken scolling in google-maps. Here we reactivate the click-event in Maps 
306$(".maps").click(function () {
307    $(".maps iframe").css("pointer-events", "auto");
308});
309$(".tx-odsosm-pi1").click(function () {
310    $("div").css("pointer-events", "auto");
311});
312
313
314
315/* start slick */
316$('.slick-slider, .slick-slider-nav').slick({
317});
318/* stop all slicks */
319$('.slick-pause').click(function(){ 
320  $('.slick-slider').slick('slickPause');
321});
322
323// $(".slick-slider-wrap .slick-list" ).focusin(function(){
324//   var el = $(".slick-slider-wrap");
325//   //$(this);
326//   el.find(".slick-pause").removeClass("hidden");
327//   el.find(".hint").removeClass("hidden");
328// });
329
330
331
332$( '[data-fancybox], .video-preview figure > a,.link-iframe-lightbox, .btn-iframe-lightbox, .link-iframe-lightbox, .btn-iframe-lightbox' ).fancybox({
333  buttons : [
334      'fullScreen',
335      'close'
336  ],
337  lang : $("html").attr("lang"),
338  idleTime: 0,
339  afterShow : function( instance, current ) {
340    instance.focus();
341  }  
342});
343
344
345// --------------------------------------------
346// gridModal
347// --------------------------------------------
348$(".gridModalTrigger").click(function(e){
349  e.preventDefault();
350  var modalId = $(this).attr("data-gridModal");
351  $("#Modal"+modalId).modal();
352});
353
354
355// --------------------
356// gridAccordion
357// --------------------
358$(".gridAccordionHeader").click(function(){
359  var el = $(this);
360  el.parent().toggleClass("open");
361  if (el.attr('aria-expanded') == 'false') {
362      el.attr('aria-expanded','true');
363    } else {
364      el.attr('aria-expanded','false');
365    }
366});  
367
368
369// --------------------
370// alice-rubric-nav
371// --------------------
372$(".menu-alice button").click(function(){
373  $(this).parent().find("ul").toggle();
374});
375
376
377// --------------------------------------------
378// END jquery.onload
379// --------------------------------------------
380
381});

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.