PageSourceSearch

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

js gfestival.fo collected 2026-10-02 11:39:42 UTC 8,734 bytes, 247 lines download raw bytes

1var mailchimpResponse;
2$(function() {
3	var $body = $('body');
4
5	// Browser checking
6	$.reject({
7		reject: {
8			//msie8: true;
9		},
10		closeCookie: false
11	});
12
13	$(".no-cookie--click").click(function () {
14		Qookies.showDialog();
15	});
16	
17	// Searchbox
18	var $site_search__component = $('#search');
19	var $site_search__toggle = $site_search__component.find('.search_toggle');
20	$site_search__toggle.on('click', function () {
21		$site_search__component.toggleClass('visible');
22		if ($site_search__component.hasClass('visible')) {
23			$('#textboxSearchSite').focus();
24		}
25	});
26
27	// Searchbox autocomplete
28	var $site_search__searchbox__input = $('#textboxSearchSite');
29	$site_search__searchbox__input.autocomplete({
30		item_url: '/{Type}?_l=' + Ease.siteLanguage + '&',
31		item_param: '{Parameter}',
32		search_url: '',
33		results_class: 'searchSiteResults'
34	});
35
36	// Initialize Slideshows and AddThis
37	Ease.initializePlugins();
38
39	// Initialize Offcanvas menu
40	Offcanvas.initialize();
41
42	// Initiliaze Dotdotdot's
43	$('.dotdotdot').dotdotdot({
44		watch: 'window'
45	});
46	setTimeout(function () {
47		$('.dotdotdot').trigger('destroy').dotdotdot({
48			watch: 'window'
49		});
50	}, 3000);
51
52	// Alertbox close buttons
53	$('alertbox > .close').on('click', function (e) {
54		e.preventDefault();
55		var $this = $(this);
56		var target = $this.attr('target');
57		$(this).closest(target ? target : 'grid').slideUp(function () {
58			$(this).remove();
59		});
60	});
61
62	// Convert all # anchor tags to smooth scrolling
63	$('a[href*="#"]:not([href="#"])').click(function() {
64		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
65			var target = $(this.hash);
66			target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
67			if (target.length) {
68				$('html, body').animate({
69					scrollTop: target.offset().top
70				}, 1000);
71				return false;
72			}
73		}
74	});
75	
76	// Fullscreenator
77	$(window).on('resize load', function () {
78		$('.fullscreenator').css({
79			width: $(window).width(),
80			height: Ease.isLoggedIn ? $(window).height() - 48 : $(window).height()
81		});
82	});
83
84	// Remove loader
85	$(window).on('load', function () {
86		$('#loader_spinner').fadeOut(300, function () {
87			$('#loader_holder').fadeOut(300);
88		});
89	});
90
91	// Iframe lazyloader
92	$('iframe[data-src]').each(function() {
93		var $this = $(this);
94		$this.attr('src', $this.attr('data-src')).removeAttr('data-src');
95	});
96
97	// Mailchimp newsletter signup
98	mailchimpResponse = function(data) {
99		if (data.result === 'success') {
100			data.msg = data.msg.replace(/<a.+<\/a>/g, "").replace(/<\/?[^>]+(>|$)/g, "");
101			$('#newsletter_signup_alertbox').find('alertbox').removeAttr('warning').attr('success', true).text(data.msg).parent().slideDown();
102			$('#newsletter_signup_form')[0].reset();
103		} else if (data.result === 'error') {
104			data.msg = data.msg.replace(/<a.+<\/a>/g, "").replace(/<\/?[^>]+(>|$)/g, "");
105			$('#newsletter_signup_alertbox').find('alertbox').removeAttr('success').attr('warning', true).text(data.msg).parent().slideDown();
106		} else {
107			$('#newsletter_signup_alertbox').find('alertbox').removeAttr('success').attr('warning', true).text('news_subscription_error (1)').parent().slideDown();
108		}
109	};
110	$('#newsletter_signup_form').submit(function (e) {
111		e.preventDefault();
112		e.stopPropagation();
113		if (Validator.validate('#newsletter_signup_form')) {
114			var id = $(this).find('#hiddenId').val();
115			var email = $(this).find('#textboxEmail').val();
116			var fullname = $(this).find('#textboxName').val();
117			var firstname = fullname.substr(0, fullname.indexOf(' '));
118			var lastname = fullname.substr(fullname.indexOf(' ') + 1);
119			if (firstname === '' && lastname !== '') {
120				firstname = lastname;
121				lastname = '';
122			}
123			$.get('https://Gfestival.us10.list-manage.com/subscribe/post-json', {
124				'u':     '1d56a089f1532d0a719662347',
125				'id':    id,
126				'EMAIL': email,
127				'FNAME': firstname,
128				'LNAME': lastname,
129				'c' :    'mailchimpResponse'
130			}, function (data) { console.log(data) }, 'jsonp');
131			
132		}
133	});
134
135	// $('#newsletter_signup_form').submit(function (e) {
136	// 	e.preventDefault();
137	// 	e.stopPropagation();
138	// 	if (Validator.validate('#newsletter_signup_form')) {
139	// 		var id = $(this).find('#hiddenId').val();
140	// 		var email = $(this).find('#textboxEmail').val();
141	// 		var fullname = $(this).find('#textboxName').val();
142	// 		var firstname = fullname.substr(0, fullname.indexOf(' '));
143	// 		var lastname = fullname.substr(fullname.indexOf(' ') + 1);
144	// 		if (firstname === '' && lastname !== '') {
145	// 			firstname = lastname;
146	// 			lastname = '';
147	// 		}
148	// 		$.get('https://Gfestival.us10.list-manage.com/subscribe/post-json', {
149	// 			'u':     '1d56a089f1532d0a719662347',
150	// 			'id':    id,
151	// 			'EMAIL': email,
152	// 			'FNAME': firstname,
153	// 			'LNAME': lastname,
154	// 			'c' :    'mailchimpResponse'
155	// 		}, function (data) { }, 'jsonp');
156	//
157	// 	}
158	// });
159});
160
161/**
162 * Initialize a newsgroup lazy loader (for use with multiple newsgroup componenets)
163 * @param limit
164 */
165var lazyLoader2_scrollBusy = false;
166var lazyLoader2 = function (limit) {
167	limit = (typeof limit !== 'undefined' && limit) ? limit : Tools.getQueryVariable('_Limit');
168	var $newsgroup_show_more = $('#newsgroup_show_more');
169	$newsgroup_show_more.on('click', function () {
170		var $newsgroup_show_more = $('#newsgroup_show_more');
171		$newsgroup_show_more.addClass('busy');
172		var newsgroupIds = $newsgroup_show_more.attr('data-ease-newsgroupids');
173		var $ease_newsgroup = $('.newsgroup--self').last();
174		$ease_newsgroup.attr('data-ease-buttonselector', '#newsgroup_show_more');
175		var language = $ease_newsgroup.attr('data-ease-language');
176		var excludenewsarticleid = $ease_newsgroup.attr('data-ease-excludenewsarticleid');
177		var offset = parseInt($ease_newsgroup.attr('data-ease-offset'), 10);
178		var interval = parseInt($ease_newsgroup.attr('data-ease-interval'), 10);
179		var template = $ease_newsgroup.attr('data-ease-template');
180		var search = $ease_newsgroup.attr('data-ease-search');
181		var $ease_newsarticles = $ease_newsgroup.find('.lazyRoot').not('.add');
182		var items = $ease_newsarticles.length;
183		$.get('/page_default.php', {
184			Offset: offset,
185			Limit: items,
186			Interval: interval,
187			NewsgroupIds: newsgroupIds,
188			Search: search,
189			p: 'newsgroup_lazy',
190			t: template,
191			Language:  language,
192			ExcludeNewsarticleId: excludenewsarticleid,
193			Append: true
194		}, function (html) {
195			var $html = $(html).find('.lazyRoot');
196			//$html = $html.length === 0 ? $(html) : $html;
197			var $ease_newsgroup = $('.newsgroup--self');
198			var previousCount = $ease_newsgroup.find('.lazyRoot').length;
199			$ease_newsgroup.find('.lazyRoot').last().after($html);
200			Ease.overlay && Ease.overlay.initialize($ease_newsgroup);
201			Ease.initializePlugins();
202			$ease_newsarticles = $ease_newsgroup.find('.lazyRoot').not('.add');
203			$ease_newsgroup.attr('data-ease-limit', $ease_newsarticles.length);
204			history.replaceState(null, '', '?' + Tools.getQuery('_Limit') + '&_Limit=' + $ease_newsarticles.length);
205			$newsgroup_show_more.removeClass('busy');
206			Revealator.refresh();
207			var currentCount = $ease_newsgroup.find('.lazyRoot').length;
208			if ((previousCount + interval) > currentCount) {
209				$('#newsgroup_show_more').hide();
210				lazyLoader2_scrollBusy = true;
211			} else {
212				lazyLoader2_scrollBusy = false;
213			}
214		});
215	});
216
217
218	// Auto activate lazyLoader2 on scroll to bottom
219	$(window).on('scroll resize load ready', function () {
220		if (!lazyLoader2_scrollBusy) {
221			lazyLoader2_scrollBusy = true;
222			setTimeout(function () {
223				var $newsgroup_show_more = $('#newsgroup_show_more');
224				if ($(window).scrollTop() + $(window).height() > $(document).height() - 400) {
225					$newsgroup_show_more.click();
226				} else {
227					lazyLoader2_scrollBusy = false;
228				}
229			}, 100);
230		}
231	});
232
233	window.onpopstate = function() {
234		var $newsgroup_show_more = $('#newsgroup_show_more');
235		var newsgroupIds = $newsgroup_show_more.attr('data-ease-newsgroupids');
236		var $ease_newsgroup = $('#ease_newsgroup_' + newsgroupIds);
237		var offset = parseInt($ease_newsgroup.attr('data-ease-offset'), 10);
238		var interval = parseInt($ease_newsgroup.attr('data-ease-interval'), 10);
239		$ease_newsgroup.attr('data-ease-limit', Tools.getQueryVariable('_Limit') ? Tools.getQueryVariable('_Limit') : interval);
240		Ease.newsgroups && Ease.newsgroups.onchange();
241	};
242
243	var $ease_newsarticles = $('.newsgroup--component').find('.lazyRoot').not('.add');
244	if ($ease_newsarticles.length < limit) {
245		$newsgroup_show_more.hide();
246	}
247};

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.