PageSourceSearch

https://www.planegg.de/_Resources/Static/Packages/DigiPublica.Plat…/Frontend/JavaScript/main.js?bust=419b09c4

js planegg.de collected 2026-10-02 16:45:17 UTC 17,570 bytes, 492 lines download raw bytes

1
2/*
3                    _           _     
4   ____ ___  ____ _(_)___      (_)____
5  / __ `__ \/ __ `/ / __ \    / / ___/
6 / / / / / / /_/ / / / / /   / (__  ) 
7/_/ /_/ /_/\__,_/_/_/ /_(_)_/ /____/  
8                         /___/        
9*/
10
11/* -----------------------------------------------
12ACCESSIBILITY
13----------------------------------------------- */
14
15$( ".accessibility-toggle" ).click(function() {
16  $(this).toggleClass("active");
17  $(".accessibility-content").toggleClass("show");
18});
19
20/* -----------------------------------------------
21SEARCH
22----------------------------------------------- */
23
24$( ".search > .search-toggle" ).click(function() {
25  $("#search-form").show(250).addClass("show");
26  $("header .search input").focus();
27});
28$( ".search button + .search-toggle" ).click(function() {
29  $("#search-form").hide(250).removeClass("show");
30});
31
32/* -----------------------------------------------
33SEARCH PAGINATION
34----------------------------------------------- */
35
36$( ".search-results .current" ).prev().addClass("before-current");
37$( ".search-results .current" ).next().addClass("after-current");
38
39/* -----------------------------------------------
40STICKY
41----------------------------------------------- */
42
43$(window).scroll(function() {
44  var height = $(window).scrollTop();
45  if ($(this).scrollTop() > 1) {
46    $("body").addClass("scrolled");
47    $("header").addClass("is-sticky");
48  }
49  else{
50    $("body").removeClass("scrolled");
51    $("header").removeClass("is-sticky");
52  }
53}); 
54
55/* -----------------------------------------------
56OFFCANVAS-TOGGLE
57----------------------------------------------- */
58
59$(document).ready(function(){
60  $(".offcanvas-toggle").click(function(){
61    $("body").toggleClass("noscroll");
62    $(".offcanvas").toggleClass("is-active");
63    $(this).toggleClass("is-active");
64  });
65});
66
67/* -----------------------------------------------
68OFFCANVAS-SUBMENU
69----------------------------------------------- */
70
71$(document).ready(function(){
72  var curlevel = $(".offcanvas .navigation-item--state-current").parent().attr("data-level");
73  if (curlevel === undefined) { /* IF NAVIGATION IS HIDDEN, GO TO ROOT */
74    var curlevel = 1;
75    $(".offcanvas").attr("data-level-current", curlevel);
76  } else { /* IF CURRENT NAVIGATION IS SET */
77    var curlevel = parseInt(curlevel);
78    $(".offcanvas").attr("data-level-current", curlevel);
79  }
80
81  $(".offcanvas .navigation-item--state-current").parents("ul").addClass("active");
82
83  function decrease_level(size) {
84      var curlevel_decrease = curlevel--;
85      $(".offcanvas").attr("data-level-current", curlevel);
86  }
87
88  function increase_level(size) {
89      var curlevel_increase = curlevel++;
90      $(".offcanvas").attr("data-level-current", curlevel);
91  }
92
93  $(".offcanvas .close-submenu, .offcanvas .previous-navigation").click(function(){
94    decrease_level();
95    $(this).parent().parent().removeClass("active");
96    $('.offcanvas').scrollTop(0);
97  });
98
99  $(".offcanvas .open-submenu").click(function(){
100    increase_level();
101    $(this).next().addClass("active");
102    $('.offcanvas').scrollTop(0);
103  });
104});
105
106/* -----------------------------------------------
107MAIN-MENU
108----------------------------------------------- */
109
110$(document).ready(function(){
111    $('.navigation-item--level-1').on('mouseover', function() {
112        if ($(this).children(".navigation-level--level-2").length) {
113            $(this).addClass('hover');
114        }  
115    });
116    $('.navigation-item--level-1').on('mouseleave', function() {
117        if ($(this).children(".navigation-level--level-2").length) {
118            $(this).removeClass('hover');
119        }
120    });
121});
122
123/* -----------------------------------------------
124SIDEBAR-SUBMENU
125----------------------------------------------- */
126
127$(document).ready(function(){
128  $(".navigation-sidebar .open-submenu").click(function(){
129    $(this).next().next("ul").toggleClass("active").slideToggle("fast");
130    $(this).parent("li").toggleClass("active");
131  });
132  $(".navigation-sidebar .navigation-item").each(function(){
133    if($(this).hasClass("navigation-item--state-active")) {
134        $(this).addClass("active").css("display", "block");
135        $(this).children("ul").addClass("active").show(0);
136    }
137  });
138});
139
140/* -----------------------------------------------
141FORMS
142----------------------------------------------- */
143
144$(document).ready(function() {
145    $('form input').focus(function(){
146        $(this).parents('.clearfix').addClass('focused');
147    });
148
149    $('form select').focus(function(){
150        $(this).parents('.clearfix').addClass('focused');
151    });
152
153    $('form textarea').focus(function(){
154        $(this).parents('.clearfix').addClass('focused');
155    });
156
157    $('input[type="date"]').focus(function(){
158        $(this).parents('.clearfix').addClass('focused');
159    });
160
161    $('input[id="termineingabe-form-start-stunde"], input[id="termineingabe-form-start-minute"], input[id="termineingabe-form-ende-stunde"], input[id="termineingabe-form-ende-minute"]').focus(function(){
162        $(this).parents('.clearfix').addClass('focused');
163    });
164
165    $('input[type="checkbox"]').focus(function(){
166        $(this).parents('.clearfix').addClass('focused');
167    });
168
169    $('input[type="radio"]').focus(function(){
170        $(this).parents('.clearfix').addClass('focused');
171    });
172
173    $('form input').blur(function(){
174        var inputValue = $(this).val();
175        if (inputValue == "") {
176            $(this).parents('.clearfix').removeClass('filled');
177            $(this).parents('.clearfix').removeClass('focused');
178        } else {
179            $(this).parents('.clearfix').addClass('filled');
180            $(this).parents('.clearfix').removeClass('focused');
181            $(this).parents('.clearfix').removeClass('error');
182            $(this).parents('.clearfix').find(".help-inline").remove();
183        }
184    });
185
186    $('form select').blur(function(){
187        var inputValue = $(this).val();
188        if (inputValue == "") {
189            $(this).parents('.clearfix').removeClass('filled');
190            $(this).parents('.clearfix').removeClass('focused');
191        } else {
192            $(this).parents('.clearfix').addClass('filled');
193            $(this).parents('.clearfix').removeClass('error');
194            $(this).parents('.clearfix').find(".help-inline").remove();
195        }
196    });    
197
198    $('form textarea').blur(function(){
199        var inputValue = $(this).val();
200        if (inputValue == "") {
201            $(this).parents('.clearfix').removeClass('filled');
202            $(this).parents('.clearfix').removeClass('focused');
203        } else {
204            $(this).parents('.clearfix').addClass('filled');
205            $(this).parents('.clearfix').removeClass('error');
206            $(this).parents('.clearfix').find(".help-inline").remove();
207        }
208    });
209
210    $('input[type="date"]').blur(function(){
211        var inputValue = $(this).val();
212        if (inputValue == "") {
213            $(this).parents('.clearfix').removeClass('filled');
214            $(this).parents('.clearfix').removeClass('focused');
215        } else {
216            $(this).parents('.clearfix').addClass('filled');
217            $(this).parents('.clearfix').removeClass('error');
218            $(this).parents('.clearfix').find(".help-inline").remove();
219        }
220    });
221
222    $('input[id="termineingabe-form-start-stunde"], input[id="termineingabe-form-start-minute"], input[id="termineingabe-form-ende-stunde"], input[id="termineingabe-form-ende-minute"]').blur(function(){
223        var inputValue = $(this).val();
224        if (inputValue == "") {
225            $(this).parents('.clearfix').removeClass('filled');
226            $(this).parents('.clearfix').removeClass('focused');
227        } else {
228            $(this).parents('.clearfix').addClass('filled');
229            $(this).parents('.clearfix').removeClass('error');
230            $(this).parents('.clearfix').find(".help-inline").remove();
231        }
232    });
233
234    $('input[type="checkbox"]').blur(function(){
235        if($(this).is(":checked")) {
236            $(this).parents('.clearfix').addClass("filled");
237        } else {
238            $(this).parents('.clearfix').removeClass('focused');
239            $(this).parents('.clearfix').removeClass("filled");
240            $(this).parents('.clearfix').removeClass('error');
241            $(this).parents('.clearfix').find(".help-inline").remove();
242        }
243    });
244
245    $('input[type="radio"]').blur(function(){
246        if($(this).is(":checked")) {
247            $(this).parents('.clearfix').addClass("filled");
248        } else {
249            $(this).parents('.clearfix').removeClass('focused');
250            $(this).parents('.clearfix').removeClass("filled");
251            $(this).parents('.clearfix').removeClass('error');
252            $(this).parents('.clearfix').find(".help-inline").remove();
253        }
254    });
255
256    $('form input').each(function() {
257        var inputValue = $(this).val();
258        if (!inputValue == "") {
259            $(this).parents('.clearfix').removeClass('focused');
260            $(this).parents('.clearfix').addClass('filled');
261        }
262    });
263
264    $('form select').each(function() {
265        var inputValue = $(this).val();
266        if (!inputValue == "") {
267            $(this).parents('.clearfix').removeClass('focused');
268            $(this).parents('.clearfix').addClass('filled');
269        }
270    });    
271
272    $('form textarea').each(function() {
273        var inputValue = $(this).val();
274        if (!inputValue == "") {
275            $(this).parents('.clearfix').removeClass('focused');
276            $(this).parents('.clearfix').addClass('filled');
277        }
278    });
279
280    $('input[type="date"]').each(function() {
281        var inputValue = $(this).val();
282        if (inputValue == "") {
283            $(this).parents('.clearfix').removeClass('focused');
284            $(this).parents('.clearfix').removeClass('filled');
285        } else {
286            $(this).parents('.clearfix').removeClass('focused');
287            $(this).parents('.clearfix').addClass('filled');
288        }
289    });
290
291    $('input[id="termineingabe-form-start-stunde"], input[id="termineingabe-form-start-minute"], input[id="termineingabe-form-ende-stunde"], input[id="termineingabe-form-ende-minute"]').each(function() {
292        var inputValue = $(this).val();
293        if (inputValue == "") {
294            $(this).parents('.clearfix').removeClass('focused');
295            $(this).parents('.clearfix').removeClass('filled');
296        } else {
297            $(this).parents('.clearfix').removeClass('focused');
298            $(this).parents('.clearfix').addClass('filled');
299        }
300    });
301
302    $('input[type="checkbox"]').each(function() {
303        if($(this).is(":checked")) {
304            $(this).parents('.clearfix').removeClass('focused');
305            $(this).parents('.clearfix').addClass("filled");
306        } else {
307            $(this).parents('.clearfix').removeClass('focused');
308            $(this).parents('.clearfix').removeClass("filled");
309        }
310    });
311
312    $('input[type="radio"]').each(function() {
313        if($(this).is(":checked")) {
314            $(this).parents('.clearfix').removeClass('focused');
315            $(this).parents('.clearfix').addClass("filled");
316        } else {
317            $(this).parents('.clearfix').removeClass('focused');
318            $(this).parents('.clearfix').removeClass("filled");
319        }
320    });
321});
322
323/* -----------------------------------------------
324FORM AUTOCOMPLETE
325----------------------------------------------- */
326
327$(document).ready(function() {
328  $(".clearfix input").each(function(index, value) {
329    var autocomplete = $(value).attr('name').split('[').pop().replace(']', '');
330    if (autocomplete == 'honorific-prefix' || autocomplete == 'name' || autocomplete == 'fam
330ily-name' ||
331        autocomplete == 'given-name' || autocomplete == 'address-line1' || autocomplete == 'address-level2' ||
332        autocomplete == 'address-line2' || autocomplete == 'tel' || autocomplete == 'email' || 
333        autocomplete == 'organization' || autocomplete == 'street-address' || autocomplete == 'postal-code') {
334      $(this).attr("autocomplete", autocomplete);
335    }
336  });
337});  
338
339/* 
340* function sets the autocomplete attribute to form fields
341* currently works only on specific form fields
342* needs jquery
343* 
344* Anrede - autocomplete="honorific-prefix" - nicht berücksichtigt!!
345* Vorname, Name - autocomplete="name"
346* Name - autocomplete="family-name"
347* Vorname - autocomplete="given-name"
348* Straße, Nr. - autocomplete="address-line1"
349* Strasse - autocomplete="address-line1"
350* Ort - autocomplete="address-level2"
351* PLZ / Ort  - autocomplete="address-line2"
352* Telefon - autocomplete="tel-national"
353* E-Mail - autocomplete="email"
354* Firma - autocomplete="organization"
355*/
356
357// Suche nach Label i. e. "Vorname, Name"
358// for-attribute of label is id of the element that gets the autocomplete attribute 
359
360/* -----------------------------------------------
361FORM POLICY
362----------------------------------------------- */
363
364$(".clearfix:contains('Datenschutzhinweis')").html(function(_, html) {
365    var attr = $("footer").find("a:contains('Datenschutz')").attr("href");
366    return html.replace(/(Datenschutzhinweis)/g, '<a target="_blank" href="' + attr + '">$1</a>');
367});
368
369$(".clearfix:contains('Datenschutzerklärung')").html(function(_, html) {
370  var attr = $("footer").find("a:contains('Datenschutz')").attr("href");
371    return html.replace(/(Datenschutzerklärung)/g, '<a target="_blank" href="' + attr + '">$1</a>');
372});
373
374/* -----------------------------------------------
375DARKMODE
376----------------------------------------------- */
377
378function setDarkmodeCookie(name,value,days) {
379    var expires = "";
380    if (days) {
381        var date = new Date();
382        date.setTime(date.getTime() + (days*24*60*60*1000));
383        expires = "; expires=" + date.toUTCString();
384    }
385    document.cookie = name + "=" + (value || "")  + expires + "; path=/";
386}
387
388function getDarkmodeCookie(name) {
389    var nameEQ = name + "=";
390    var ca = document.cookie.split(';');
391    // the following code allows multiple cookie values and splits them apart
392    for(var i=0;i < ca.length;i++) {
393        var c = ca[i];
394        while (c.charAt(0)==' ') c = c.substring(1,c.length);
395        if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
396    }
397    return null;
398}
399
400function eraseDarkmodeCookie(name) {   
401    document.cookie = name+'=; Max-Age=-99999999;';  
402}
403
404function enableDarkMode() {
405    $( "body" ).addClass( "dark" );
406    setDarkmodeCookie('Accessibility: Darkmode',"on",7);
407}
408
409function disableDarkMode() {
410  $( "body" ).removeClass( "dark" );
411  setDarkmodeCookie('Accessibility: Darkmode',"off",7);
412}
413
414$( ".change-contrast" ).on("click", function() {
415    if( $( "body" ).hasClass( "dark" )) {
416      disableDarkMode();
417    } else {
418      enableDarkMode();
419    }
420});
421
422document.addEventListener("DOMContentLoaded", function(){
423  var darkmode = getDarkmodeCookie('Accessibility: Darkmode');
424  if (darkmode == "on") {
425      // use darkmode
426      enableDarkMode();
427  } else {
428      // no darkmode
429      disableDarkMode();
430  }
431});
432
433// -----------------------------------------------------------------------------
434// Filter Documents with INPUT TEXT
435// -----------------------------------------------------------------------------
436
437jQuery(".document-filter").keyup(function() {
438    var keyword = jQuery(this).val().toLowerCase();
439  
440    jQuery(this).closest('.assetlist').find('li').each(function() {
441      if(jQuery(this).text().toLowerCase().indexOf(keyword) > -1) {
442        jQuery(this).fadeIn();
443      } else {
444        jQuery(this).fadeOut();
445      }
446    });
447      if(jQuery(this).val()) {
448          jQuery(this).closest('.document-keyword-filter').find('.clear').addClass('visible');
449      } else if(jQuery(this).val('')) {
450          jQuery(this).closest('.document-keyword-filter').find('.clear').removeClass('visible');
451      } else {
452          jQuery(this).closest('.document-keyword-filter').find('.clear').removeClass('visible');
453      }
454  });
455  jQuery('.clear').click(function() {
456      jQuery(this).closest('.document-keyword-filter').find('.document-filter').val('');
457      jQuery(this).removeClass('visible');
458      var keyword = jQuery(this).val().toLowerCase();
459    jQuery(this).closest('.assetlist').find('li').each(function() {
460      jQuery(this).fadeIn();
461    });
462  });
463
464  // -----------------------------------------------------------------------------
465// Filter Article Teaser with INPUT TEXT
466// -----------------------------------------------------------------------------
467
468jQuery(".article-filter").keyup(function() {
469    var keyword = jQuery(this).val().toLowerCase();
470  
471    jQuery(this).closest('.pageteaser-content').find('.pageteaser-teaser').each(function() {
472      if(jQuery(this).text().toLowerCase().indexOf(keyword) > -1) {
473        jQuery(this).fadeIn();
474      } else {
475        jQuery(this).fadeOut();
476      }
477    });
478      if(jQuery(this).val()) {
479          jQuery(this).closest('.article-keyword-filter').find('.clear').addClass('visible');
480      } else if(jQuery(this).val('')) {
481          jQuery(this).closest('.article-keyword-filter').find('.clear').removeClass('visible');
482      } else {
483          jQuery(this).closest('.article-keyword-filter').find('.clear').removeClass('visible');
484      }
485  });
486    jQuery('.article-keyword-filter .clear').click(function() {
487        jQuery(this).closest('.article-keyword-filter').find('.article-filter').val('');
488        jQuery(this).removeClass('visible');
489        jQuery(this).closest('.pageteaser-content').find('.pageteaser-teaser').each(function() {
490        jQuery(this).fadeIn();
491    });
492  });

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.