PageSourceSearch

https://varefakta.dk/wp-content/plugins/stom-popups/script.js?ver=6.6.2

js varefakta.dk collected 2026-10-04 20:08:16 UTC 4,770 bytes, 188 lines download raw bytes

1(function($) {
2	if (!$('#stom_popups_wrapper').length > 0) return;
3
4
5	if ($('body').hasClass('theme-number-two'))
6		$('#page').append($('#stom_popups_wrapper'));
7
8
9	var $popups = $('#stom_popups_wrapper').children();
10	if (!$popups.length > 0) return true;
11
12	var anim_speed = 0;
13
14	$popups.each(function() {
15		var $window = $(window),
16			$this = $(this),
17			ID = $this.attr('id'),
18			display = $this.data('display'),
19			delay = $this.data('delay'),
20			hideDelay = $this.data('hide-delay'),
21			days = $this.data('time'),
22			cookie_exists = false,
23			foldDisplayClass = 'fold-open',
24			timer;
25
26
27		var cname = '_' + ID + '=',
28			decodedCookie = decodeURIComponent(document.cookie),
29			ca = decodedCookie.split(';');
30
31		for (var i = 0; i < ca.length; i++) {
32	        var c = ca[i];
33	        while (c.charAt(0) == ' ') {
34	            c = c.substring(1);
35	        }
36	        if (c.indexOf(cname) == 0) {
37	            cookie_exists = true;
38	        }
39	    }
40
41
42	    function showPopup() {
43			if ($this.data('shown')) return;
44
45			$this.show(anim_speed);
46
47			if (typeof gtag === "function") {
48				// automatically opened popup
49				gtag('event', 'stom_popup_opened', {
50					'event_label': 'Popup ID: ' + $this.attr('id').match(/\d+/)[0],
51  					'event_category': 'STOM Popups',
52					// 'non_interaction': true,
53				});
54			}
55
56			if (hideDelay)
57				window.setTimeout(closePopup, hideDelay * 1000);
58		}
59
60		function closePopup() {
61			setCookie();
62
63			$this.fadeOut(anim_speed);
64			$this.data('shown', 1);
65
66			if (typeof gtag === "function") {
67				// popup closed automatically/manually
68				gtag('event', 'stom_popup_closed', {
69					'event_label': 'Popup ID: ' + $this.attr('id').match(/\d+/)[0],
70  					'event_category': 'STOM Popups',
71					// 'non_interaction': true,
72				});
73			}
74		}
75
76		function togglePopup() {
77			$this.toggleClass(foldDisplayClass);
78			$('.stom_popup', $this).slideToggle(300, handleContentSize);
79		}
80
81		function setCookie() {
82			if (days == 'always')
83				return;
84			else if (days == 'never')
85				days = 1000;
86
87			var today = new Date(),
88				expire = new Date();
89
90			expire.setDate(expire.getDate()+days);
91			expire.toUTCString();
92
93			document.cookie = '_' + ID + '=1; expires=' + expire + ';path=/';
94		}
95
96		function handleContentSize() {
97			$('.stom_popup', $this).height('');
98
99			if ($this.hasClass(foldDisplayClass))
100				$('.stom_popup', $this).height($this.outerHeight() - $('.stom_popup_toggle_wrapper', $this).outerHeight());
101		}
102
103
104		if (!cookie_exists) {
105			if (display == 'page-load') {
106				$(window).on('load', showPopup);
107			} else if (display == 'delay-x') {
108				window.setTimeout(function() {
109					showPopup();
110				}, delay * 1000);
111			} else if (display == 'remove-focus') {
112				var mouseY = 0,
113	    			topValue = 0;
114
115				window.addEventListener('mouseout', function(e) {
116			        mouseY = e.clientY;
117			        if (mouseY < topValue) {
118			            showPopup();
119			        }
120			    },
121			    false);
122			} else if (display == 'scroll-x') {
123				function detectScroll() {
124					timer && window.clearTimeout(timer);
125	  				timer = window.setTimeout(function() {
126	  					if ($window.scrollTop() > delay) {
127	  						showPopup();
128	  						$window.off('scroll', detectScroll);
129	  					}
130	  				}, 50);
131				}
132
133				$window.on('scroll', detectScroll);
134			} else if (display == 'delay-x-remove-focus') {
135				window.setTimeout(function() {
136					showPopup();
137				}, delay * 1000);
138
139				var mouseY = 0,
140	    			topValue = 0;
141
142				window.addEventListener('mouseout', function(e) {
143			        mouseY = e.clientY;
144			        if (mouseY < topValue) {
145			            showPopup();
146			        }
147			    },
148			    false);
149			}
150		}
151
152
153		$this.on('click', function(e) {
154			var $target = $(e.target);
155
156			if ($target.hasClass('stom_popup_toggle_wrapper') || $target.parents().hasClass('stom_popup_toggle_wrapper')) return togglePopup();
157
158			if ($target.hasClass('popup-full-link')) return setCookie();
159
160			if ($target.hasClass('stom_popup_close')) return closePopup();
161			if ($target.hasClass('stom_popup_wrapper')) return closePopup();
162		});
163
164
165		if ($this.hasClass('style-fold')) {
166			$(window).on('resize', handleContentSize);
167		}
168	});
169
170
171	$('.stom_popup_link').on('click', function(e) {
172		e.preventDefault();
173
174		var $this = $(this),
175			target = $this.attr('href').replace('#', '');
176
177		$('#' + target).show(anim_speed);
178
179		if (typeof gtag === "function") {
180			// manually opened popup
181			gtag('event', 'stom_popup_opened', {
182				'event_label': 'Popup ID: ' + $this.attr('id').match(/\d+/)[0],
183				'event_category': 'STOM Popups',
184				// 'non_interaction': true,
185			});
186		}
187	});
188})(jQuery);

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.