PageSourceSearch

https://hbk.se/site/js/subpage.js

js hbk.se collected 2026-10-02 12:52:21 UTC 9,015 bytes, 219 lines download raw bytes

1$(document).ready(function() {
2	var $body = $('html, body'),
3		$h2 = $('h2'),
4		$wrapper = $('.-left .m-subNav__wrapper');
5
6	if($wrapper.length > 0) {
7		var	wrapperTopPosition = $wrapper.position().top;
8
9		$h2.each(function(){
10			$anchorLink = $(this);
11			anchorLinkName = $(this).html();
12			anchorLinkNameTrim = $.trim(anchorLinkName).replace(' ','');
13			anchorLinkNameTrim = $.trim(anchorLinkNameTrim).replace(/ /g, "").replace(/–/g, "o").replace(/ä/g, "a").replace(/Ã¥/g, "a").replace(/ö/g, "o").replace(/Ä/g, "a").replace(/Å/g, "a").replace(/Ö/g, "o");
14			$anchorLink.attr("id", anchorLinkNameTrim);
15			$('<a class="m-subNav__item" href="#'+anchorLinkNameTrim+'">'+anchorLinkName+'</a>').appendTo($('.m-article__column.-left .m-subNav__wrapper.-desktop, .m-article__column.-left .m-subNav__wrapper.-mobile .m-subNav__innerWrapper'));
16		});
17
18		if($h2.length <= 1) $wrapper.hide();
19
20		$body.find('.m-subNav__item').on('click', function() {
21
22			var $this = $(this),
23				href = $this.attr('href'),
24				$target = $(href),
25				calc = $target.position().top;
26
27			$body.animate({
28				scrollTop: calc +'px'
29			});
30
31			return false;
32		});
33
34		$(document).on('scroll', function() {
35			$wrapper.toggleClass('-scrolled', $(this).scrollTop() >= wrapperTopPosition);
36		});
37	}
38
39	$('.m-subNav__item.-active').on('click', function( e ){
40		e.stopPropagation();
41		e.preventDefault();
42		if($(this).parent('.m-subNav__wrapper').hasClass('open')){
43			$(this).next('.m-subNav__innerWrapper').css('height', 0);
44			$(this).parent('.m-subNav__wrapper').removeClass('open');
45		}else {
46			var $elem = $(this).next('.m-subNav__innerWrapper').find('.m-subNav__item');
47			var amount = $elem.length;
48			var height = $elem.outerHeight( true );
49			h = (amount * height) + 20;
50			$(this).next('.m-subNav__innerWrapper').css('height', h);
51			$(this).parent('.m-subNav__wrapper').addClass('open');
52		}
53
54	// return false;
55	});
56});
57
58
59// $(document).ready(function(){
60//     var anchorLinkName;
61//     var $anchorH2;
62//     var $footerOffset = $('footer').offset().top;
63//     var $leftColumn = $('.m-article__column.-left');
64//     var $centerColumn = $('.m-article__column.-center');
65//     if ($leftColumn.length) {
66//       var leftColumnTop = $leftColumn.offset().top;
67//     }
68//
69//     var windowScroll;
70//     var windowBottomScroll;
71//     var h2s = $('h2').length;
72//
73//     var orgElementPos = $(window).width() < 992
74//         ? leftColumnTop - 130
75//         : leftColumnTop - 190;
76//
77//     console.log(orgElementPos);
78//     $(window).on('scroll', function(){
79//         windowScroll = $(this).scrollTop();
80//         windowBottomScroll = (windowScroll + ($(window).height() * 0.25));
81//
82//     if ($(window).width() > 992 && windowBottomScroll > $footerOffset) {
83//             $leftColumn.find('.m-subNav__wrapper').removeClass('-scrolled');
84//     } else {
85//         //$leftColumn.find('.m-subNav__wrapper').toggleClass('-scrolled', !(orgElementPos > windowScroll));
86//     //	$leftColumn.toggleClass('-scrolled', !(orgElementPos > windowScroll));
87//
88//     }
89//
90//     });
91//     if(h2s <= 1) {
92//         $leftColumn.find('.m-subNav__wrapper').hide();
93//     }
94//     $('h2').each(function(){
95//         $anchorLink = $(this);
96//         anchorLinkName = $(this).html();
97//         anchorLinkNameTrim = $.trim(anchorLinkName).replace(' ','');
98//         anchorLinkNameTrim = $.trim(anchorLinkNameTrim).replace(/ /g, "").replace(/&ndash;/g, "o").replace(/ä/g, "a").replace(/å/g, "a").replace(/ö/g, "o").replace(/Ä/g, "a").replace(/Å/g, "a").replace(/Ö/g, "o");
99//         $anchorLink.attr("id", anchorLinkNameTrim);
100//         $('<a class="m-subNav__item" href="#'+anchorLinkNameTrim+'">'+anchorLinkName+'</a>').appendTo($('.m-article__column.-left .m-subNav__wrapper.-desktop, .m-article__column.-left .m-subNav__wrapper.-mobile .m-subNav__innerWrapper'));
101//     });
102//     if($(window).width() < 992) {
103//
104//         $('.m-subNav__item.-active').on('click', function( e ){
105//             e.stopPropagation();
106//             e.preventDefault();
107//             if($(this).parent('.m-subNav__wrapper').hasClass('open')){
108//                 $(this).next('.m-subNav__innerWrapper').css('height', 0);
109//                 $(this).parent('.m-subNav__wrapper').removeClass('open');
110//             }else {
111//                 var $elem = $(this).next('.m-subNav__innerWrapper').find('.m-subNav__item');
112//                 var amount = $elem.length;
113//                 var height = $elem.outerHeight( true );
114//                 h = (amount * height) + 20;
115//                 $(this).next('.m-subNav__innerWrapper').css('height', h);
116//                 $(this).parent('.m-subNav__wrapper').addClass('open');
117//             }
118//         });
119//         $(".m-article__column.-left .m-subNav__item").click(function(event){
120//             event.preventDefault();
121//             //calculate destination place
122//             $(".m-article__column.-left .m-subNav__wrapper.-desktop .m-subNav__item").removeClass('-active');
123//             $(".m-article__column.-left .m-subNav__wrapper.-mobile .m-subNav__innerWrapper .m-subNav__item").removeClass('-active');
124//             //$centerColumn.toggleClass('-scrolled', orgElementPos > windowScroll);
125//
126//             $(this).addClass('-active');
127//             var link = $(this.hash);
128//             console.log(link);
129//             if (link.length) {
130//               var hashOffset = $(this.hash).offset().top;
131//             }
132//
133//             var dest=0;
134//             var fullHeight = $(document).height() - $(window).height();
135//             var ifAtTop = orgElementPos > windowScroll;
136//             var ifMobile = $(window).width() < 992;
137//
138//                 if(hashOffset > fullHeight){
139//                      dest = fullHeight;
140//                 }else{
141//                     if(ifMobile) {
142//                         dest = hashOffset - (ifAtTop ? 290 : 180);
143//                     } else {
144//                         dest = hashOffset - (ifAtTop ? 130 : 270);
145//                     }
146//
147//                     /*if(ifAtTop) {
148//                         if($(window).width() < 992){
149//                             dest=hashOffset - 210;
150//                         }
151//                         else {
152//                             dest=hashOffset - 180;
153//                         }
154//                     }
155//                     else {
156//                         if($(window).width() < 992){
157//                             dest=hashOffset - 170;
158//                         }
159//                         else {
160//                             dest=hashOffset - 130;
161//                         }
162//                     }*/
163//                 }
164//             //go to destination
165//             console.log(dest);
166//             $('html,body').animate({scrollTop:dest +'px'}, 1000,'swing');
167//         });
168//     }else {
169//         $(".m-article__column.-left .m-subNav__item").click(function(event){
170//             event.preventDefault();
171//             //calculate destination place
172//             $(".m-article__column.-left .m-subNav__wrapper.-desktop .m-subNav__item").removeClass('-active');
173//             $(".m-article__column.-left .m-subNav__wrapper.-mobile .m-subNav__innerWrapper .m-subNav__item").removeClass('-active');
174//             //$centerColumn.toggleClass('-scrolled', orgElementPos > windowScroll);
175//
176//             $(this).addClass('-active');
177//             var link = $(this.hash);
178//             console.log(link);
179//             if (link.length) {
180//               var hashOffset = $(this.hash).offset().top;
181//             }
182//
183//             var dest=0;
184//             var fullHeight = $(document).height() - $(window).height();
185//             var ifAtTop = orgElementPos > windowScroll;
186//             var ifMobile = $(window).width() < 992;
187//
188//                 if(hashOffset > fullHeight){
189//                      dest = fullHeight;
190//                 }else{
191//                     if(ifMobile) {
192//                         dest = hashOffset - (ifAtTop ? 290 : 180);
193//                     } else {
194//                         dest = hashOffset - (ifAtTop ? 130 : 270);
195//                     }
196//
197//                     /*if(ifAtTop) {
198//                         if($(window).width() < 992){
199//                             dest=hashOffset - 210;
200//                         }
201//                         else {
202//                             dest=hashOffset - 180;
203//                         }
204//                     }
205//                     else {
206//                         if($(window).width() < 992){
207//                             dest=hashOffset - 170;
208//                         }
209//                         else {
210//                             dest=hashOffset - 130;
211//                         }
212//                     }*/
213//                 }
214//             //go to destination
215//             console.log(dest);
216//             $('html,body').animate({scrollTop:dest +'px'}, 1000,'swing');
217//         });
218//     }
219// });

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.