PageSourceSearch

https://xn--motstndsrrelsen-llb70a.se/?js&v=1.1.5-11

js xn--motstndsrrelsen-llb70a.se collected 2026-10-02 07:29:04 UTC 29,734 bytes, 1,018 lines download raw bytes

1var intervalMoveTargets;
2var intervalMoveSidebar;
3var header_bg_target;
4var footer_bg_target;
5var scrollDelta = 0;
6var sidebar;
7var sidebarDOM;
8var curPosState = 5;
9var sidebarPosY;
10
11// Returns a function, that, as long as it continues to be invoked, will not
12// be triggered. The function will be called after it stops being called for
13// N milliseconds. If `immediate` is passed, trigger the function on the
14// leading edge, instead of the trailing.
15function debounce(func, wait, immediate) {
16	var timeout;
17	return function() {
18		var context = this, args = arguments;
19		var later = function() {
20			timeout = null;
21			if (!immediate) func.apply(context, args);
22		};
23		var callNow = immediate && !timeout;
24		clearTimeout(timeout);
25		timeout = setTimeout(later, wait);
26		if (callNow) func.apply(context, args);
27		};
28};
29
30if (jQuery("html").width() > 782)
31{
32	var myEfficientFn = debounce(function() {
33		scrollUpdate();
34	}, 10);
35}
36
37jQuery(window).bind("scroll", myEfficientFn);
38
39var position = jQuery(window).scrollTop();
40var myEfficientFn2 = debounce(function() {
41	var scroll = jQuery(window).scrollTop();
42	if (jQuery(".show-m-slide").length > 0) {
43		return;
44	}
45	if(scroll > position) {
46		// if not near bottom
47		if (scroll + jQuery(window).height() + 50 < jQuery("html").height()) {
48			if (scroll > 100) {
49				jQuery("#page").addClass("scrolled");
50			}
51			else {
52				jQuery("#page").removeClass("scrolled");
53			}
54		}
55		else {
56			jQuery("#page").removeClass("scrolled");
57		}
58	} else {
59		if (scroll < position - 10) {
60			jQuery("#page").removeClass("scrolled");
61		}
62	}
63	position = scroll;
64}, 10);
65
66jQuery(window).scroll(myEfficientFn2);
67
68function header_bg_scroll_onload() {
69	if (jQuery("html").width() > 782)
70	{
71		sidebar = jQuery(".single #secondary");
72		sidebarDOM = document.querySelector('.single #secondary');
73		scrollUpdate();
74		setUpdateFreq(updateFreq);
75		moveSubMenus();
76	}
77}
78
79var updateFreq = 250;
80var d = new Date();
81var lastUpdateT_inMS = d.getTime();
82
83function setUpdateFreq(ms) {
84	intervalMoveTargets = setInterval(masterMover, ms);
85}
86
87function masterMover() {
88	var d = new Date();
89	moveTargets();
90	moveSidebar();
91	var diff = -lastUpdateT_inMS + d.getTime() - updateFreq;
92	if (diff < 0) {
93		// updateFreq = updateFreq + 10;
94		// setUpdateFreq(updateFreq);
95		//console.log('skipped frame');
96	}
97	lastUpdateT_inMS = d.getTime();
98}
99
100function moveSubMenus() {
101	var firstLeft = -1;
102	var curLeft;
103	var leftChange;
104	var tyrOffset;
105	
106	jQuery("#primary-menu > li > .sub-menu").each( function() {
107		
108		firstLeft = jQuery(this).closest("#primary-menu").offset().left;
109		
110		curLeft = jQuery(this).closest("li").offset().left;
111		
112		leftChange = firstLeft - curLeft;
113		
114		jQuery(this).css("left", +leftChange + "px")
115	});
116}
117
118function scrollUpdate()
119{
120	scrollUpdateBg();
121	updateSidebarPos();
122}
123
124function updateSidebarPos()
125{
126	if (sidebar == null)
127	{
128		sidebar = jQuery(".single #secondary");
129	}
130
131	if (sidebar.length != 1)
132	{
133		return;
134	}
135
136	var article = jQuery(".single #primary main");
137
138	var windowObj = jQuery(window);
139
140	if (article.height() < sidebar.height())
141	{
142		return;
143	}
144
145	var staticOffset = jQuery(".single #primary main").offset().top;
146	var bottomOfSidebar = staticOffset + sidebar.height() - windowObj.scrollTop() - windowObj.height();
147	var topOfSidebar = staticOffset - windowObj.scrollTop();
148	var windowTopvsSidebarTop = topOfSidebar;
149
150	var topOffsetFirstItem = sidebar.children(":first").offset().top - windowObj.scrollTop();
151	var bottomOffsetFirstItem = sidebar.children(":first").offset().top + sidebar.height() - windowObj.scrollTop() - windowObj.height();
152
153	var scrollPadding = 100;
154
155	scrollDelta = scrollDelta - bottomOfSidebar;
156
157	if (bottomOfSidebar < 0)
158	{
159		if (scrollDelta > 0 && bottomOffsetFirstItem < -scrollPadding)
160		{
161			// going down
162			if (article.height() - sidebar.height() + bottomOfSidebar > 0)
163			{
164                // down but not at bottom yet
165				sidebarPosY = String(-bottomOfSidebar-scrollPadding);
166				//sidebar.css("transform", "translateY(" + String(-bottomOfSidebar) + "px)");
167				// console.log("1");
168				curPosState = "1";
169			}
170			else {
171				if (curPosState != 2) {
172					sidebarPosY = String(article.height() - sidebar.height());
173
174					//sidebar.css("transform", "translateY(" + String(article.height() - sidebar.height()) + "px)");
175					// console.log("2");
176					curPosState = "2";
177				}
178			}
179		}
180		if (scrollDelta < 0 && topOffsetFirstItem > scrollPadding )
181		{
182			// going up
183			sidebarPosY = String(scrollPadding-topOfSidebar);
184
185			//sidebar.css("transform", "translateY(" + String(topScrollPadding-topOfSidebar) + "px)");
186			// console.log("3");
187			curPosState = "3";
188		}
189	}
190	if (bottomOfSidebar > 0)
191	{
192		if (scrollDelta >= 0)
193		{
194			// going down
195			/*sidebar.css("-webkit-transform", "translateY(" + String(-bottomOfSidebar) + "px)");*/
196		}
197		else {
198			// going up
199			if (scrollPadding-topOfSidebar > 0)
200			{
201				if (topOffsetFirstItem > scrollPadding)
202				{
203					sidebarPosY = String(scrollPadding-topOfSidebar);
204
205					//sidebar.css("-webkit-transform", "translateY(" + String(topScrollPadding-topOfSidebar) + "px)");
206					// console.log("4");
207					curPosState = "4";
208				}
209			}
210			else {
211				if (curPosState != 5) {
212					sidebarPosY = String(0);
213
214					//sidebar.css("-webkit-transform", "translateY(" + String(0) + "px)");
215					// console.log("5");
216					curPosState = "5";
217				}
218			}
219		}
220	}
221	scrollDelta = bottomOfSidebar;
222}
223
224function scrollUpdateBg()
225{
226	var containeR = window;
227	var containeD = document;
228
229	var scrollPercent = 70 - 100 * jQuery(containeR).scrollTop() / 250;
230	//jQuery('.header-bg').css("background-position-y", scrollPercent + "%");
231	header_bg_target = scrollPercent;
232
233	var scrollPercent = 100 - (100 + (jQuery(containeR).scrollTop() - jQuery(containeD).height() + jQuery(containeR).height()) / 500 * 70);
234	//jQuery('.footer-bg').css("background-position-y", scrollPercent + "%");
235	footer_bg_target = scrollPercent;
236}
237
238function moveSidebar() {
239	// console.log("movesidebar");
240	// ## SIDEBAR ##
241	if (jQuery(".single #secondary").length && !jQuery(".single-nasten").length)
242	{
243		sidebarDOM.style.transform = getComputedStyle(sidebarDOM).transform;
244		sidebarDOM.innerWidth;
245		sidebarDOM.style.transform = "translateY("+ String(sidebarPosY) + "px)";
246	}
247}
248
249function moveTargets() {
250
251	// ## HEADER ##
252	var cur = "" + jQuery('.header-bg').css("background-position-y");
253	cur = cur.substring(0, cur.length-1);
254	var delta = parseFloat(header_bg_target) - parseFloat(cur);
255	delta = delta / 2;
256	cur = parseFloat(cur) + delta;
257	if (cur < 0) { cur = 0; }
258	if (cur > 100) { cur = 100; }
259	jQuery('.header-bg').css("background-position-y", cur + "%");
260
261	// ## FOOTER ##
262	var cur = "" + jQuery('.footer-bg').css("background-position-y");
263	cur = cur.substring(0, cur.length-1);
264	var delta = parseFloat(footer_bg_target) - parseFloat(cur);
265	delta = delta / 1.2;
266	cur = parseFloat(cur) + delta;
267	if (cur < 0) { cur = 0; }
268	if (cur > 100) { cur = 100; }
269	//jQuery('.footer-bg').css("transform", "translateY(-"+ cur + "%)");
270	jQuery('.footer-bg').css("background-position-y", cur + "%");
271
272	// ## IMGS ##
273	jQuery(".page .wp-block-media-text figure img").each(function() {
274		if (jQuery(this).parents("noparallax").length == 1) {
275			return; //continue
276		}
277		var coord = jQuery(this).offset();
278		var distanceToTop = coord.top - jQuery(document).scrollTop();
279		var distanceTopMovable = jQuery(this).parent().height() - jQuery(this).height();
280		var viewHeight = jQuery(window).height();
281		
282		var viewportDistanceToTop = viewHeight - distanceToTop;
283		
284		var viewportpercentage = viewportDistanceToTop / (jQuery(this).parent().height() * 2);
285		
286		var topProp = (1 - viewportpercentage * 0.5) * distanceTopMovable;
287		
288		var cur = "" + jQuery(this).css("object-position");
289		cur = cur.substring(4, cur.length-2);
290		var delta = parseFloat(topProp) - parseFloat(cur);
291		delta = delta / 1.2;
292		cur = parseFloat(cur) + delta;
293		if (cur < distanceTopMovable) { cur = distanceTopMovable; }
294		if (cur > 0) { cur = 0; }
295		
296		jQuery(this).css("object-position", "50% " + cur + "px");
297	})
298}
299
300function scrollUpdatePics()
301{
302/*jQuery(".page .wp-block-media-text figure img").each(function() {
303	var coord = jQuery(this).offset();
304	var distanceToTop = coord.top - jQuery(document).scrollTop();
305	var distanceTopMovable = jQuery(this).parent().height() - jQuery(this).height();
306	var viewHeight = jQuery(window).height();
307	
308	var viewportDistanceToTop = viewHeight - distanceToTop;
309	
310	var viewportpercentage = viewportDistanceToTop / (jQuery(this).parent().height() * 2);
311	
312	var topProp = (1 - viewportpercentage * 0.8) * distanceTopMovable;
313	
314	jQuery(this).css("object-position", "50% " + topProp + "px");
315})*/
316}
317function mx_loadmore($target, $offset, $numPosts, $item) {
318	
319	jQuery($item).find("span").html("Laddar...");
320	jQuery.get( "/wp-admin/admin-ajax.php?action=orgh_more_posts&offset="+$offset+"&numPosts="+$numPosts, function(data) {
321		jQuery($target).append(data);
322		jQuery($item).parent().remove();
323	})
324	.done(function() {
325		//alert( "second success" );
326	})
327	.fail(function() {
328		//alert( "error" );
329	})
330	.always(function() {
331	});
332}
333
334function mx_lzload($item) {
335	jQuery($item).closest('article').toggleClass('loading');
336	jQuery($item).closest('article').toggleClass('loaded');
337}
338
339var loadingKamprapp = false;
340	
341function mobile_morekmprapp(f_num, f_offset)
342{
343	if (loadingKamprapp) { return; }
344	loadingKamprapp = true;
345	jQuery(".kmprapp-loadmore").text("Laddar fler...");
346
347	jQuery.ajax({
348		type: 'get',
349		url:'/wp-admin/admin-ajax.php?action=orgh_ajax_endpoint',
350		data: {type: 'kmp-rapp', offset: f_offset, num: f_num},
351		success: function (data) {
352			jQuery("#footer-content-kamprapp > aside > main > div").append(data);
353			kamprapp_offset += kamprapp_num;
354			// console.log(kamprapp_offset);
355			// console.log(kamprapp_num);
356		},
357		error: function () {
358			alert('error');
359		},
360		complete: function (data) {
361			loadingKamprapp = false;
362			jQuery(".kmprapp-loadmore").text(' ');
363			// console.log(data.responseText);
364			if (data.responseText == "")
365			{
366				jQuery(".kmprapp-loadmore").text("Det finns inga fler kamprapporter i arkivet.");
367			}
368		}
369	});
370}
371
372var kamprapp_num = undefined;
373var kamprapp_offset= undefined;
374	
375// Returns a function, that, as long as it continues to be invoked, will not
376// be triggered. The function will be called after it stops being called for
377// N milliseconds. If `immediate` is passed, trigger the function on the
378// leading edge, instead of the trailing.
379function debounce(func, wait, immediate) {
380	var timeout;
381	return function() {
382		var context = this, args = arguments;
383		var later = function() {
384			timeout = null;
385			if (!immediate) func.apply(context, args);
386		};
387		var callNow = immediate && !timeout;
388		clearTimeout(timeout);
389		timeout = setTimeout(later, wait);
390		if (callNow) func.apply(context, args);
391		};
392};
393
394var position2 = jQuery("#footer-content-kamprapp > aside").scrollTop();
395var myEfficientFn3 = debounce(function() {
396	var scroll2 = jQuery("#footer-content-kamprapp > aside").scrollTop();
397	if(scroll2 > position2) {
398		if(jQuery('#footer-content-kamprapp > aside').scrollTop() + jQuery('#footer-content-kamprapp > aside').height() + 200 > jQuery('#footer-content-kamprapp > aside > main').height()) {
399			mobile_morekmprapp(kamprapp_num, kamprapp_offset);
400		}
401	}
402	position2 = scroll2;
403}, 10);
404
405var position3 = jQuery("#footer-content-search > aside > main").scrollTop();
406var myEfficientFn4 = debounce(function() {
407	console.log('scroll');
408	var scroll3 = jQuery("#footer-content-search > aside > main").scrollTop();
409	if(scroll3 > position3) {
410		if(jQuery('#footer-content-search > aside > main').scrollTop() + jQuery('#footer-content-search > aside > main').height() + 200 > jQuery('#footer-content-search > aside > main > div').height()) {
411			addToSearch();
412			jQuery("#mobile-colophon #m-search .search-field").blur();
413		}
414	}
415	position3 = scroll3;
416}, 10);
417
418jQuery(document).ready( function() {
419	jQuery('#footer-content-search > aside > main').scroll('scroll', myEfficientFn4);
420});
421
422var intervalSearch;
423
424 function repopulateSearch() {
425	 jQuery(".search-loadmore").text('Laddar sökresultat...');
426	 var f_num = 10;
427	 var jQ_identifier = ".mobile-ajax-search-results";
428	 jQuery(jQ_identifier).html("");
429	 var f_offset = jQuery(jQ_identifier + " article").length;
430	 if (f_offset == null)
431	 {
432		 f_offset = 0;
433	 }
434	 var f_search = jQuery("#mobile-colophon #m-search .search-field").val();
435 
436	 if (f_search == "")
437	 {
438		 jQuery(".search-loadmore").text('Sök efter artiklar, sidor och kamprapporter.');
439		 return;	
440	 }
441	 
442	 jQuery.ajax({
443		 type: 'get',
444		 url:'/wp-admin/admin-ajax.php?action=orgh_ajax_endpoint',
445		 data: {type: 'search', offset: f_offset, num: f_num, s: f_search},
446		 success: function (data) {
447			 jQuery(jQ_identifier).html(data);
448		 },
449		 error: function () {
450			 alert('error');
451		 },
452		 complete: function (data) {
453			 jQuery(".search-loadmore").text(' ');
454			 if (data.responseText == "")
455			 {
456				 jQuery(".search-loadmore").text('Inga sökresultat hittades för söktermen: ' + f_search);
457			 }
458		 }
459	 });
460 
461	 clearTimeout(intervalSearch);
462 }
463
464var loadingSearch = false;
465
466function addToSearch() {
467	if (loadingSearch) { return; }
468	loadingSearch = true;
469	jQuery(".search-loadmore").text('Laddar sökresultat...');
470	var f_num = 10;
471	var jQ_identifier = ".mobile-ajax-search-results";
472	var f_offset = jQuery(jQ_identifier + " article").length;
473	if (f_offset == null)
474	{
475		f_offset = 0;
476	}
477	var f_search = jQuery("#mobile-colophon #m-search .search-field").val();
478
479	if (f_search == "")
480	{
481		jQuery(".search-loadmore").text('Sök efter artiklar, sidor och kamprapporter.');
482		return;	
483	}
484
485	jQuery.ajax({
486		type: 'get',
487		url:'/wp-admin/admin-ajax.php?action=orgh_ajax_endpoint',
488		data: {type: 'search', offset: f_offset, num: f_num, s: f_search},
489		success: function (data) {
490			jQuery(jQ_identifier).append(data);
491		},
492		error: function () {
493			alert('error');
494		},
495		complete: function (data) {
496			loadingSearch = false;
497			jQuery(".search-loadmore").text(' ');
498			if (data.responseText == "")
499			{
500				jQuery(".search-loadmore").text('Inga fler sökresultat hittades.');
501			}
502		}
503	});
504
505	clearTimeout(intervalSearch);
506}
507
508/* MOBILE NAVIGATION */
509
510function toggle_mslide(selector, btn) {
511	// jQuery("#page").removeClass("scrolled");
512	// jQuery("body").removeClass("no-scroll");
513
514	/*
515	if (selector == '#footer-content-kamprapp') {
516		var now = Date.now();
517		setCookie('lastVisit', now, 365);
518	}
519	*/
520
521	if (jQuery(btn).hasClass("active-button")) {
522		jQuery(btn).removeClass("active-button");
523	}
524	else {
525		if (jQuery(".active-button").length > 0) {
526			jQuery(".active-button").removeClass("active-button");
527		}
528		jQuery(btn).addClass("active-button");
529	}
530	if (jQuery(selector).hasClass("show-m-slide")) {
531		jQuery(".show-m-slide").removeClass("show-m-slide");
532	}
533	else {
534		if (jQuery(".show-m-slide").length > 0) {
535			jQuery(".show-m-slide").removeClass("show-m-slide");
536			jQuery(selector).toggleClass("show-m-slide");
537			// jQuery("body").toggleClass("no-scroll");
538			update_m_slides(selector);
539		}
540		else {
541			if (history.state == null)
542			{
543				history.pushState({fromNav: true}, null, location.href);
544			}
545			jQuery(selector).toggleClass("show-m-slide");
546			// jQuery("body").toggleClass("no-scroll");
547			update_m_slides(selector);
548		}
549	}
550}
551
552function killClass($object, $class) {
553	jQuery($object).removeClass($class);
554}
555
556function update_m_slides(selector) {
557	if (selector == "#footer-content-search")
558	{
559		jQuery("#m-search label input").focus();
560	}
561	else {
562		jQuery("#m-search label input").blur();
563	}
564
565	if (selector == "#footer-content-kamprapp") {
566		var now = Math.floor(Date.now() / 1000);
567		//console.log(now);
568		setCookie('lastVisit', now, 365);
569		// console.log('setting visist cookie');
570		setTimeout(function(){ jQuery("#m-kamprapporter #notification").addClass("hide"); }, 3000);
571		jQuery("#footer-content-kamprapp .new-article").each( function() {
572			setTimeout(killClass , 5000, this, "new-article");
573		});
574	}
575
576	if (selector == "#footer-content-share") {
577		jQuery(selector + " input").val("https://xn--motstndsrrelsen-llb70a.se" + window.location.pathname).focus().select();
578		document.execCommand('copy');
579	}
580	else {
581		jQuery("#footer-content-share input").blur();
582	}
583}
584
585window.onpopstate = function(event) {
586	jQuery(".show-fp-display").removeClass("show-fp-display");
587	if (jQuery(".show-m-slide").length == 0) {
588		//window.history.back(); this was not needed?
589	}
590	else {
591		jQuery(".active-button").removeClass("active-button");
592		jQuery(".show-m-slide").removeClass("show-m-slide");
593		jQuery("#m-search label input").blur();
594		jQuery("#footer-content-share input").blur();
595	}
596}
597/**
598 * Hanterar peertube-api widgeten. Laddar innehåll via att anropa en API-url, parse:a den,
599 * och hämta senaste embed-värdet. Det läggs sedan i en iframe.
600 */
601
602 jQuery( document ).ready( function() {
603	jQuery(".widget_peertube_api_widget").each( function() {
604		var parent = jQuery(this);
605		var content_container = parent.find(".content");
606		var api_name = parent.find("noscript").attr("data-api");
607		var channel_link = parent.find("noscript").attr("data-link");
608		var base_url = "https://peertube.se";
609
610		if (channel_link != '') {
611			var channel_handle = api_name;
612			var real_channel_link = base_url + '/video-channels/' + channel_handle + '/videos';
613
614			uuid = channel_link.split("/videos/watch/")[1];
615			var embedpath = "/videos/embed/" + uuid;
616			content_container.html("<iframe frameborder='0' allowfullscreen src='"+ base_url + embedpath +"'></iframe>");
617			content_container.after("<section class='info'><a href='"+real_channel_link+"'>Se fler av våra videor</a></section>");
618			content_container.removeClass("unloaded");
619		} else {
620			var channel_handle = api_name;
621			var real_channel_link = base_url + '/video-channels/' + channel_handle + '/videos';
622			api_name = base_url + "/api/v1/video-channels/" + api_name + "/videos?count=1";
623		
624			var data = {};
625		
626			jQuery.get(api_name, data, function(response) {
627				var embedpath = response.data[0].embedPath; // Parse:ning sker automagiskt. Najs.
628				content_container.html("<iframe frameborder='0' allowfullscreen src='"+ base_url + embedpath +"'></iframe>");
629				content_container.after("<section class='info'><a href='"+real_channel_link+"'>Se fler av våra videor</a></section>");
630				content_container.removeClass("unloaded");
631			});
632		}
633	});
634});
635
636window.onload = function(){
637	jQuery('#footer-content-kamprapp > aside').scroll(myEfficientFn3);
638	if (kamprapp_num == undefined) {
639		kamprapp_num = jQuery("#footer-content-kamprapp > aside > main article").length;
640	}
641	if (kamprapp_offset == undefined) {
642		kamprapp_offset = jQuery("#footer-content-kamprapp > aside > main article").length;
643	}
644
645	header_bg_scroll_onload();
646	kmprapp_noti_onLoad();
647	cookieSet();
648	jQuery(".loading-in").toggleClass("loading-in");
649	jQuery("#bg1").toggleClass("bottombg-lazy");
650	clearInterval(mx_still_loading);
651	
652	jQuery("#mobile-colophon #m-search .search-field").on("input paste", function() {
653		clearTimeout(intervalSearch);
654		intervalSearch = setTimeout(repopulateSearch, 750);
655	});
656
657	
658	if (jQuery('.fullpagedisplay').length) {
659		jQuery('.fullpagedisplay img').each(function() {
660			var src = jQuery(this).attr('tmpsrc');
661			jQuery(this).attr('src', src);
662			jQuery(this).attr('tmpsrc', '');
663
664			var srcset = jQuery(this).attr('tmpsrcset');
665			jQuery(this).attr('srcset', srcset);
666			jQuery(this).attr('tmpsrcset', '');
667		});
668	}
669
670	if (jQuery('.fp-display-anchor')) {
671		jQuery('.fp-display-anchor, .fp-backarea').each( function() {
672			jQuery(this).bind('click', function(e) {
673				e.preventDefault();
674				var target = jQuery(this).attr('tar');
675				jQuery('#'+target).toggleClass('show-fp-display');
676				jQuery('body').toggleClass('show-fp-display');
677				history.pushState({fromPage: true}, null, location.href);
678				if (getUrlParameter('extended') != 'true') {
679					history.replaceState(null, "", "?extended=true");
680				}
681				else {
682					history.replaceState(null, "", "?");
683				}
684			});
685			
686			if (getUrlParameter('extended') == 'true' && jQuery('.show-fp-display').length == 0) {
687				var target = jQuery(this).attr('tar');
688				jQuery('#'+target).toggleClass('show-fp-display');
689				jQuery('body').toggleClass('show-fp-display');
690			}
691		});
692	}
693};
694
695jQuery(document).ready(function() {
696	if (jQuery('.fullpagedisplay').length) {
697		jQuery('.fullpagedisplay img').each(function() {
698			var src = jQuery(this).attr('src');
699			jQuery(this).attr('tmpsrc', src);
700			jQuery(this).attr('src', '');
701
702			var srcset = jQuery(this).attr('srcset');
703			jQuery(this).attr('tmpsrcset', srcset);
704			jQuery(this).attr('srcset', '');
705		});
706	}
707});
708
709
710var mx_load_counter = 0;
711var mx_load_count_to = 2;
712var mx_load_interval = 3; // seconds
713var mx_still_loading = setInterval(load_ticker, mx_load_interval * 1000)
714
715function load_ticker() {
716	if (mx_load_counter >= 3) {
717		jQuery(".loading-in").toggleClass("loading-in");
718		clearInterval(mx_still_loading);
719		return;
720	}
721	mx_load_counter++;
722}
723
724function cookieSet() {
725	setCookie('javascript', 'enabled', 365);
726}
727
728function getUrlParameter(sParam) {
729    var sPageURL = window.location.search.substring(1),
730        sURLVariables = sPageURL.split('&'),
731        sParameterName,
732        i;
733
734    for (i = 0; i < sURLVariables.length; i++) {
735        sParameterName = sURLVariables[i].split('=');
736
737        if (sParameterName[0] === sParam) {
738            return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
739        }
740    }
741}
742
743/* kmp-rapp notifications */
744
745// COOKIECHECK
746
747function cookieCheck() {
748	if (navigator.cookieEnabled) return true;
749
750	// set and read cookie
751	document.cookie = "cookietest=1";
752	var ret = document.cookie.indexOf("cookietest=") != -1;
753
754	// delete cookie
755	document.cookie = "cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT";
756
757	return ret;
758}
759
760function cookieAccept() {
761	setCookie('cookieAccept', 1, 365);
762	location.reload();
763}
764
765function cookieDeny() {
766	document.cookie = "cookieAccept=declined; expires=Thu, 01-Jan-1970 00:00:01 GMT";
767	document.cookie = "__cfduid=declined; expires=Thu, 01-Jan-1970 00:00:01 GMT";
768	document.cookie = "dwqa_anonymous=declined; expires=Thu, 01-Jan-1970 00:00:01 GMT";
769	document.cookie = "srs_unique_visitor=declined; expires=Thu, 01-Jan-1970 00:00:01 GMT";
770	document.getElementById("cookieWindow").className = 'showCookie';
771}
772
773/*
774function getCookie(cname) {
775	var name = cname + "=";
776	var decodedCookie = decodeURIComponent(document.cookie);
777	var ca = decodedCookie.split(';');
778	for(var i = 0; i <ca.length; i++) {
779		var c = ca[i];
780		while (c.charAt(0) == ' ') {
781			c = c.substring(1);
782		}
783		if (c.indexOf(name) == 0) {
784			return c.substring(name.length, c.length);
785		}
786	}
787	if (cname == "mediaVolume"){
788		return 50;
789	}
790	return "";
791}*/
792
793function kmprapp_noti_onLoad() {
794	//console.log()
795	setCookie('cookieAccept', 1, 365);
796	var now = Math.floor(Date.now() / 1000);
797	//console.log(now);
798	var cookieBrowser = cookieCheck();
799	var cookieAccept = document.cookie.indexOf("cookieAccept=") != -1;
800	if	(cookieBrowser == true && cookieAccept == true )
801	{
802		if (document.cookie.indexOf("lastVisit=") != -1) {
803			var date_U = getCookie("lastVisit");
804            //console.log(date_U);
805			var numPosts = 0;
806			jQuery("#footer-content-kamprapp .archive-flow > article").each( function() {
807				var pub = jQuery(this).attr("pub");
808				if (date_U < pub) {
809					numPosts++;
810					jQuery(this).toggleClass("new-article");
811				}
812			});
813			var articles = jQuery("#footer-content-kamprapp .archive-flow > article").length;
814
815			if (numPosts >= articles) {
816				numPosts = "+";
817			}
818
819			if (numPosts != 0) {
820				jQuery("#m-kamprapporter #notification").toggleClass("hide");
821			}
822			jQuery("#m-kamprapporter #notification").text(numPosts);
823		}
824		else {
825			setCookie('lastVisit', now, 365);
826		}
827	}
828	else
829	{
830		// do not display anything about kmp-rapp
831		jQuery("#m-kamprapporter #notification").remove();
832	}
833}
834/**
835 * Laddar alla bilder på löpsedeln med hjälp av lazyloading-principer
836 */
837jQuery(window).on('load', function() {
838	load_next_unloaded_img();
839});
840
841var global_article_imgs;
842var global_article_imgs_index = 0;
843
844jQuery(document).ready( function() {
845	global_article_imgs = jQuery(".article-flow article img");
846	global_article_imgs.each( function() {
847		jQuery(this).on('load', load_next_unloaded_img);
848	});
849
850	src = global_article_imgs.eq(0).attr("src_to_set");
851	global_article_imgs.eq(0).removeClass("unloaded");
852	global_article_imgs.eq(0).attr("src", src);
853});
854
855function load_next_unloaded_img() {
856	if (jQuery(this).hasClass("unloaded")) {
857		return;
858	}
859	jQuery("body").removeClass("loading-in");
860	global_article_imgs_index++;
861	global_article_imgs.eq(global_article_imgs_index).removeClass("unloaded");
862	global_article_imgs.eq(global_article_imgs_index - 1).removeClass("darkened");
863	src = global_article_imgs.eq(global_article_imgs_index).attr("src_to_set");
864	global_article_imgs.eq(global_article_imgs_index).attr("src", src);
865}
866
867// on document change also?
868jQuery( document ).ready(function() {
869	fontSizeMagic();
870});
871
872function fontSizeMagic() {
873	$headlines = jQuery("article h1");
874	
875	$headlines.each(function() {
876		if (jQuery(this).hasClass("fontmagi")) {
877			return;
878		}
879		jQuery(this).addClass("fontmagi");
880
881		$fSize = parseInt(jQuery(this).css("font-size"));
882		$fStartSize = $fSize;
883		$headlineOriginalHeight = jQuery(this).height();
884		jQuery(this).css("font-size", $fSize + "px");
885
886		$sizeFit = false;
887
888		for (let index = 0; index < 4; index++) {
889			jQuery(this).css("font-size", ($fSize - index) + "px");
890			if (jQuery(this).height() < $headlineOriginalHeight * (($fSize - index - 1) / $fStartSize)) {
891				$sizeFit = true;
892				break;
893			}
894		}
895
896		if ($sizeFit) {
897			// hurray
898		} else {
899			// try making larger
900			// console.log(jQuery(this).text());
901
902			$sizeFit = false;
903			for (let index = 0; index < 5; index++) {
904				jQuery(this).css("font-size", ($fSize + index) + "px");
905				//console.log("adjusting: " + ($fSize + index));
906				//console.log("expected height: " + ($headlineOriginalHeight * (($fSize + index) / $fStartSize)));
907				//console.log("actual height: " + jQuery(this).height());
908				if (jQuery(this).height() > $headlineOriginalHeight * (($fSize + index + 1) / $fStartSize)) {
909					$sizeFit = true;
910					$setSize = $fSize + index;
911					break;
912				}
913				$setSize = $fSize + index;
914			}
915			if ($sizeFit) {
916				// hurray, set to one less than where we found the breakpoint
917				jQuery(this).css("font-size", ($setSize - 1) + "px");
918			} else {
919				// just reset it?
920				jQuery(this).css("font-size", ($setSize - 1) + "px");
921			}
922		}
923
924		if (jQuery(this).closest("#visible-area").length != 0) {
925			$cursize = parseInt(jQuery(this).css("font-size"));
926			if ($cursize < 15) {
927				jQuery(this).css("font-size", 15 + "px");
928			}
929		}
930	});
931}
932
933jQuery(document).bind('DOMSubtreeModified', function () {
934	fontSizeMagic();
935 });
936function register_gdprbuttons() {
937    jQuery(".gdpr-yes").click(function () {
938        // accept
939        setCookie('gdprAccept', 'accepted', 1095, gdpr_cookie_set_domain_name);
940        jQuery("#gdpr-nag").toggleClass('hide');
941
942        
943        if (jQuery('#gdpr-area').length != 0) {
944            location.reload();
945        }
946    });
947    jQuery(".gdpr-no").click(function () {
948        // decline
949        setCookie('gdprAccept', 'declined', 1095, gdpr_cookie_set_domain_name);
950        location.replace('/datapolicy/');
951    });
952    jQuery(".gdpr-more").click(function () {
953        // more
954    });
955    jQuery(".gdpr-idc").click(function () {
956        // accept and IDC
957        setCookie('gdprAccept', 'accepted', 1095, gdpr_cookie_set_domain_name);
958        
959        jQuery("#gdpr-nag").toggleClass('hide');
960        
961        if (jQuery('#gdpr-area').length != 0) {
962            location.reload();
963        }
964    });
965
966    if (getCookie('gdprAccept') == null) {
967        // new visitor
968        // show gdpr
969        jQuery("#gdpr-nag").toggleClass('hide');
970
971        if (jQuery('#gdpr-area').length != 0) {
972            jQuery('#gdpr-area .no').toggleClass('hide');
973        }
974    }
975    if (getCookie('gdprAccept') == 'accepted') {
976        // accepted
977        // do nothing
978
979        if (jQuery('#gdpr-area').length != 0) {
980            jQuery('#gdpr-area .yes').toggleClass('hide');
981        }
982    }
983    if (getCookie('gdprAccept') == 'declined') {
984        // declined
985        // show gdpr
986        if (window.location.pathname != '/datapolicy/') {
987            location.replace('/datapolicy/');
988        }
989        jQuery("#gdpr-nag").toggleClass('hide');
990
991        if (jQuery('#gdpr-area').length != 0) {
992            jQuery('#gdpr-area .no').toggleClass('hide');
993        }
994    }
995    // console.log(window.location.pathname);
996}
997
998jQuery( function() {
999	register_gdprbuttons();
1000});
1001
1002function setCookie(cname, cvalue, exdays, domain = null) {
1003	var d = new Date();
1004	d.setTime(d.getTime() + (exdays*24*60*60*1000));
1005	var expires = "expires="+ d.toUTCString();
1006	if ( typeof domain == null ) {
1007		document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
1008	} else {
1009		document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/;domain=" + domain;
1010	}
1011}
1012
1013function getCookie(name) {
1014	var value = "; " + document.cookie;
1015	var parts = value.split("; " + name + "=");
1016	return parts.pop().split(";").shift();
1017}
1018

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.