PageSourceSearch

https://javni.fo/site/templates/default/assets/javascripts/main.js

js javni.fo collected 2026-10-03 01:01:39 UTC 6,487 bytes, 189 lines download raw bytes

1$(function() {
2
3	// Browser checking
4	$.reject({
5		reject: {
6			//msie8: true;
7		},
8		closeCookie: false
9	});
10
11	// Searchbox
12	var $site_search__component = $('#site-search--component');
13	var $site_search__toggle = $site_search__component.find('.site-search--toggle');
14	$site_search__toggle.on('click', function () {
15		$site_search__component.toggleClass('site-search--component--visible');
16		if ($site_search__component.hasClass('site-search--component--visible')) {
17			$('#site-search--searchbox-input').focus();
18		}
19	});
20
21	// Searchbox autocomplete
22	/*var $site_search__searchbox__input = $('#site-search--searchbox-input');
23	$site_search__searchbox__input.autocomplete({
24		item_url: '{Url}',
25		item_param: '{Parameter}',
26		search_url: '',
27		results_class: 'site-search--results',
28		results_item_class: 'site-search--results-item',
29		results_insert_reference_element: '.site-search--searchbox-holder'
30	});*/
31
32	// Initialize Slideshows and AddThis
33	Ease.initializePlugins();
34
35	// Initialize Offcanvas menu
36	Offcanvas.initialize();
37
38	// Initiliaze Dotdotdot's
39	$('.dotdotdot').dotdotdot({
40		watch: 'window'
41	});
42	setTimeout(function () {
43		$('.dotdotdot').trigger('destroy').dotdotdot({
44			watch: 'window'
45		});
46	}, 3000);
47
48	// Alertbox close buttons
49	$('alertbox > .close').on('click', function (e) {
50		e.preventDefault();
51		var $this = $(this);
52		var target = $this.attr('data-target');
53		$(this).closest(target ? target : 'grid').slideUp(function () {
54			$(this).remove();
55		});
56	});
57
58	// Convert all # anchor tags to smooth scrolling
59	$('a[href*="#"]:not([href="#"])').click(function() {
60		if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') && location.hostname === this.hostname) {
61			var target = $(this.hash);
62			target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
63			if (target.length) {
64				$('html, body').animate({
65					scrollTop: target.offset().top
66				}, 1000);
67				return false;
68			}
69		}
70	});
71
72	// Fullscreenator
73	$(window).on('resize load', function () {
74		$('.fullscreenator').css({
75			width: $(window).width(),
76			height: Ease.isLoggedIn ? $(window).height() - 48 : $(window).height()
77		});
78	});
79
80	// Remove loader
81	$(window).on('load', function () {
82		$('#loader_spinner').fadeOut(300, function () {
83			$('#loader_holder').fadeOut(300);
84		});
85	});
86
87	$('.adgroup--lysing iframe').on('load', function() {
88		try {
89			$(this).contents().find("head").append($('<style type="text/css">canvas { width: 100% !important; height: 100% !important; }</style>'));
90		} catch (ex) {
91		}
92	});
93
94	// Iframe lazyloader
95	$('iframe[data-src]').each(function() {
96		var $this = $(this);
97		$this.attr('src', $this.attr('data-src')).removeAttr('data-src');
98	});
99
100});
101
102
103/**
104 * Initialize a newsgroup lazy loader (for use with multiple newsgroup componenets)
105 * @param limit
106 */
107var lazyLoader2_scrollBusy = false;
108var lazyLoader2 = function (limit) {
109	limit = (typeof limit !== 'undefined' && limit) ? limit : Tools.getQueryVariable('_Limit');
110	var $newsgroup_show_more = $('#newsgroup_show_more');
111	$newsgroup_show_more.on('click', function () {
112		var $newsgroup_show_more = $('#newsgroup_show_more');
113		$newsgroup_show_more.addClass('busy');
114		var newsgroupIds = $newsgroup_show_more.attr('data-ease-newsgroupids');
115		var $ease_newsgroup = $('.newsgroup--self').last();
116		$ease_newsgroup.attr('data-ease-buttonselector', '#newsgroup_show_more');
117		var language = $ease_newsgroup.attr('data-ease-language');
118		var excludenewsarticleid = $ease_newsgroup.attr('data-ease-excludenewsarticleid');
119		var offset = parseInt($ease_newsgroup.attr('data-ease-offset'), 10);
120		var interval = parseInt($ease_newsgroup.attr('data-ease-interval'), 10);
121		var template = $ease_newsgroup.attr('data-ease-template');
122		var search = $ease_newsgroup.attr('data-ease-search');
123		var $ease_newsarticles = $ease_newsgroup.find('.lazyRoot').not('.add');
124		var items = $ease_newsarticles.length;
125		$.get('/page_default.php', {
126			Offset: offset,
127			Limit: items,
128			Interval: interval,
129			NewsgroupIds: newsgroupIds,
130			Search: search,
131			p: 'newsgroup_lazy',
132			t: template,
133			Language:  language,
134			ExcludeNewsarticleId: excludenewsarticleid,
135			Append: true
136		}, function (html) {
137			var $html = $(html).find('.lazyRoot');
138			//$html = $html.length === 0 ? $(html) : $html;
139			var $ease_newsgroup = $('.newsgroup--self');
140			var previousCount = $ease_newsgroup.find('.lazyRoot').length;
141			$ease_newsgroup.find('.lazyRoot').last().after($html);
142			Ease.overlay && Ease.overlay.initialize($ease_newsgroup);
143			Ease.initializePlugins();
144			$ease_newsarticles = $ease_newsgroup.find('.lazyRoot').not('.add');
145			$ease_newsgroup.attr('data-ease-limit', $ease_newsarticles.length);
146			history.replaceState(null, '', '?' + Tools.getQuery('_Limit') + '&_Limit=' + $ease_newsarticles.length);
147			$newsgroup_show_more.removeClass('busy');
148			Revealator.refresh();
149			var currentCount = $ease_newsgroup.find('.lazyRoot').length;
150			if ((previousCount + interval) > currentCount) {
151				$('#newsgroup_show_more').hide();
152				lazyLoader2_scrollBusy = true;
153			} else {
154				lazyLoader2_scrollBusy = false;
155			}
156		});
157	});
158
159
160	// Auto activate lazyLoader2 on scroll to bottom
161	$(window).on('scroll resize load ready', function () {
162		if (!lazyLoader2_scrollBusy) {
163			lazyLoader2_scrollBusy = true;
164			setTimeout(function () {
165				var $newsgroup_show_more = $('#newsgroup_show_more');
166				if ($(window).scrollTop() + $(window).height() > $(document).height() - 400) {
167					$newsgroup_show_more.click();
168				} else {
169					lazyLoader2_scrollBusy = false;
170				}
171			}, 100);
172		}
173	});
174
175	window.onpopstate = function() {
176		var $newsgroup_show_more = $('#newsgroup_show_more');
177		var newsgroupIds = $newsgroup_show_more.attr('data-ease-newsgroupids');
178		var $ease_newsgroup = $('#ease_newsgroup_' + newsgroupIds);
179		var offset = parseInt($ease_newsgroup.attr('data-ease-offset'), 10);
180		var interval = parseInt($ease_newsgroup.attr('data-ease-interval'), 10);
181		$ease_newsgroup.attr('data-ease-limit', Tools.getQueryVariable('_Limit') ? Tools.getQueryVariable('_Limit') : interval);
182		Ease.newsgroups && Ease.newsgroups.onchange();
183	};
184
185	var $ease_newsarticles = $('.newsgroup--component').find('.lazyRoot').not('.add');
186	if ($ease_newsarticles.length < limit) {
187		$newsgroup_show_more.hide();
188	}
189};

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.