PageSourceSearch

https://ditleksikon.dk/wp-content/themes/newsanchor/js/main.js?ver=1708703769?ver=1708703769

js ditleksikon.dk collected 2026-10-09 05:01:29 UTC 16,396 bytes, 463 lines download raw bytes

1document.addEventListener('DOMContentLoaded', function () {
2	var selector = document.querySelectorAll("[data-size='medrec']");
3    for (var i = 0; i < selector.length; i++) {
4        $(selector[i]).attr('id', 'skm-ad-medrec-' + (i + 1));
5    }
6	
7	const filterButtons = document.querySelectorAll(".tag-filter-button");
8                const tagGroups = document.querySelectorAll(".tag-group");
9
10                filterButtons.forEach(button => {
11                    button.addEventListener("click", function() {
12                        const selectedLetter = this.getAttribute("data-letter");
13
14                        // Add the active class to the clicked button and remove it from others
15                        filterButtons.forEach(btn => {
16                            if (btn === button) {
17                                btn.classList.add("active");
18                            } else {
19                                btn.classList.remove("active");
20                            }
21                        });
22                        
23                        tagGroups.forEach(tagGroup => {
24                            const groupLetter = tagGroup.id.split("-")[1];
25                            if (groupLetter === selectedLetter || selectedLetter === '0-9' || selectedLetter === null) {
26                                tagGroup.scrollIntoView({ behavior: 'smooth' });
27                            }
28                        });
29                    });
30                });
31	
32    // Lazy load shemedia
33    /*
34    if ('IntersectionObserver' in window) {
35        let observer = new IntersectionObserver((entries, observer) => {
36            entries.forEach(entry => {
37
38                if (entry.isIntersecting) {
39                    //if (!entry.target.classList.contains('loaded')) {
40                    var dataSize = entry.target.getAttribute('data-size');
41                    var id = entry.target.getAttribute('id');
42					console.log("push",dataSize,id);
43                    blogherads.adq.push([dataSize, id]);
44
45                    observer.unobserve(entry.target);
46                    observer.unobserve(document.getElementById(id));
47                    //entry.target.classList.add('loaded');
48                    //}
49                    //else {
50                    //observer.unobserve(entry.target);
51                    //}
52                }
53
54            });
55        }, {
56            rootMargin: "400px 0px 0px 0px"
57        });
58
59        document.querySelectorAll('.lazyshemedia').forEach(ad => {
60            observer.observe(ad)
61        });
62
63    } else {
64        document.querySelectorAll('.lazyshemedia').forEach(function(e) {
65            var dataSize = entry.target.getAttribute('data-size');
66            var id = entry.target.getAttribute('id');
67			console.log("fallback push",dataSize,id);
68            blogherads.adq.push([dataSize, id]);
69
70        })
71    }
72	*/
73}); 
74
75;(function($) {
76
77    'use strict'
78    
79    var width = $(window).width();
80    
81    function paginationHTML() {
82        if ($('.page-numbers')) {
83            $('.page-numbers').each(function() {
84                var html = $(this).html();
85                $(this).html('<div>' + html + '</div>');
86            });
87        }
88    }
89    
90    //Mobile menu
91    function preOpenNav() {
92        var related_itemID = $('.current-parent .sub-toggle').attr('data-target');
93    
94        if (related_itemID) {
95            $('.current-parent .sub-toggle').addClass('open');
96            $('#mobile-parent-' + related_itemID).addClass('selected');
97            $('#mobile-sub-' + related_itemID).toggle(true);
98            $('#mobile-sub-' + related_itemID).css("display", "block");
99        }
100    }
101    
102    function assignMoreCateIcon() {
103        if ($('#mobile-category') && width < 1024) {
104            $('#mobile-category .primary-menu >li').each(function() {
105                var cate = $(this).children('a').html();
106                if (cate == 'More Facts' || cate == 'MORE FACTS') {
107                    cate = '<span>' + cate + '</span>' + '<i class="fab fa-angle-right"></i>';
108                    $(this).children('a').html(cate);
109                }
110            });
111        }
112    }
113    //Go top button
114    var goTop = function() {
115        $(window).scroll(function() {
116            if ($(this).scrollTop() > 600) {
117                $('.go-top').addClass('show');
118            } else {
119                $('.go-top').removeClass('show');
120            }
121        });
122    
123        $('.go-top, .go-top2').on('click', function() {
124            $("html, body").animate({
125                scrollTop: 0
126            }, 1000);
127            return false;
128        });
129    
130        $(window).on('load scroll', function() {
131            $('.go-top2').each(function(e) {
132                if (this.getBoundingClientRect().top < $(window).height()) {
133                    $('.go-top').addClass('hide');
134                    $('.go-top2').addClass('show');
135                } else {
136                    $('.go-top').removeClass('hide');
137                    $('.go-top2').removeClass('show');
138                }
139            })
140        })
141    };
142    $(document).ready(function () {
143    function adjustMenuItems() {
144        const menu = $('#desktop-nav');
145        const menuItems = menu.children('.desktop-navItem');
146        const menuWidth = menu.width();
147        let totalWidth = 0;
148
149        // Check if "Others" dropdown already exists
150        let othersDropdown = $('#desktop-nav .others ul');
151
152        if (othersDropdown.length === 0) {
153            // Create "Others" dropdown if not present
154            $('<li id="parent-47343" class="desktop-navItem others hide-init" style="display:none"><a href="#" data-child="47343">...</a><ul class="secondary-menu hidden-imp"></ul></li>').appendTo(menu);
155            othersDropdown = $('#desktop-nav .others ul');
156        }
157	othersDropdown.empty();
158
159        // Iterate through menu items
160        menuItems.each(function () {
161            totalWidth += $(this).outerWidth(true);
162
163            if (totalWidth > menuWidth && !$(this).hasClass('others')) {
164				console.log ('true');
165                $(this).clone().appendTo(othersDropdown);
166
167                $(this).remove();
168            }
169			
170        });
171
172        // Check if any items are in "Others" dropdown
173        console.log(`#of children: ${othersDropdown.children().length}`);
174        if (othersDropdown.children().length > 0) {
175            // Move "..." to the end of the main menu
176            $('#desktop-nav .others').appendTo(menu);
177			$('#desktop-nav .others').show();
178        } else {
179            // Hide "Others" dropdown if it's empty
180            $('#desktop-nav .others').hide();
181        }
182    }
183
184    // Call adjustMenuItems on document ready
185    adjustMenuItems();
186
187    // Handle window resize event
188    $(window).on('resize', function () {
189        // Reset the menu items to the main menu before reevaluating
190        $('#desktop-nav .others ul .desktop-navItem').appendTo('#desktop-nav');
191
192        // Call adjustMenuItems again
193        adjustMenuItems();
194        navMenu();
195    });
196
197    // Additional styling adjustment
198    $('.main-header-full-width #mainnav').css('overflow-y', 'visible');
199	$('.main-header-full-width #mainnav').css('overflow-x', 'visible');
200});
201    
202    // DOM Ready
203    $(function() {
204        paginationHTML();
205        preOpenNav();
206        assignMoreCateIcon();
207        goTop();
208    });
209    
210    $(window).on('load', function() {
211        //Resize
212        $(window).on('resize', function() {
213            var currMenuType = (width > 991) ? 'mobile' : 'desktop';
214            if (currMenuType == 'mobile') {
215                $('.btn-menu').removeClass('active');
216            } else {
217                var $desktopMenu = $('#mainnav-mobi').attr('id', 'mainnav').removeAttr('style');
218                $desktopMenu.find('.sub-menu').removeAttr('style');
219            }
220        });
221    
222        //Go top button
223        // 	$('.go-top2').on('click', function() {
224        // 		$("html, body").animate({ scrollTop: 0 }, 1000);
225        // 		return false;
226        // 	});
227    
228        //Sub toggle
229        $('.sub-toggle').on('click', function() {
230            var target = $(this).attr('data-target');
231    
232            if ($(this).hasClass('open')) {
233                $(this).removeClass('open');
234                $('#mobile-parent-' + target).removeClass('selected');
235            } else {
236                $(this).addClass('open');
237                $('#mobile-parent-' + target).addClass('selected');
238            }
239    
240            $('#mobile-sub-' + target).toggle();
241        });
242    
243        //Nav toggle
244        $('#nav-toggle').on('click', function() {
245            $('#mobile-menu').slideToggle(300);
246    
247            if ($(this).hasClass('active')) {
248                $(this).removeClass('active');
249                $("body").css('overflow', 'scroll');
250            } else {
251                $(this).toggleClass('active');
252                $("body").css('overflow', 'hidden');
253            }
254        });
255    });
256    if ('shareBtn' in window) {
257        var shareBtn = document.querySelector(".copy-url");
258    
259        shareBtn.addEventListener('click', function(event) {
260            var dummy = document.createElement('input'),
261                text = window.location.href;
262    
263            document.body.appendChild(dummy);
264            dummy.value = text;
265            dummy.select();
266            document.execCommand('copy');
267            document.body.removeChild(dummy);
268            alert("Post URL successfully copied!");
269        });
270    }
271	
272	// if (window.matchMedia("(min-width: 1200px)").matches) 
273	//   {   
274	// 		document.addEventListener('DOMContentLoaded', function () {
275	// 		$('#sidebar-ads').stickySidebar({
276	// 			sidebarTopMargin: 110,
277	// 			footerThreshold: 100
278	// 		});
279
280	//     }, false);
281	// 	 } 
282    
283    // if ('IntersectionObserver' in window) {
284    // 	let observer = new IntersectionObserver((entries, observer) => {
285    // 		entries.forEach(entry => {
286    
287    // 		   if (entry.isIntersecting) {
288    
289    // 				var jsFile = document.createElement("script");	
290    // 				jsFile.src = '//widgets.outbrain.com/outbrain.js';  // it can be path also  "{themes('/scripts/homePage.js')}"
291    // 				document.body.appendChild(jsFile);  //append it as src to body
292    // 				console.log('show ad');
293    // 				observer.unobserve(entry.target);               
294    // 			}
295    
296    // 		});
297    // 	}, { rootMargin: "400px 0px 0px" });
298    // 	document.querySelectorAll('.OUTBRAIN').forEach(ad => { observer.observe(ad) });
299    
300    //   } 
301    //   else {
302    // 	  var jsFile = document.createElement("script");	
303    // 				jsFile.src = '//widgets.outbrain.com/outbrain.js';  // it can be path also  "{themes('/scripts/homePage.js')}"
304    // 				document.body.appendChild(jsFile);  //append it as src to body
305    
306    //    } 
307    
308    // Lazy Load waldo Ads
309    //     if ('IntersectionObserver' in window) {
310    // 	let observer = new IntersectionObserver((entries, observer) => {
311    // 		entries.forEach(entry => {
312    
313    // 		   if (entry.isIntersecting) {
314    
315    // 				var id = entry.target.getAttribute('id')
316    // 				id = id.replace('lazydo','waldo');
317    // 				entry.target.setAttribute('id', id );
318    // 				waldo.refreshTag(id);
319    // 				observer.unobserve(entry.target);      
320    // 				console.log(id); 
321    // 			}
322    
323    // 		});
324    // 	}, { rootMargin: "400px 0px 0px 0px" });
325    
326    //    document.querySelectorAll('.lazydo').forEach(ad => { observer.observe(ad) });
327    
328    //   } 
329    //   else {
330    // 	document.querySelectorAll('.lazydo').forEach(function(e){
331    // 		var current_id = e.id;
332    // 		var new_id = current_id.replace('lazydo','waldo');
333    // 		e.id = new_id;
334    // 		console.log(e.id)
335    // 	})
336    // }    
337    
338    // End Lazy Load waldo Ads
339    /*
340    var selector = document.querySelectorAll("[data-size='medrec']");
341    for (var i = 0; i < selector.length; i++) {
342        $(selector[i]).attr('id', 'skm-ad-medrec-' + (i + 1));
343    }
344	
345    // Lazy load shemedia
346    if ('IntersectionObserver' in window) {
347        let observer = new IntersectionObserver((entries, observer) => {
348            entries.forEach(entry => {
349    
350                if (entry.isIntersecting) {
351                    //if (!entry.target.classList.contains('loaded')) { 
352                    var dataSize = entry.target.getAttribute('data-size');
353                    var id = entry.target.getAttribute('id');
354					console.log("push shemedia:",dataSize,id);
355                    blogherads.adq.push([dataSize, id]);
356    
357                    observer.unobserve(entry.target);
358                    observer.unobserve(document.getElementById(id));
359                    //entry.target.classList.add('loaded');
360                    //}
361                    //else {
362                    //observer.unobserve(entry.target);
363                    //}
364                }
365    
366            });
367        }, {
368            rootMargin: "400px 0px 0px 0px"
369        });
370    
371        document.querySelectorAll('.lazyshemedia').forEach(ad => {
372            observer.observe(ad)
373        });
374    
375    } else {
376        document.querySelectorAll('.lazyshemedia').forEach(function(e) {
377            var dataSize = entry.target.getAttribute('data-size');
378            var id = entry.target.getAttribute('id');
379			console.log("push shemedia:",dataSize,id);
380            blogherads.adq.push([dataSize, id]);
381    
382        })
383    }
384    */
385    jQuery.event.special.touchstart = {
386        setup: function(_, ns, handle) {
387            this.addEventListener("touchstart", handle, {
388                passive: true
389            });
390        }
391    };
392
393    
394    var youtube = document.querySelectorAll(".youtube-featured");
395    
396    for (var i = 0; i < youtube.length; i++) {
397    
398        youtube[i].addEventListener("click", function() {
399    
400            var iframe = document.createElement("iframe");
401    
402            iframe.setAttribute("frameborder", "0");
403            iframe.setAttribute("allowfullscreen", "");
404            iframe.setAttribute("src", "https://www.youtube.com/embed/" + this.dataset.embed + "?rel=0&showinfo=0&autoplay=1");
405    
406            this.innerHTML = "";
407            this.appendChild(iframe);
408        });
409    };
410    
411    $(function() {
412        navMenu();
413      $("#sticky-footer-ads-close").click(function(){
414        $("#sticky-footer-ads").hide();
415      });
416      $("#hide").click(function(){
417        $("#sticky-footer-ads").hide();
418        $("#hide").hide();	
419      });
420    });
421     
422    // Remove Empty H2
423    jQuery(".single-title-desc-wrap h2").filter(":empty").remove();
424    
425    //     $(document).ready(function(){
426    //     $('<script/>',{type:'text/javascript', src:'https://ads.blogherads.com/static/blogherads.js'}).appendTo('footer');
427    //     $('<script/>',{type:'text/javascript', src:'https://ads.blogherads.com/sk/12/123/1232980/27709/header.js'}).appendTo('footer');
428    //  });  
429    })(jQuery);
430
431    //lazyload Google Ads
432    // if ('IntersectionObserver' in window) {
433
434    //     document.addEventListener("DOMContentLoaded", function() {
435
436    //         const options = {rootMargin: '200px', threshold: 0.25};
437    //         const observer = new IntersectionObserver((entries, observer)=>{
438    //         entries.forEach(entry=>{
439    //             if(entry.intersectionRatio >= 0.25) {
440    //             const {target} = entry;
441    //             const slotid = target.dataset.slotid;
442    //             const slot = target.querySelector('ins');
443    //              console.log('ADS', slotid, 'W', slot.clientWidth, 'H', slot.clientHeight);
444    //             if(!slot.classList.contains('loaded') && slot.dataset.adsbygoogleStatus !== 'done') {
445    //                  console.log('ADS F', slotid);
446    //                 slot.classList.add('adsbygoogle');
447    //                 (adsbygoogle = window.adsbygoogle || []).push({});
448
449    //             }
450    //             }
451    //         })
452    //         }, options);
453
454    //         document.querySelectorAll('div.adsense').forEach(ad => { observer.observe(ad) });
455    //     });
456
457    // } else {
458    //     document.querySelectorAll('[class^="responsive"] ins').forEach(ad => {
459    //         var mySlotId = jQuery(ad).attr("data-ad-slot");
460    //         (adsbygoogle = window.adsbygoogle || []).requestNonPersonalizedAds = 1;
461    //         (adsbygoogle = window.adsbygoogle || []).push({ params: { google_ad_slot: mySlotId } });
462    //     });
463    // }

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.