PageSourceSearch

https://www.wilhelmshaven.de/res/js/functions.js?m=1602173515

js wilhelmshaven.de collected 2026-09-24 21:06:11 UTC 7,907 bytes, 240 lines download raw bytes

1/* On DOM ready */
2$(function(){
3
4  $("body").addClass("js");
5
6  /* Sidebar vorbereiten */
7  $("#innerBody").wrap('<div id="bodyWrap" />').parent().before( $("#sidebar") );
8
9  /* Desktop Hauptnavigation */
10  $("nav > ul > li").mouseenter(function(){
11    if(!isMobile()) {
12      //var h = $(this).attr("data-current","").find("> ul").innerHeight() - 150;
13var h = $(this).attr("data-current","").find("> ul").innerHeight() - 95;
14      if(h<0) { h = 0; }
15      $("header").css("margin-bottom", h);
16      //$("#skyline").css("top", h+160);
17$("#skyline").css("top", h+110);
18    }
19    $("nav form").removeAttr("data-hasFocus").find("input[type='text']").blur();
20  }).mouseleave(function(){
21    if(!isMobile()) {
22      $("header").css("margin-bottom", 0);
23      //$("#skyline").css("top", 160);
24$("#skyline").css("top", 110);
25      $(this).removeAttr("data-current");
26    }
27  });
28  $("nav").mouseenter(function(){
29    $(this).attr("data-active", "");
30  }).mouseleave(function(){
31    $(this).removeAttr("data-active");
32  });
33
34  /* Mobile Hauptnavigation */
35  $("nav > a:first").click(function(){
36    if(!$("nav").hasClass("mobileOpen")) {
37      $("nav").addClass("mobileOpen").removeClass("mobileClose");
38    } else {
39      $("nav").removeClass("mobileOpen").addClass("mobileClose");
40    }
41    return false;
42  });
43  $("nav > ul > li > span, nav > ul > li > ul > li > a").click(function(){
44    if(isMobile()) {
45      if(!$(this).parent().hasClass("mobileOpen")) {
46        $(this).parent().addClass("mobileOpen").removeClass("mobileClose");
47      } else {
48        $(this).parent().removeClass("mobileOpen").addClass("mobileClose");
49      }
50      return false;
51    }
52  });
53
54  /* Volltextsuche */
55  $("nav form input[type='submit']").click(function(){
56    if(isMobile()) {
57      if(!$(this).parent().hasClass("mobileOpen")) {
58        $(this).parent().addClass("mobileOpen"); /* Mobil: Einblenen */
59        $("nav form input[type='text']").focus();
60        return false;
61      } else {
62        if($("nav form input[type='text']").val()=="") {
63          $(this).parent().removeClass("mobileOpen"); /* Mobil: Ausblenden */
64          return false;
65        }
66      }
67    } else {
68      if($("nav form input[type='text']").val()=="") {
69        $("nav form input[type='text']").focus(); /* Desktop: Focus auf Textfeld */
70        return false;
71      }
72    }
73  }).prev("input[type='text']").focus(function(){
74    $(this).parent().attr("data-hasFocus","");
75  }).blur(function(){
76    $(this).parent().removeAttr("data-hasFocus");
77  });
78
79  /* Carouselteaser */
80  if($(".carousel").length && $(".carousel .item").length>1) {
81    window.carouselTimer = window.setTimeout("carouselFindNext()", 6000);
82    $(".carousel .selectors span").click(function(){
83      if(!$(this).is($(".carousel .selectors span[data-current]"))) {
84        window.clearTimeout(carouselTimer);
85        window.carouselTimer = window.setTimeout("carouselFindNext()", 15000);
86        var n = $(".carousel .item:nth-child(" + ($(this).index()+1) + ")");
87        carouselChange(n);
88      }
89    });
90  }
91
92  /* Themenbox */
93  if($(".topicBox").length) {
94    $(".topicBox .tabs a").click(function(){
95      $(this).parent().attr("data-current","").parent().find("li[data-current]").not($(this).parent()).removeAttr("data-current");
96      $(this).parent().parent().parent().find("> div[data-current]").removeAttr("data-current").parent().find("> div[data-child='" + $(this).parent().attr("data-child") + "']").attr("data-current","");
97      return false;
98    });
99  }
100
101  /* Filterfunktionen ein- und ausblenden */
102  $("a.filterFormSwitch").click(function(){
103    $(this).toggleClass("isActive");
104    return false;
105  });
106
107  /* Zum Seitenanfang */
108  $("footer .toTop").click(function(){
109    $("html, body").animate({scrollTop:0}, 500);
110    return false;
111  });
112
113  /* Skyline gesondert scrollen */
114  if($("#skyline").length) {
115    $(document).scroll(function() {
116      $("#skyline").css("margin-top", $(this).scrollTop() / 3);
117    });
118  }
119	
120	/* Kontrast aktivieren */
121	$(".contrast").click(function(){
122		$("body").toggleClass("highcontrast");
123		checkCookie('contrast', 'normal', 'high');
124		return false;
125	});
126	if( getCookie('contrast') == 'high' ){ $("body").toggleClass("highcontrast"); }
127	
128	/* Schriftgröße aktivieren */
129	$(".fontSize").click(function(){
130		checkCookie('fontSize', 'normal', 'large');
131		return false;
132	});
133	
134	/*Ansprechpartner Toogle Funktion*/
135  if($('.anprechpartnerToggle').length) {
136		$('.anprechpartnerToggle').click(function(e){
137			e.preventDefault();
138			$('+ .ansprechpartnerBox', this).slideToggle(300);
139			$('+ .ansprechpartnerBox', this).find(".ansprechpartnerImage").toggle(450);
140			$(this).find("img").toggle(300);
141		});
142	}
143	
144	/*if($('.anprechpartnerToggle').length) {*/
145		 /* Mailing-Links setzen */
146		$("span[data-mailfirst]").each(function(){
147			var mail = $(this).attr("data-mailfirst") + '@' + $(this).attr("data-mailsecond");
148			$(this).html('<a href="mai' + 'lto:' + mail + '" title="E-Mail schreiben">' + mail + '</a>');
149		}); 
150	/*}*/
151
152});
153
154/* Carousel: Automatisch zum naechsten Element wechseln */
155function carouselFindNext() {
156  /* Nur bei hoeheren Aufloesungen und wenn Carousel im Sichtfeld ist */
157  if(!isMobile() && $(window).scrollTop()<=$(".carousel").offset().top+30) {
158    if($(".carousel .item[data-current]").next(".item").length) {
159      var n = $(".carousel .item[data-current]").next(".item");
160    } else {
161      var n = $(".carousel .item:first");
162    }
163    carouselChange(n);
164  }
165  window.carouselTimer = window.setTimeout("carouselFindNext()", 6000);
166}
167
168/* Carousel: Animation zum naechsten Element */
169function carouselChange(n) {
170  $(".carousel .selectors span[data-current]").removeAttr("data-current");
171  $(".carousel .selectors span:nth-child(" + ($(n).index()+1) + ")").attr("data-current","");
172  var h = $(n).attr("data-next", "").innerHeight();
173  $(".carousel").attr("data-isChanging", "").stop(true).animate({height:h}, 600, function(){
174    $(this).removeAttr("style").removeAttr("data-isChanging");
175  });
176  $(".carousel .item[data-current]").fadeOut(600, function(){ $(this).removeAttr("data-current").removeAttr("style"); });
177  $(".carousel .item[data-next]").fadeIn(600, function(){ $(this).attr("data-current","").removeAttr("data-next").removeAttr("style"); });
178}
179
180function isMobile() {
181  return $("nav > a:first").is(":visible");
182}
183
184function setCookie(cname, cvalue, exdays) {
185  var d = new Date();
186  d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
187  var expires = "expires="+d.toUTCString();
188  document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
189}
190
191function getCookie(cname) {
192  var name = cname + "=";
193  var ca = document.cookie.split(';');
194  for(var i = 0; i < ca.length; i++) {
195    var c = ca[i];
196    while (c.charAt(0) == ' ') {
197      c = c.substring(1);
198    }
199    if (c.indexOf(name) == 0) {
200      return c.substring(name.length, c.length);
201    }
202  }
203  return "";
204}
205
206function checkCookie(ctype, optionA, optionB) {
207  var tname = getCookie(ctype);
208  if (tname != optionA) {
209    setCookie(ctype, optionA, 365);
210		console.log(optionA);
211  } else {
212    setCookie(ctype, optionB, 365);
213		console.log(optionB);
214  }
215}
216
217$(function() {
218	// Element macht EINEN Seitwärtsschritt nach links im DOM-Baum
219	// Verwendung: Füge .col-md-moveup hinzu
220	if ( $('.col-md-moveup').length ) {
221		var w = window,
222				e = document.documentElement,
223				g = document.getElementsByTagName('body')[0];
224		$(window).resize(function() {
225			var x = w.innerWidth || e.clientWidth || g.clientWidth;
226			if (x < 992) {
227				$('.col-md-movedown').each(function(){
228					$(this).insertAfter($(this).next());
229					$(this).removeClass('col-md-movedown').addClass('col-md-moveup');
230				});
231			}
232			else if (x >= 992) {
233				$('.col-md-moveup').each(function(){
234					$(this).insertBefore($(this).prev());
235					$(this).removeClass('col-md-moveup').addClass('col-md-movedown');
236				});
237			}
238		}).trigger('resize');
239	}
240});

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.