PageSourceSearch

https://lvm.fi/o/yja-lvm-theme/js/main.js?browserId=firefox&languageId=fi_FI&t=1790001278000

js lvm.fi collected 2026-09-24 18:10:35 UTC 4,917 bytes, 166 lines download raw bytes

1document.addEventListener("DOMContentLoaded", () => {
2	if(document.querySelector('body').classList.contains('lvm')){
3
4		function addPopupsToImages(targetImages){
5			let mqMobile = window.matchMedia('(max-width: 767px)');
6			const articleImages = jQuery(targetImages);
7			const PREVENT_POP_UP_CLASS = 'prevent-pop-up';
8			const UNDESIRABLE_PARENTS = 'a, button';
9
10			if(articleImages.length > 0 && !mqMobile.matches){
11				articleImages.each((i, element) => {
12
13					if(jQuery(element).parents(UNDESIRABLE_PARENTS).length === 0 && !jQuery(element).hasClass(PREVENT_POP_UP_CLASS) ) {
14						const imagePreview = '&imagePreview=1';
15						let popupSrc = jQuery(element).attr('src');
16
17						if( popupSrc.indexOf(imagePreview) !== -1 ){
18							popupSrc = popupSrc.replace(imagePreview,'');
19						}
20
21						const linkWrapper = '<a href="' + popupSrc + '" class="lightbox"></a>';
22
23						if( jQuery(element).parent('picture').length > 0 ){
24							element = jQuery(element).parent('picture');
25						}
26
27						jQuery(element).wrap(linkWrapper);
28					}
29				});
30
31				addLightbox('.lightbox');
32			}
33		}
34
35		function addLightbox(lighboxClass){
36			const imgEl = jQuery(lighboxClass);
37
38			if(imgEl.length > 0){
39				var close = 'Sulje';
40				imgEl.append("<span class='sr-only'>" + 'Avaa\x20täyskokoinen\x20kuva' + "</span>");
41				imgEl.magnificPopup({
42					type: 'image',
43					image: {
44						titleSrc: function(item) {
45							return item.el.find('img').attr('title');
46						},
47						markup: '<div class="mfp-figure" aria-label="' + 'Ponnahdusikkuna' + ' - (Press escape to close)" role="dialog">'+
48									'<div class="mfp-close"></div>'+
49									'<div class="mfp-img"></div>'+
50									'<div class="mfp-bottom-bar">'+
51										'<div class="mfp-title"></div>'+
52										'<div class="mfp-counter"></div>'+
53									'</div>'+
54								'</div>',
55						cursor: 'mfp-zoom-out-cur',
56						verticalFit: true,
57						tError: '<a href="%url%">The image</a> could not be loaded.'
58					},
59					tLoading: '',
60					closeMarkup: '<button title="'+ close +' (Esc)" type="button" id="mfp-close-button" class="mfp-close" aria-label="'+ close +'">x</button>'
61				});
62			}
63		}
64
65		if(document.querySelector('.journal-display-page')){
66			addPopupsToImages('.news-page img');
67		}
68
69		// Social media sharing links
70		jQuery('.btn-share, .social-share-buttons a').click(function(e){
71			e.preventDefault();
72			window.open(jQuery(this).attr('href'),'sharedialog','width=691,height=440');
73		});
74
75
76		/*
77		** Sidenavigation accordion
78		*/
79		if(jQuery('.list-menu')){
80			jQuery('.list-menu li').has('ul').addClass('has-children');
81			jQuery('li.selected').parents('li').addClass('selected');
82
83			jQuery('.list-menu .has-children > a').each(function() {
84				const pageName = jQuery(this).text();
85				const toggleButtonOpenSrElem = '<span class="sr-only">' + 'Avaa\x20alavalikko' + ', ' + pageName + '</span>';
86				const toggleButtonCloseSrElem = '<span class="sr-only">' + 'Sulje\x20alavalikko' + ', ' + pageName + '</span>';
87
88				if(jQuery(this).parent().hasClass('selected')){
89					jQuery(this).after('<button aria-expanded="true" class="toggleVisibility icon-chevron-down">' + toggleButtonCloseSrElem + '</button>');
90				}
91				else{
92					jQuery(this).after('<button aria-expanded="false" class="toggleVisibility icon-chevron-right">' + toggleButtonOpenSrElem + '</button>');
93				}
94			});
95
96			jQuery('.list-menu a').each(function(){
97				const link = jQuery(this);
98
99				if(link.parent('li').hasClass('selected')){
100					link.attr('aria-current', 'true');
101				}
102
103				if(link.hasClass('active')){
104					link.attr('aria-current', 'page');
105				}
106			});
107		}
108
109		jQuery('button.toggleVisibility').click(function() {
110			const elem = jQuery(this);
111			const pageName = elem.prev('a').text();
112			const toggleButtonOpenSrElem = '<span class="sr-only">' + 'Avaa\x20alavalikko' + ', ' + pageName + '</span>';
113			const toggleButtonCloseSrElem = '<span class="sr-only">' + 'Sulje\x20alavalikko' + ', ' + pageName + '</span>';
114
115			jQuery(elem.next('ul')).slideToggle('fast');
116
117			if (elem.hasClass('icon-chevron-right')) {
118				elem.removeClass('icon-chevron-right');
119				elem.addClass('icon-chevron-down');
120				elem.attr('aria-expanded', 'true');
121				elem.html(toggleButtonCloseSrElem);
122			} else {
123				elem.removeClass('icon-chevron-down');
124				elem.addClass('icon-chevron-right');
125				elem.attr('aria-expanded', 'false');
126				elem.html(toggleButtonOpenSrElem);
127			}
128		});
129	}
130});
131
132AUI().ready(
133
134	/*
135	This function gets loaded when all the HTML, not including the portlets, is
136	loaded.
137	*/
138
139	function() {
140	}
141);
142
143Liferay.Portlet.ready(
144
145	/*
146	This function gets loaded after each and every portlet on the page.
147
148	portletId: the current portlet's id
149	node: the Alloy Node object of the current portlet
150	*/
151
152	function(portletId, node) {
153	}
154);
155
156Liferay.on(
157	'allPortletsReady',
158
159	/*
160	This function gets loaded when everything, including the portlets, is on
161	the page.
162	*/
163
164	function() {
165	}
166);

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.