PageSourceSearch

https://stm.fi/o/yja-stm-theme/js/main.js?browserId=chrome&languageId=se_FI&t=1790001324000

js stm.fi collected 2026-09-24 17:43:42 UTC 5,355 bytes, 160 lines download raw bytes

1jQuery(document).ready(function(){
2/*	if(jQuery('#content > div.frontpage').length){
3		var dropdownHeight = jQuery('#dropdown-menu').height();
4		jQuery('#content').css({'margin-top':dropdownHeight+40+'px'});
5	}
6*/	
7	jQuery('.js-toggle-special-nav').on('hover', function(){
8		if(jQuery('#dropdown-menu').hasClass('hidden')){
9			jQuery(this).removeClass('icon-chevron-down').addClass('icon-chevron-up');
10		} else {
11			jQuery(this).removeClass('icon-chevron-up').addClass('icon-chevron-down');
12		}
13	});
14	
15	if(jQuery('html').hasClass('touch') || jQuery('body').hasClass('homepage')) {
16	
17	    jQuery('.top-bar-section').find('.stm-js-toggle-special-nav > .icon').click(function(e){
18	    	e.preventDefault();
19	      	var elem = jQuery(this);
20	    	if ( elem.hasClass('icon-chevron-down') ) {
21	    		elem.removeClass('icon-chevron-down').addClass('icon-chevron-up');
22	       	} else if (elem.hasClass('icon-chevron-up') ) {
23	       		elem.removeClass('icon-chevron-up').addClass('icon-chevron-down');
24	    	}
25	        jQuery('.special-nav').toggleClass('hidden');
26	        jQuery('.special-nav-trigger').toggleClass('closed').parent().toggleClass("special-nav-open special-nav-closed");
27	    });
28	    
29	} else {
30	    jQuery('.top-bar-section').find('.stm-js-toggle-special-nav').hover(function(e){
31	        jQuery('.special-nav').toggleClass('hidden');
32	        jQuery('.special-nav-trigger').toggleClass('closed').parent().toggleClass("special-nav-open special-nav-closed");
33	    });
34		
35	}
36	
37	
38	toggleStmFooterMenu();
39
40
41	jQuery('.stm-ukk .question').on('tap click', function(){
42		jQuery(this).find(".icon").toggleClass('icon-plus');
43		jQuery(this).find(".icon").toggleClass('icon-minus');
44		jQuery(this).closest('li').toggleClass('open');
45		jQuery(this).closest('li').find('.answer').slideToggle('fast');
46
47		if (jQuery(this).closest('li').hasClass('open')) {
48			jQuery(this).closest('li').find('.answer').attr('aria-hidden', 'false')
49			jQuery(this).attr('aria-expanded', 'true')
50		} else {
51			jQuery(this).closest('li').find('.answer').attr('aria-hidden', 'true')
52			jQuery(this).attr('aria-expanded', 'false')
53		}
54	});
55
56	// YJASTM-895
57	if ($(window).width() > 767) {
58		if (!jQuery('.current').hasClass('special-nav-trigger') || jQuery('.current').length === 0) {
59			$(".special-nav").attr("aria-hidden", "false");
60			$(".special-nav").removeClass("d-none");
61			$(".special-nav-trigger button").attr("aria-hidden", "false");
62			$(".special-nav-trigger button").attr("aria-expanded", "true");
63			$("li.special-nav-trigger").addClass("special-nav-open").removeClass("special-nav-closed");
64			$(".js-toggle-special-nav .icon").removeClass("icon-plus");
65			$(".js-toggle-special-nav .icon").addClass("icon-minus");
66		}
67	}
68});
69
70
71$(".main-nav .title-area").click(function () {
72	$(".top-bar-section ul").toggle();
73	$(".bg-image").toggleClass("active");
74});
75
76$(window).resize(function() {
77	if ($(window).width() > 767) {
78		$(".top-bar-section ul").show();
79		$(".bg-image").removeClass("active");
80	}
81});
82
83function resolveStmFooterMenuHeight() {
84    var list = $('#stm-footer-site-selectionlist');
85    var totalHeight = 0;
86    $(list).children().each(function() {
87        totalHeight = totalHeight + $(this).outerHeight(true);
88    });
89    return totalHeight;
90}
91
92function toggleStmFooterMenu() {
93    var list = $('#stm-footer-site-selectionlist');
94    var totalHeight = resolveStmFooterMenuHeight();
95    list.addClass('close');
96    $('#stmFooterMenuToggle, #stmFooterBureauName').click(function (e) {
97        e.stopPropagation();
98        e.preventDefault();
99        list.toggleClass('open');
100        $("#stmFooterMenuToggle").toggleClass('open');
101        if (list.hasClass('open')) {
102            list.css('bottom', $('#stm-footer').outerHeight(true) + 'px');
103            list.css('height', totalHeight);
104            list.removeClass('close');
105        } else {
106            list.css('height', 0);
107            list.one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(e) {
108                if (parseInt(list.css('height')) == 0) {
109                    list.addClass('close');
110                }
111            });
112        }
113    });
114}
115
116/* YJASTM-407 Stm.fin ylänavigaation muutos --> */
117
118if( $("body").hasClass("stm") ){
119	if( $(".special-nav").hasClass("hidden") ){
120		$(".special-nav div ul.child-menu").attr("aria-expanded","false");
121	}
122	else{
123		$(".special-nav div ul.child-menu").attr("aria-expanded","true");
124	}
125}
126else{
127
128	if( $(".special-nav").hasClass("hidden") ){
129		$("body.stm #content").css("margin-top","-340px");
130		$(".special-nav div ul.child-menu").attr("aria-expanded","false");
131	}
132	else{
133		$("body.stm #content").css("margin-top","-113px");
134		$(".special-nav div ul.child-menu").attr("aria-expanded","true");
135	}
136}
137
138$(".special-nav-trigger").click(function(){
139
140	if( $("body").hasClass("stm") ){
141		if( $(".special-nav").hasClass("hidden") ){
142			$(".special-nav div ul.child-menu").attr("aria-expanded","false");
143		} else{
144			$(".special-nav div ul.child-menu").attr("aria-expanded","true");
145		}
146	}
147	else{
148
149
150		if( $(".special-nav").hasClass("hidden") ){
151			$(" body.stm #content").css("margin-top","-340px");
152			$(".special-nav div ul.child-menu").attr("aria-expanded","false");
153		} else{
154			$(" body.stm #content").css("margin-top","-113px");
155			$(".special-nav div ul.child-menu").attr("aria-expanded","true");
156		}
157	}
158
159
160});

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.