PageSourceSearch

https://norecopa.no/js/custom.js?21587959

js norecopa.no collected 2026-09-24 18:16:58 UTC 7,656 bytes, 277 lines download raw bytes

1// Smooth scroll
2jQuery(function() {
3	jQuery('a.scroll').click(function() {
4		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
5			let target = jQuery(this.hash);
6			target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']');
7			if (target.length) {
8				jQuery('html,body').animate({
9					scrollTop: target.offset().top
10				}, 250);
11				return false;
12			}
13		}
14	});
15
16	const knownHosts = [
17		'www.film.oslovet.veths.no',
18		'film.oslovet.veths.no',
19		'norecopa.no',
20		'www.norecopa.no',
21		'www.oslovet.norecopa.no',
22		'oslovet.norecopa.no',
23		'www.oslovet.nvh.no',
24		'oslovet.nvh.no',
25		'www.oslovet.veths.no',
26		'oslovet.veths.no',
27		'search.norecopa.no',
28		'www.norecopa.no'
29	];
30
31	jQuery("a")
32		.each(function (idx, elem) {
33
34			let href = jQuery(elem).attr('href');
35			const target = jQuery(elem).attr('target');
36			href = encodeURIComponent(href)
37			jQuery(elem).on("click",
38				function (e) {
39					fetch("/umbraco/api/link/click?url=" +
40						href +
41						"&src=" +
42						location.href);
43				});
44
45
46
47
48
49			if (!isExternalLink(href)) return;
50
51			if (target === undefined)
52				jQuery(elem).attr('target', '_blank');
53
54			//jQuery.get('/umbraco/api/UrlChecker/GetRedirectUrl?url=' + href,
55			//    function(result) {
56			//        if (!result) return;
57			//        jQuery(elem).attr('href', result);
58			//    });
59		});
60
61
62	function isExternalLink(href) {
63		if (!href) return false;
64		const isAbsolute = !!href.match(/^http|\/\//);
65		if (!isAbsolute) return false;
66
67		for (let i = 0; i < knownHosts.length; i++) {
68			const host = knownHosts[i];
69			const r = new RegExp("(http:\/\/|https:\/\/|\/\/)" + host);
70			const match = !!href.match(r);
71			if (match) return false;
72		}
73		return true;
74	}
75});
76
77
78// Set focus to anchored content
79//jQuery(document).ready(function() {
80//	// add a click handler to all links 
81//	// that point to internal targets (href="#...")		
82//	jQuery("a[href^='#']").click(function() {
83//		// get the href attribute of the internal link
84//		// then strip the first character off it (#)
85//		// leaving the corresponding id attribute
86//		jQuery("#"+jQuery(this).attr("href").slice(1)+"")
87//			// give that id focus (for browsers that didn't already do so)
88//			.focus()
89//			// add a highlight effect to that id			
90//			.effect("highlight", {}, 3000);
91//	});
92//});
93
94
95// Hamburger / Small screen navigation
96(function() {
97
98	"use strict";
99
100	const toggles = document.querySelectorAll(".c-hamburger");
101
102	for (let i = toggles.length - 1; i >= 0; i--) {
103		const toggle = toggles[i];
104		toggleHandler(toggle);
105	};
106
107	function toggleHandler(toggle) {
108		toggle.addEventListener( "click", function(e) {
109			jQuery("header nav > ul").slideToggle("fast");
110			jQuery("header").toggleClass("open");
111			e.preventDefault();
112			(this.classList.contains("is-active") === true) ? this.classList.remove("is-active") : this.classList.add("is-active");
113
114			if (jQuery(this).hasClass("is-active")) {
115				jQuery(this).attr("aria-expanded","true");
116			}
117			else {
118				jQuery(this).attr("aria-expanded","false");
119			}
120
121		});
122	}
123
124})();
125
126
127
128// Collapse / expand
129jQuery(document).ready(function () {
130	jQuery(".search-filter-section .bttn.expand").on('click', function (e) {
131
132		jQuery(this).toggleClass('active');
133		jQuery(this).next(".expand-content").slideToggle();
134		e.preventDefault();
135	});
136});
137
138
139// Hide search
140jQuery(document).ready(function () {
141	if (jQuery("body").hasClass("frontpage")) {
142		jQuery("section.front-page-search").removeClass("notvisible");
143	}
144});
145
146
147// Front page search button
148jQuery(document).ready(function (e) {
149	jQuery(".bttn-search-frontpage").on('click', function (e) {
150		jQuery("section.front-page-search .search-input input").focus();
151		e.preventDefault();
152	});
153});
154
155jQuery(document).ready(function (e) {
156	let isMobile = () => window.matchMedia("only screen and (max-width: 990px)").matches;
157
158	jQuery(".main-menu > nav > ul > li")
159		.on('mouseover', function (e) {
160			if(isMobile()) return;
161			let id = jQuery(this).attr('data-id');
162			jQuery(".header-sub-menu .submenu-" + id).addClass("hover");
163	})
164		.on('mouseout', function (e) {
165			if(isMobile()) return;
166			let id = jQuery(this).attr('data-id');
167			jQuery(".header-sub-menu .submenu-" + id).removeClass("hover");
168		});
169	
170	jQuery("ul.breadcrumb > li")	
171		.on('mouseover', function (e) {
172			if(isMobile()) return;
173			let id = jQuery(this).attr('data-id');
174			jQuery(".breadcrumb-sub-menu .submenu-" + id).addClass("hover");
175		})
176		.on('mouseout', function (e) {
177			if(isMobile()) return;
178			let id = jQuery(this).attr('data-id');
179			jQuery(".breadcrumb-sub-menu .submenu-" + id).removeClass("hover");
180		});
181
182	jQuery("li.link-child")
183		.on('click', function (e) {
184			if(!isMobile()) return;
185			jQuery(this).toggleClass("hover");
186			// let id = jQuery(this).attr('data-id');
187			// jQuery(".mobile-sub-menu.submenu-" + id).toggleClass("hover");
188		})
189		// .on('mouseout', function (e) {
190		// 	if(isMobile()) return;
191		// 	let id = jQuery(this).attr('data-id');
192		// 	jQuery(".breadcrumb-sub-menu .submenu-" + id).removeClass("hover");
193		// });
194});
195
196
197// Sub page serach button / Collapse / expand search
198jQuery(document).ready(function (e) {
199	jQuery(".bttn-search-expand").on('click', function (e) {
200		jQuery(this).toggleClass('active');
201		jQuery("section.front-page-search").slideToggle();
202		jQuery("section.front-page-search .search-input input").focus();
203		e.preventDefault();
204	});
205});
206
207
208// Equal height
209jQuery(function() {
210	jQuery('.matchheight').matchHeight();
211	jQuery('.list-item').matchHeight();
212	jQuery('.employee-position.line2').matchHeight();
213});
214
215// Initialize inline popup
216jQuery('.open-popup-link').magnificPopup({
217	type:'inline',
218	midClick: true // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href.
219});
220
221
222
223
224
225// Search filter: markere hvilke søkefiltre som er aktive
226jQuery('.search-filter-section-content input:checkbox').click(function() {
227	const checked = jQuery(this).closest(".search-filter-section-content").find("input:checkbox:checked").length > 0;
228	if(checked){
229		//Sett klasse
230		jQuery(this).closest(".search-filter-section-content").siblings(".bttn.expand").addClass("selected");
231	}
232	else{
233		//Fjern klasse
234		jQuery(this).closest(".search-filter-section-content").siblings(".bttn.expand").removeClass("selected");
235	}
236});
237
238
239// Magnific pop-up slideshow
240jQuery('.gallery').each(function() { // the containers for all your galleries
241	jQuery(this).magnificPopup({
242		delegate: 'a', // the selector for gallery item
243		type: 'image',
244		gallery: {
245			enabled:true
246		},
247		mainClass: 'mfp-with-zoom', // this class is for CSS animation below
248		zoom: {
249			enabled: true, // By default it's false, so don't forget to enable it
250
251			duration: 300, // duration of the effect, in milliseconds
252			easing: 'ease-in-out', // CSS transition easing function
253
254			// The "opener" function should return the element from which popup will be zoomed in
255			// and to which popup will be scaled down
256			// By defailt it looks for an image tag:
257			opener: function(openerElement) {
258				// openerElement is the element on which popup was initialized, in this case its <a> tag
259				// you don't need to add "opener" option if this code matches your needs, it's defailt one.
260				return openerElement.is('img') ? openerElement : openerElement.find('img');
261			}
262		}
263
264	});
265});
266
267
268// Changes order of divs based on screen resolution
269enquire.register("screen and (min-width: 991px)", {
270	match : function() {
271		jQuery(".search-filter").appendTo(".col-search-filter")
272	},
273	unmatch : function() {
274		jQuery(".search-filter").appendTo(".content-search-wrapper")
275	}
276});
277

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.