PageSourceSearch

https://husmannsvinstue.dk/wp-content/themes/number-two/js/number-two.js?ver=b29e51b5ed07d83b91e651a7aea22a1d

js husmannsvinstue.dk collected 2026-10-08 22:10:05 UTC 20,209 bytes, 738 lines download raw bytes

1jQuery.noConflict();
2
3( function( $ ) {
4	jQuery( "body.home .wp-caption:last-child" ).addClass("last");
5
6	jQuery('.stom-tabs .tabs-header li a').click(function(){
7		var $that = jQuery(this);
8		var id = $that.parent('li').attr('data-id');
9		var $content = jQuery('.tabs-wrapper .tabs-content[data-id='+ id +']');
10
11		jQuery('.stom-tabs .tabs-header li.active').removeClass('active');
12		$that.parent('li').addClass('active');
13		
14		// Hide all tabs content
15		jQuery('.tabs-wrapper .tabs-content').hide();
16		
17		// Then show the selected tabs content
18		$content.show();
19		$('.royalSlider', $content).data('royalSlider').updateSliderSize(true);
20
21		return false;
22	});
23	
24
25	/* ----------- MERE SHORTCODE ----------- */
26	jQuery( ".mere-tekst-wrapper button" ).click(function() {
27		if ( jQuery(".mere-tekst", jQuery(this).parent()).css("display") == "none" ) {
28			jQuery("button.fold-ud", jQuery(this).parent()).hide();
29			jQuery("button.fold-ind", jQuery(this).parent()).show();
30			jQuery(".mere-tekst", jQuery(this).parent()).slideToggle("slow");
31		}else{
32			// Skjul teksten igen?
33			jQuery("button.fold-ud", jQuery(this).parent()).show();
34			jQuery("button.fold-ind", jQuery(this).parent()).hide();
35			jQuery(".mere-tekst", jQuery(this).parent()).slideUp("slow");
36			jQuery('.fold-ud', jQuery(this).parent()).slideDown("slow");
37		}
38	});
39
40
41	if(jQuery.fn.slick){
42		jQuery('.stom-simple-slider').slick({
43			dots: true,
44		});
45	}else{
46		console.log('Slick Slider Could\'t Initialize');
47	}
48
49	$(window).on('load', function() {
50		if ($('#sorting-date').length) {
51			$("#sorting-date").datepicker({
52				altFormat: 'yymmdd',
53				dateFormat: 'dd-mm-yy',
54				altField: '#sorting-date-hidden'
55			});
56
57			$("#sorting-date").on('keyup change', function() {
58				if ($("#sorting-date").val() == '')
59					$("#sorting-date-hidden").val('');
60			});
61		}
62	});
63
64} )( jQuery );
65
66function stom_popup(id){
67	if(jQuery('.stom-popup-'+id).is(":visible")){
68		jQuery('.stom-popup-'+id).hide();
69	}else{
70		jQuery('.stom-popup-'+id).show();
71	}
72}
73jQuery('.stom-popup').on('click',function(e){
74	var id = jQuery(this).data('id');
75	if(e.target != this){return;}
76	stom_popup(id);
77});
78
79/*CENTERED TEXT OVERLAY*/
80jQuery(document).ready(function () {
81	var txtOverlayElements = jQuery('.st-text-overlay p:last-child');
82	if(txtOverlayElements.length > 0){
83		txtOverlayElements.each(function () {
84			var queryHeight = jQuery(this).outerHeight();
85			jQuery(this).css('height', queryHeight + 'px');
86			jQuery(this).css({ 'top': '0', 'bottom': '0', 'left': '0', 'right': '0' });
87		});
88	}
89});
90/*--CENTERED TEXT OVERLAY--*/
91
92/*MODAL POP UPS*/
93function nillerModal(uri, timed) {
94	var $ = jQuery;
95
96	if (timed % 1 === 0) {
97		timedNewsLetter(timed, uri);
98	}
99	//Handler functions for the events
100	function openModal(event) {
101		event.preventDefault();
102		var transition = this.dataset.transition;
103		overlayOuter.classList.add(transition);
104		var href = (this.getAttribute('href'));
105		if (this.dataset.newsletter === 'yes') {
106			var ifrm = document.createElement("iframe");
107			ifrm.setAttribute('src', href);
108			//ifrm.setAttribute('width', 300);
109			//ifrm.setAttribute('height', 300);
110			ifrm.style.border = 'none';
111			modalString.innerHTML = "";
112			modalString.appendChild(ifrm);
113
114		} else if (href.indexOf("/") !== -1) {
115			//AJAX if href is external
116			//remove the preceeding #
117			href = href.substring(1);
118			jQuery('#st-modal-string').load(href + ' #primary');
119		} else {
120			//ID if link is to id
121			modalString.innerHTML = document.querySelector(href).innerHTML;
122
123			if ($('video.wp-video-shortcode', modalString).length) {
124				$('.wp-video', modalString).prepend($('video.wp-video-shortcode', modalString));
125				$('.wp-video', modalString).children(':not(video)').remove();
126				$('video.wp-video-shortcode', modalString).mediaelementplayer();
127			}
128		}
129		overlayOuter.style.display = 'table';
130		overlayOuter.addEventListener('click', closeModal, false);
131		window.setTimeout(function () {
132			overlayOuter.classList.add('st-modal-opaque');
133		}, 100);
134	}
135
136	function timedNewsLetter(id, uri) {
137		var ifrm = document.createElement("iframe");
138		ifrm.setAttribute('src', '/?popup_ajax_handler=3d272bd98b34cd7c02c72c0421684e41&newsletter=' + id);
139		ifrm.style.border = 'none';
140		document.getElementById('st-modal-string').innerHTML = "";
141		document.getElementById('st-modal-string').appendChild(ifrm);
142		document.getElementById('st-modal-overlay-outer').style.display = 'table';
143		document.getElementById('st-modal-overlay-outer').addEventListener('click', closeModal, false);
144		window.setTimeout(function () {
145			overlayOuter.classList.add('st-modal-opaque');
146		}, 100);
147	}
148
149	function closeModal() {
150		overlayOuter.classList.remove('st-modal-opaque');
151		window.setTimeout(function () {
152			modalString.innerHTML = '';
153			overlayOuter.style.display = 'none';
154			overlayOuter.removeEventListener('click', closeModal);
155			overlayOuter.classList.remove('from-left', 'from-right', 'from-top', 'from-bottom');
156		}, 500);
157	}
158	//Reference the DOM elements
159	var modalLinks = document.querySelectorAll('.modal-link');
160	//Attach eventlisteners to the elements
161	var has_modal_html = false;
162	for (var i = 0; i < modalLinks.length; i++) {
163		if (has_modal_html == false) {
164			var modal_html = '' +
165				'<!--Static elements for the Modal screen-->' +
166				'<div class="st-modal-overlay-outer" id="st-modal-overlay-outer">' +
167				'<div class="st-modal-overlay-inner" id="st-modal-overlay-inner">' +
168				'<div class="st-modal-overlay-content" id="st-modal-overlay-content">' +
169				'<div class="st-modal-modal-string" id="st-modal-string">' +
170				'<img src="' + uri + '/images/loading-icon.gif" alt="loader"/>' +
171				'</div>' +
172				'<button class="st-modal-close-btn" id="st-modal-close-btn" title="Luk">Luk</button>' +
173				'</div>' +
174				'</div>' +
175				'</div>' +
176				'<!--/modal end-->';
177			jQuery('body').append(modal_html);
178			var overlayOuter = document.getElementById('st-modal-overlay-outer');
179			var overlayContent = document.getElementById('st-modal-overlay-content');
180			var modalString = document.getElementById('st-modal-string');
181			var closeOverlay = document.getElementById('st-modal-close-btn');
182			has_modal_html = true;
183		}
184
185		var content_id = modalLinks[i].getAttribute('href').substring(1);
186		if (document.getElementById(content_id)) {
187			document.getElementById(content_id).style.display = 'none';
188		}
189
190		modalLinks[i].addEventListener('click', openModal, false);
191	}
192	closeOverlay.addEventListener('click', closeModal, false);
193	overlayContent.addEventListener("click", function (event) {
194		event.stopPropagation();
195	});
196}
197
198
199
200
201
202(function($) {
203	/*** GravityForms handling (AJAX, empty labels, etc.) ***/
204	if ($('.gform_wrapper').length) {
205		var errorTimer = '',
206			formHeights = [],
207			scrollOffset = 100;
208
209
210		/* NÃ¥r formen er loaded & re-loaded */
211		$(document).bind('gform_post_render', function(e, form_id) {
212			var $form = $('#gform_' + form_id);
213
214
215			/* IE placeholder submit fix*/
216			$('.gfield').each(function() {
217				if ($('input, textarea', this).text() == $('input, textarea', this).attr('placeholder'))
218					$('input, textarea', this).val('');
219			});
220
221
222			/* Skjuler tomme <labels> og flytter required til placeholder */
223			$('.gfield', $form).each(function() {
224				var isRequired = $(this).hasClass('gfield_contains_required') == true ? 'required' : '';
225
226				$('.gfield_label', this).each(function() {
227					var childNodes = $(this)[0].childNodes.length;
228
229					if (isRequired && childNodes == 1 && $('.gfield_required', this).length) {
230						$input = $(this).parent().find('.ginput_container').children('[placeholder]');
231						$input.attr('placeholder', $input.attr('placeholder') + ' *');
232
233						$(this).remove();
234					}
235
236					else if ($(this).html() == '')
237						$(this).remove();
238				});
239			});
240
241
242			function cookieBoxCheck() {
243				if ($('#cookie_box').is(':visible')) {
244					$('.validation_error').css('bottom', $('#cookie_box').outerHeight());
245				}
246			}
247
248			$(window).on('resize orientationchange', cookieBoxCheck);
249
250
251			/* HÃ¥ndtering af fejlbesked(er) */
252			if ($('.validation_error').length > 0) {
253				$('.validation_error').hide();
254
255				$('.validation_error', $form).css('bottom', '');
256				$('.validation_error', $form).slideDown('slow');
257
258				cookieBoxCheck();
259
260
261				$('li.gfield_error', $form).each(function() {
262					$('.ginput_container', this).append($('.validation_message', this));
263				});
264
265
266				if (errorTimer) clearTimeout(errorTimer);
267
268				errorTimer = setTimeout(function() {
269					$('.validation_error').slideUp('slow');
270				}, 7500);
271
272
273				if ($('#gform_' + form_id + ' .gfield_error').first().offset().top < $(document).scrollTop() + scrollOffset) {
274					$('html, body').animate({
275				        scrollTop: $('#gform_' + form_id + ' .gfield_error').first().offset().top - scrollOffset
276				    }, 1000);
277				}
278			}
279
280
281			/* AJAX spinner */
282			$form.append('\
283				<div id="spinner-anchor"></div>\
284				<div id="spinner-overlay">\
285					<span class="spinner-element">\
286						<i class="fas fa-sync-alt fa-spin fa-3x fa-fw"></i>\
287					</span>\
288				</div>\
289			');
290
291			if (window.hasOwnProperty('gform')) {
292				gform.addFilter('gform_spinner_target_elem', function($targetElem, formId) {
293				    return $('#gform_' + formId + ' #spinner-anchor');
294				});
295			}
296			else {
297				console.error('Gravity Forms is not using AJAX');
298			}
299
300
301			/* Gemmer hver formular's højde relateret til dens ID */
302			formHeights[form_id] = $form.height();
303		});
304
305
306		/* NÃ¥r formen har sendt korrekt */
307		$(document).bind('gform_confirmation_loaded', function(e, form_id) {
308			$('html, body').stop();
309
310			$('#gform_confirmation_wrapper_' + form_id).height(formHeights[form_id] + 'px');
311
312			if ($('#gform_confirmation_wrapper_' + form_id).offset().top < $(document).scrollTop() + scrollOffset) {
313				$('html, body').animate({
314			        scrollTop: $('#gform_confirmation_wrapper_' + form_id).offset().top - 150
315			    }, 1000);
316			}
317		});
318
319
320		/* Skjuler fejlbesked i bunden af siden */
321		$('body').on('click', '.validation_error', function() {
322			$(this).slideUp('slow');
323
324			if (errorTimer) clearTimeout(errorTimer);
325		});
326
327
328		/* Fjerner fejl-beskeder ved :focus */
329		$('body').on('focus', 'li.gfield_error *', function(e) {
330			e.stopPropagation();
331
332			var $error = $(this).parents('li.gfield_error').find('.validation_message');
333
334			if ($error.length) {
335				$error.fadeOut('slow', function() {
336					$error.remove();
337				});
338			}
339		});
340		/* Skjuler fejlbeskeder ved :hover */
341		$('body').on('hover', 'li.gfield_error .validation_message', function() {
342			$(this).fadeOut('slow', function() {
343				$(this).remove();
344			});
345		});
346	}
347
348
349
350	/*** STOM anmeldelses-slider ***/
351	if ($('.stom-anmeldelse-wrapper').length) {
352		// Reset shortcode slick options
353		$('.stom-anmeldelse-wrapper').children('.stom-simple-slider').slick('unslick');
354
355		$('.stom-anmeldelse-wrapper').children('.stom-simple-slider').slick({
356			dots: true,
357			infinite: true,
358  			slidesToShow: 1,
359  			autoplay: true,
360  			autoplaySpeed: 5000,
361  			adaptiveHeight: true
362		});
363	}
364
365
366	/*** STOM Kalender-slider ***/
367	if ($('.kalender-container').length) {
368		// Reset shortcode slick options
369		$('.kalender-container').each(function() {
370			$(this).slick({
371					slidesToShow: 4,
372				  	slidesToScroll: 1,
373				    autoplay: true,
374				    autoplaySpeed: 3500,
375				    dots: false,
376				    responsive: [
377				    {
378				      breakpoint: 960,
379				      settings: {
380				        arrows: true,
381				        centerMode: false,
382				        slidesToShow: 3
383				      }
384				    },
385				    {
386				      breakpoint: 768,
387				      settings: {
388				        arrows: true,
389				        centerMode: false,
390				        slidesToShow: 2
391				      }
392				    },
393				    {
394				      breakpoint: 480,
395				      settings: {
396				        arrows: true,
397				        centerMode: false,
398				        slidesToShow: 1
399				      }
400				  }
401				]
402
403			});
404		});
405	}	
406
407
408
409
410	/*** STOM tæt_grid shortcode height calculator ***/
411	if ($('.close-grid-wrapper').length) {
412		function resizeGrid() {
413			$('.close-grid-wrapper').each(function() {
414				var height = $('.close-grid:first-of-type', this).width();
415
416				$('.close-grid', this).height(height);
417			});
418		}
419
420		$(window).on('resize orientationchange', resizeGrid);
421		resizeGrid();
422	}
423
424
425
426	/*** Devices Sidebar toggle-button ***/
427	if ($('#secondary').length) {
428		var $secondary = $('#secondary'),
429			sidebarButtonClicked = 'no',
430			dataOffset = $secondary.data('offset'),
431			dataText = $secondary.data('text');
432
433		$('#content').append('<span class="open-button devices-toggle">' + dataText + ' <i class="fas fa-chevron-down" aria-hidden="true"></i></span>');
434		$secondary.prepend('<span class="close-button devices-toggle"><i class="fas fa-times" aria-hidden="true"></i></span>');
435
436		$('#content .devices-toggle').on('click', function() {
437			$secondary.toggleClass('active');
438			sidebarButtonClicked = sidebarButtonClicked == 'no' ? 'yes' : 'no';
439
440			if (sidebarButtonClicked == 'yes') {
441				window.setTimeout(function() {
442					$('body').addClass('off-canvas');
443					$('body').css('padding-right', getScrollbarWidth());
444					checkOverflow();
445				}, 100);
446			}
447			else {
448				window.setTimeout(function() {
449					$('body').removeClass('off-canvas');
450					$('body').css('padding-right', '');
451					checkOverflow();
452				}, 150);
453			}
454		});
455
456
457		function getScrollbarWidth() {
458		    var outer = document.createElement("div");
459		    outer.style.visibility = "hidden";
460		    outer.style.width = "100px";
461		    outer.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps
462
463		    document.body.appendChild(outer);
464
465		    var widthNoScroll = outer.offsetWidth;
466		    // force scrollbars
467		    outer.style.overflow = "scroll";
468
469		    // add innerdiv
470		    var inner = document.createElement("div");
471		    inner.style.width = "100%";
472		    outer.appendChild(inner);        
473
474		    var widthWithScroll = inner.offsetWidth;
475
476		    // remove divs
477		    outer.parentNode.removeChild(outer);
478
479		    return widthNoScroll - widthWithScroll;
480		}
481
482
483		function checkOverflow() {
484			if (sidebarButtonClicked == 'yes') {
485				if (window.innerWidth < 450 && $secondary.hasClass('active')) {
486					if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) {
487						document.body.style.position = 'fixed';
488					}
489					
490					document.body.style.overflow = 'hidden';
491					document.body.style.height = '100%';
492					document.body.style.width = '100%';
493				}
494			}
495			else {
496				$('body').removeAttr('style');
497			}
498		}
499
500
501		function calcOpenPosition() {
502			var adminBarHeight = $('#wpadminbar').outerHeight(),
503				headerHeight = $('#masthead').outerHeight(),
504				buttonWidth = $('#content .open-button').outerWidth(),
505				offset = dataOffset;
506
507			$('#content .open-button').css('top', adminBarHeight + headerHeight + buttonWidth + offset + 'px');
508		}
509		calcOpenPosition();
510
511
512		$(window).on('load resize orientationchange', function() {
513			checkOverflow();
514			calcOpenPosition();
515		});
516	}
517
518
519
520	/*** Video Slider muted icon click handler ***/
521	$(document).ready(function() {
522		if ($('.stom-page-slider, .section-wrap.video-bg').length) {
523			$('.video-muted-icon').on('click', function() {
524				var $this = $(this),
525					$video = $this.next('video');
526
527				$video.prop('muted', !$video.prop('muted'));
528				$this.toggleClass('unmuted');
529			});
530		}
531	});
532
533
534
535	/*** STOM Maps Sections ***/
536	if ($('.section-map.maps-optimize').length && window.innerWidth > 767) {
537		$('.section-map.maps-optimize').each(function() {
538			var $map_section = $(this);
539
540			if ($map_section.hasClass('optimize-left')) {
541				$('.stom-cols-6.last', $map_section).css('min-height', $('.stom-cols-6:not(.last)', $map_section).height());
542			}
543			else {
544				$('.stom-cols-6:not(.last)', $map_section).css('min-height', $('.stom-cols-6.last', $map_section).height());
545			}
546		});
547	}
548})(jQuery);
549
550
551
552
553/*  AUTO BURGER MENU */
554/* - */ /* - */ /* - */
555/* - */ /* - */ /* - */
556/* - */ /* - */ /* - */
557/*RESIZE AND ONLOAD EVENT HANDLER*/
558function autoBurger ( $, siteNav ){
559	function aBMenuWidth() {
560		var abMenu = $('.menu-container');
561		var abMenuWidth = abMenu.width();
562		return (abMenuWidth -10);
563	}
564	var constantmenuWidth = aBMenuWidth();
565
566	function aBwrapperWidth() {
567		var abWrap = $('#primary-menu');
568		var abWrapWidth = abWrap.width();
569		return abWrapWidth;
570	}
571
572	/*EVENT HANDLER FUNCTION*/
573	function abHandler() {
574		// if(siteNav.hasClass('st-burger')){
575			// return;
576		// }
577
578		if (constantmenuWidth > aBwrapperWidth()) {
579			siteNav.addClass('st-burger');
580		}
581		else{
582			siteNav.removeClass('st-burger');
583		}
584	}
585
586	//Run the handler on resize
587	// window.addEventListener('resize', abHandler);
588
589	//Run the handler on orientation change (Portrait/landscape)
590	// window.addEventListener('orientationchange', abHandler);
591	
592	/*Run handler one time onload*/
593	// abHandler();
594}
595
596jQuery(window).on('load', function() {
597	var $ = jQuery;
598	var siteNav = $('#site-navigation');
599
600	autoBurger( $, siteNav );
601});
602
603
604
605
606/*** STOM produktion <h1> checker ***/
607jQuery(window).on('load', function() {
608	var $ = jQuery;
609
610	function stomProductionH1Checker() {
611		if (!$('body.stom-admin').length) return;
612
613		window.setTimeout(function() {
614			var titleCount = $('h1').length;
615
616			if (titleCount != 1) {
617				$('body').prepend('\
618					<style>\
619						.stom-production-error {\
620							position: fixed;\
621						    top: 0;\
622						    right: 0;\
623						    left: 0;\
624						    padding: 50px;\
625						    z-index: 99999;\
626						    font-size: 50px;\
627						    background-color: rgba(255, 0, 0, .8);\
628						    text-align: center;\
629						    font-weight: bold;\
630						    color: white;\
631						    border-bottom: 3px solid white;\
632						    cursor: pointer;\
633						}\
634					</style>\
635				');
636			}
637
638			if (titleCount == 0) {
639				$('body').prepend('<div class="stom-production-error">DENNE SIDER MANGLER EN &lt;h1&gt;</div>');
640			}
641			else if (titleCount > 1) {
642				$('body').prepend('<div class="stom-production-error">DU HAR <u>' + titleCount + '</u> &lt;h1&gt; TAGS PÅ DENNE SIDE</div>');
643
644				$('h1').each(function() {
645					$(this).css({
646						'padding' : '15px',
647						'color' : 'white',
648						'background-color': 'red',
649						'border' : '3px solid white'
650					});
651				});
652			}
653		}, 1500);
654
655
656		$('body').on('click', '.stom-production-error', function() {
657			$(this).slideUp(750);
658		});
659	}
660	stomProductionH1Checker();
661});
662
663
664
665/* PhotoSwipe gallery handler */
666jQuery(document).ready(function($) {
667	if (!$('.gallery[id^=gallery-]').length) return;
668
669	$('.gallery.gallery-link-file[id^=gallery-]').each(function() {
670		var $items = $('figure.gallery-item', this),
671			$links = $('a', $items),
672			$images = $('img', $links),
673			pswpElement = $('.pswp')[0],
674			slides = [],
675			options = {};
676
677		for (i = 0; i < $links.length; i++) {
678			slides.push({
679				src: $($links[i]).attr('href'),
680				w: $($images[i]).attr('data-stom-width'),
681				h: $($images[i]).attr('data-stom-height')
682			});
683		};
684
685		$links.on('click', function(e) {
686			e.preventDefault();
687
688			var index = $items.index($(this).parents('figure'));
689			options['index'] = index;
690
691			var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, slides, options);
692			gallery.init();
693		});
694	});
695});
696/* END PhotoSwipe gallery handler */
697
698
699
700/* Iframe slider embed */
701if (jQuery('.stom-slider-image-content.iframe-embed iframe#stom-iframe-embed').length) {
702	var tag = document.createElement('script');
703	tag.id = 'iframe-demo';
704	tag.src = 'https://www.youtube.com/iframe_api';
705	var firstScriptTag = document.getElementsByTagName('script')[0];
706	firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
707
708	var player;
709	function onYouTubeIframeAPIReady() {
710		player = new YT.Player('stom-iframe-embed', {
711			events: {
712				'onReady': onPlayerReady
713			}
714		});
715	}
716
717	function onPlayerReady(event) {
718		player.playVideo();
719	}
720}
721/* END Iframe slider embed */
722
723// gform.addFilter( 'gform_datepicker_options_pre_init', function( optionsObj, formId, fieldId ) {
724        // optionsObj.firstDay = 1;
725        // optionsObj.beforeShowDay = function(date) {
726            // var day = date.getDay();
727            // return [(day != 0)];
728        // };
729    // return optionsObj;
730// });
731
732gform.addFilter( 'gform_datepicker_options_pre_init', function( optionsObj, formId, fieldId ) {
733    // Apply to field 2 only 
734    if (formId == 2 && fieldId == 9) {
735        optionsObj.minDate = 0;
736    }
737    return optionsObj;
738});

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.