PageSourceSearch

https://www.atvidaberg.se/download/18.339cbb87165e841d4224ad42/1771344733406/atv-webb.js

js atvidaberg.se collected 2026-10-02 11:20:01 UTC 40,930 bytes, 1,309 lines download raw bytes

1
2
3// Autolink in various places ------------------------------
4
5jQuery(document).ready(function ($) {
6  $('.auto-link-icon p.normal a').each( function(){
7    if ($(this).hasClass('skip-auto-link-icon') == false) {
8      linktype = getLinktype($(this).attr("href"));
9      $(this).addClass('link-' + linktype + ' icon-before');
10    }
11  });
12});
13
14jQuery(document).ready(function ($) {
15  $('.auto-link-icon p.normal8 a').each( function(){
16    if ($(this).hasClass('skip-auto-link-icon') == false) {
17      linktype = getLinktype($(this).attr("href"));
18      $(this).addClass('link-' + linktype + ' icon-before');
19    }
20  });
21});
22
23
24
25jQuery(document).ready(function ($) {
26  $('.auto-link-icon table p a').each( function(){
27    if ($(this).hasClass('skip-auto-link-icon') == false) {
28      linktype = getLinktype($(this).attr("href"));
29      $(this).addClass('link-' + linktype + ' icon-before');
30    }
31  });
32});
33
34// magnus
35jQuery(document).ready(function ($) {
36  $('.auto-link-icon a.env-button').each( function(){
37    if ($(this).hasClass('skip-auto-link-icon') == false) {
38
39      linktype = getLinktype($(this).attr("href"));
40      $(this).addClass('link-' + linktype + ' icon-after');
41    }
42  });
43});
44
45
46// Icons for news in a simple list ------------------------------
47
48jQuery(document).ready(function ($) {
49  $('.news-simple-list .sv-channel-item a.sv-font-ingress').each( function(){
50    if ($(this).hasClass('skip-auto-link-icon') == false) {
51      linktype = getLinktype($(this).attr("href"));
52      $(this).closest('.sv-channel-item').find('span:gt(0):last').addClass('link-' + linktype + ' icon-after');
53    }
54  });
55});
56
57
58// for billboard
59
60jQuery(document).ready(function ($) {
61  $('.expandable-news>ul>li>.sv-vertical>.sv-vertical:last-child a').each( function(){
62    $('.auto-link-icon span a').each( function(){
63      if ($(this).hasClass('skip-auto-link-icon') == false) {
64        linktype = getLinktype($(this).attr("href"));
65        $(this).addClass('link-' + linktype + ' icon-before');
66      }
67    });
68  });
69});
70
71
72
73
74// Mobile search  ------------------------------
75
76jQuery(document).ready(function ($) {
77  $(".header-links .search").on("click", function () {
78    $(this).toggleAttr( 'aria-expanded', 'true', 'false' );
79    $(".top-search-mobile-wrapper").slideToggle(500, function () {});
80    $('.top-search-mobile-wrapper input[type="text"].normal').focus();
81    return false;
82  });
83});
84
85
86// Go to content when tab is pressed  ------------------------------
87
88jQuery(document).ready(function ($) {
89  $( ".tab-is-pressed" ).focus(function() {
90    $('.jump-to-content-wrapper').show();
91  });
92});
93
94
95// Push boxes  ------------------------------
96
97jQuery(document).ready(function ($) {
98  $(".grid-pushboxes .sv-row>div").on("click", function () {
99    if ( $( ".sv-editing-mode").length == 0 && $( ".sv-toolbar-loaded" ).length == 0 ) {
100      window.location = $(this).find("a").attr("href");
101      return false;
102    }
103  });
104});
105
106jQuery(document).ready(function ($) {
107  $('.grid-pushboxes h3 a').each( function(){
108    if ($(this).hasClass('skip-auto-link-icon') == false) {
109      linktype = getLinktype($(this).attr("href"));
110      $(this).closest('.sv-text-portlet-content').find("p:last-child").addClass('link-' + linktype + ' icon-after');
111    }
112  });
113});
114
115jQuery(document).ready(function ($) {
116  $('.grid-pushboxes h2 a').each( function(){
117    if ($(this).hasClass('skip-auto-link-icon') == false) {
118      linktype = getLinktype($(this).attr("href"));
119      $(this).closest('.sv-text-portlet-content').find("p:last-child").addClass('link-' + linktype + ' icon-after');
120    }
121  });
122});
123
124
125// Push boxes grid 1440px  ------------------------------
126
127jQuery(document).ready(function ($) {
128  $(".pushboxes-homegrid-1440px .sv-row>div").on("click", function () {
129    if ( $( ".sv-editing-mode").length == 0 && $( ".sv-toolbar-loaded" ).length == 0 ) {
130      window.location = $(this).find("a").attr("href");
131      return false;
132    }
133  });
134});
135
136jQuery(document).ready(function ($) {
137  $('.pushboxes-homegrid-1440px h3 a').each( function(){
138    if ($(this).hasClass('skip-auto-link-icon') == false) {
139      linktype = getLinktype($(this).attr("href"));
140      $(this).closest('.sv-text-portlet-content').find("p:last-child").addClass('link-' + linktype + ' icon-after');
141    }
142  });
143});
144
145jQuery(document).ready(function ($) {
146  $('.pushboxes-homegrid-1440px h2 a').each( function(){
147    if ($(this).hasClass('skip-auto-link-icon') == false) {
148      linktype = getLinktype($(this).attr("href"));
149      $(this).closest('.sv-text-portlet-content').find("p:last-child").addClass('link-' + linktype + ' icon-after');
150    }
151  });
152});
153
154
155// Home push boxes  ------------------------------
156
157jQuery(document).ready(function ($) {
158  $(".pushboxes-homegrid .sv-row>div").on("click", function () {
159    if ( $( ".sv-editing-mode").length == 0 && $( ".sv-toolbar-loaded" ).length == 0 ) {
160      window.location = $(this).find("a").attr("href");
161      return false;
162    }
163  });
164});
165
166jQuery(document).ready(function ($) {
167  $('.pushboxes-homegrid h3 a').each( function(){
168    if ($(this).hasClass('skip-auto-link-icon') == false) {
169      linktype = getLinktype($(this).attr("href"));
170      $(this).closest('.sv-text-portlet-content').find("p:last-child").addClass('link-' + linktype + ' icon-after');
171    }
172  });
173});
174
175jQuery(document).ready(function ($) {
176  $('.pushboxes-homegrid h2 a').each( function(){
177    if ($(this).hasClass('skip-auto-link-icon') == false) {
178      linktype = getLinktype($(this).attr("href"));
179      $(this).closest('.sv-text-portlet-content').find("p:last-child").addClass('link-' + linktype + ' icon-after');
180    }
181  });
182});
183
184// Alert box  ------------------------------
185
186jQuery(document).ready(function ($) {
187  $(".alert-box .alert-header a span").click(function () {
188    //Cookies.set('showAlert', '0');
189    $content = $('.alert-box .alert-description');
190    $(this).find(".fa").toggleClass("fa-chevron-down fa-chevron-right");
191    if ($content.is(':hidden')) {
192      $('.alert-box .alert-header a span').text('Minska meddelandet');
193      Cookies.set('showAlert', '1');
194
195    } else {
196      $('.alert-box .alert-header a span').text('Visa meddelandet');
197      Cookies.set('showAlert', '0');
198
199    }
200    $content.slideToggle(500, function () {});
201    return false;
202  });
203});
204
205jQuery(document).ready(function ($) {
206  if ($(".alert-box")[0]){
207    if (Cookies.get('showAlert') == undefined) {
208      Cookies.set('showAlert', '1');
209    }
210    if (Cookies.get('showAlert') == '0') {
211     $('.alert-box .alert-header a span').text('Visa meddelandet');
212     $('.alert-box .alert-description').hide();
213     $('.alert-box .alert-header .expand-collapse .fa').toggleClass("fa-chevron-down fa-chevron-right");
214    }
215    $('.alert-box .alert-description-wrapper').show();
216    $('.alert-box .alert-header .expand-collapse').show();
217
218  }
219});
220
221
222
223
224// Our websites menu, drop down menu
225jQuery(document).ready(function ($) {
226  $("a.expand-collapse-our-websites-menu").click(function () {
227    $menu = $('.our-websites-menu');
228
229    $(this).toggleAttr( 'aria-expanded', 'true', 'false' );
230   // if (location.pathname != "/") {
231   //   $("header").toggleClass("no-border-bottom");
232   // }
233   $menu.fadeToggle();
234   return false;
235  });
236});
237
238
239
240// Slick slideshow home  ------------------------------
241
242jQuery(document).ready(function ($) {
243  $('.home-slideshow.sv-script-portlet').each(function(index){
244    $(this).addClass('slideshow' + (index + 1));  // Add class like slideshow1, slideshow2, etc.
245  });
246});
247
248jQuery(document).ready(function ($) {
249  $('.home-slideshow.sv-script-portlet.slideshow1 .slides').slick({
250    dots: true,
251    autoplay: false,
252    variableWidth: false,
253    slidesToShow: 1,
254    fade: true,
255    arrows: true,
256    slidesToScroll: 1,
257    adaptiveHeight: false,
258    prevArrow: '<img class="prev" src="https://www.atvidaberg.se/images/18.5ca8208915e13d175f33f50/1504271906580/prev.png">',
259    nextArrow: '<img class="next" src="https://www.atvidaberg.se/images/18.5ca8208915e13d175f33f51/1504271910316/next.png">',
260    appendArrows: '.home-slideshow.sv-script-portlet.slideshow1 .controls',
261    appendDots: '.home-slideshow.sv-script-portlet.slideshow1 .controls'
262  });
263});
264
265jQuery(document).ready(function ($) {
266  $('.home-slideshow.sv-script-portlet.slideshow2 .slides').slick({
267    dots: true,
268    autoplay: false,
269    variableWidth: false,
270    slidesToShow: 1,
271    fade: true,
272    arrows: true,
273    slidesToScroll: 1,
274    adaptiveHeight: false,
275    prevArrow: '<img class="prev" src="https://www.atvidaberg.se/images/18.5ca8208915e13d175f33f50/1504271906580/prev.png">',
276    nextArrow: '<img class="next" src="https://www.atvidaberg.se/images/18.5ca8208915e13d175f33f51/1504271910316/next.png">',
277    appendArrows: '.home-slideshow.sv-script-portlet.slideshow2 .controls',
278    appendDots: '.home-slideshow.sv-script-portlet.slideshow2 .controls'
279  });
280});
281
282jQuery(document).ready(function ($) {
283  $('.home-slideshow.sv-script-portlet.slideshow3 .slides').slick({
284    dots: true,
285    autoplay: false,
286    variableWidth: false,
287    slidesToShow: 1,
288    fade: true,
289    arrows: true,
290    slidesToScroll: 1,
291    adaptiveHeight: false,
292    prevArrow: '<img class="prev" src="https://www.atvidaberg.se/images/18.5ca8208915e13d175f33f50/1504271906580/prev.png">',
293    nextArrow: '<img class="next" src="https://www.atvidaberg.se/images/18.5ca8208915e13d175f33f51/1504271910316/next.png">',
294    appendArrows: '.home-slideshow.sv-script-portlet.slideshow3 .controls',
295    appendDots: '.home-slideshow.sv-script-portlet.slideshow3 .controls'
296  });
297});
298
299jQuery(document).ready(function ($) {
300  $('.home-slideshow.sv-script-portlet.slideshow4 .slides').slick({
301    dots: true,
302    autoplay: false,
303    variableWidth: false,
304    slidesToShow: 1,
305    fade: true,
306    arrows: true,
307    slidesToScroll: 1,
308    adaptiveHeight: false,
309    prevArrow: '<img class="prev" src="https://www.atvidaberg.se/images/18.5ca8208915e13d175f33f50/1504271906580/prev.png">',
310    nextArrow: '<img class="next" src="https://www.atvidaberg.se/images/18.5ca8208915e13d175f33f51/1504271910316/next.png">',
311    appendArrows: '.home-slideshow.sv-script-portlet.slideshow4 .controls',
312    appendDots: '.home-slideshow.sv-script-portlet.slideshow4 .controls'
313  });
314});
315
316
317jQuery(document).ready(function ($) {
318  $('.home-slideshow.sv-script-portlet.slideshow5 .slides').slick({
319    dots: true,
320    autoplay: false,
321    variableWidth: false,
322    slidesToShow: 1,
323    fade: true,
324    arrows: true,
325    slidesToScroll: 1,
326    adaptiveHeight: false,
327    prevArrow: '<img class="prev" src="https://www.atvidaberg.se/images/18.5ca8208915e13d175f33f50/1504271906580/prev.png">',
328    nextArrow: '<img class="next" src="https://www.atvidaberg.se/images/18.5ca8208915e13d175f33f51/1504271910316/next.png">',
329    appendArrows: '.home-slideshow.sv-script-portlet.slideshow5 .controls',
330    appendDots: '.home-slideshow.sv-script-portlet.slideshow5 .controls'
331  });
332});
333
334
335
336jQuery(document).ready(function ($) {
337  $('.home-slideshow .prev').hover(
338    function(){
339      $(this).attr('src','https://www.atvidaberg.se/images/18.1d2711b015e13c528de31a39/1504340373112/prev-hover.png');
340    },
341    function(){
342      $(this).attr('src','https://www.atvidaberg.se/images/18.5ca8208915e13d175f33f50/1504271906580/prev.png');
343    }
344  )
345});
346
347jQuery(document).ready(function ($) {
348  $('.home-slideshow .next').hover(
349    function(){
350      $(this).attr('src','https://www.atvidaberg.se/images/18.1d2711b015e13c528de31a38/1504340368757/next-hover.png');
351    },
352    function(){
353      $(this).attr('src','https://www.atvidaberg.se/images/18.5ca8208915e13d175f33f51/1504271910316/next.png');
354    }
355  )
356});
357
358jQuery(document).ready(function ($) {
359  $('.home-slideshow h1 a').each( function(){
360    if ($(this).hasClass('skip-auto-link-icon') == false) {
361      linktype = getLinktype($(this).attr("href"));
362      $(this).closest('.slide').find("p").addClass('link-' + linktype + ' icon-after');
363    }
364  });
365});
366
367jQuery(document).ready(function ($) {
368  $(".home-slideshow .slide-with-link .text").on("click", function () {
369    if ( $( ".sv-editing-mode").length == 0 && $( ".sv-toolbar-loaded" ).length == 0 ) {
370      window.location = $(this).find("a").attr("href");
371      return false;
372    }
373  });
374});
375
376// Sitemap ------------------------------
377
378jQuery(document).ready(function ($) {
379  $('.sv-sitemap-portlet *').each(function(){
380    if ($(this).css("border-top-width") == "1px") {
381      $(this).css("border-top-width", "2px");
382    }
383    if ($(this).css("border-right-width") == "1px") {
384      $(this).css("border-right-width", "2px");
385    }
386    if ($(this).css("border-bottom-width") == "1px") {
387      $(this).css("border-bottom-width", "2px");
388    }
389    if ($(this).css("border-left-width") == "1px") {
390      $(this).css("border-left-width", "2px");
391    }
392  });
393});
394
395jQuery(document).ready(function ($) {
396  $('.sv-sitemap-portlet a').each( function(){
397    if ($(this).hasClass('skip-auto-link-icon') == false) {
398      linktype = getLinktype($(this).attr("href"));
399      $(this).addClass('link-' + linktype + ' icon-before');
400    }
401  });
402});
403
404// Change focus style when click vs tab ------------------------------
405
406jQuery(document).ready(function ($) {
407  document.addEventListener('keydown', function(e) {
408    if (e.keyCode === 9) {
409      $('body').addClass('show-focus-outlines');
410    }
411  });
412
413  document.addEventListener('click', function(e) {
414    $('body').removeClass('show-focus-outlines');
415  });
416});
417
418// Contact ------------------------------
419
420jQuery(document).ready(function ($) {
421  $(".edging a").click(function () {
422    $content = $('.below-edging');
423    $(this).closest('.sv-html-portlet').find("a").toggleAttr( 'aria-expanded', 'true', 'false' );
424    $(".edging .plus-or-minus").toggleClass("fa-plus fa-minus");
425    $content.slideToggle(500, function () {});
426    return false;
427  });
428
429  if ( $( ".below-edging .sv-grid-grid2").length > 0 && $( ".below-edging p.links" ).length > 0 ) {
430    $( ".below-edging .sv-decoration-rubrik-fore-sidomeny-").show();
431  }
432
433});
434
435// Slow scroll ------------------------------
436
437jQuery(document).ready(function ($) {
438  $('a.slow-scroll[href*="#"]:not([href="#"])').click(function() {
439    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
440      var target = $(this.hash);
441      target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
442      if (target.length) {
443        $('html, body').animate({
444          scrollTop: target.offset().top
445        }, 1000);
446        return true;
447      }
448    }
449  });
450});
451
452
453// Top menu------------------------------
454
455jQuery(document).ready(function ($) {
456  $("a.expand-collapse-mobile-menu").click(function () {
457    $menu = $('.top-menu');
458    $(this).toggleAttr( 'aria-expanded', 'true', 'false' );
459    if (location.pathname != "/") {
460      $("header").toggleClass("no-border-bottom");
461    }
462    $menu.slideToggle(500, function () {});
463    return false;
464  });
465});
466
467jQuery(document).ready(function ($) {
468  if (location.pathname != "/") {
469    $(".top-menu ul a[href='" + location.pathname + "']").each( function(){
470      var url = $(this).attr("href");
471      var parentLi = $(this).parent();
472      var parentUl = parentLi.parent();
473      if (parentUl.hasClass( "l1" )) {
474        parentLi.addClass('current in-path');
475      } else {
476        var grandParentLink = parentUl.parent().find("a").first();
477        if(url.indexOf(grandParentLink.attr("href")) == 0) {
478          parentLi.addClass('current in-path');
479        }
480      }
481    });
482    $(".top-menu .current").parents(".top-menu li").addClass('in-path');
483  }
484  $('.top-menu ul a').each( function(){
485    if ($(this).next().is('ul')) {
486      $(this).addClass('has-children');
487      if ($(this).parent().hasClass( "in-path" )) {
488        $(this).after('<a aria-expanded="true" href="#" class="expand-collapse icon-minus">Dölj undermeny</a>');
489      } else {
490        $(this).next().addClass('hidden');
491        $(this).after('<a aria-expanded="false" href="#" class="expand-collapse icon-plus">Visa undermeny</a>');
492      }
493    }
494  });
495});
496
497
498jQuery(document).ready(function ($) {
499  $(".top-menu ul a.expand-collapse").click(function () {
500    $(this).toggleAttr( 'aria-expanded', 'true', 'false' );
501    $(this).toggleClass("icon-plus icon-minus");
502    $(this).parent().find(">ul").slideToggle(500, function () {});
503    return false;
504
505  });
506});
507
508
509// Move links to mobile menu ------------------------------
510
511
512jQuery(document).ready(function() {
513    jQuery(window).on("resize load", listenWidth4);
514});
515
516function listenWidth4() {
517    jQuery(".header-links").show();
518    if (jQuery('#move-to-meny-on-mobile').css('display') == 'block') {
519        jQuery("#move-to-meny-on-mobile").remove().insertBefore(jQuery(".top-menu #after-mobile-menu-ul"));
520    } else {
521        jQuery("#move-to-meny-on-mobile").remove().insertBefore(jQuery(".expand-collapse-mobile-menu"));
522    }
523}
524
525jQuery(document).ready(function() {
526    jQuery(window).on("resize load", listenWidth3);
527});
528
529function listenWidth3() {
530    jQuery(".header-links-top-row").show();
531    if (jQuery('#move-to-meny-on-mobile-from-top-row').css('display') == 'block') {
532        jQuery("#move-to-meny-on-mobile-from-top-row").remove().insertBefore(jQuery(".top-menu #after-mobile-menu-ul"));
533    } else {
534        jQuery("#move-to-meny-on-mobile-from-top-row").remove().insertBefore(jQuery(".insert-content-before"));
535    }
536}
537
538
539
540
541// open links in new window ------------------------------
542
543jQuery(document).ready(function ($) {
544  $('body:not(.sv-editing-mode) a').each( function(){
545    linktype = getLinktype($(this).attr("href"));
546    addOpenInNewWindowText(linktype, this);
547  });
548});
549
550// Add docreader link------------------------------
551
552jQuery(document).ready(function ($) {
553  $('body:not(.sv-editing-mode) .content a').each( function(){
554    linktype = getLinktype($(this).attr("href"));
555    addDocReaderLink(linktype, this);
556  });
557});
558
559
560// File sharing ------------------------------
561
562jQuery(document).ready(function ($) {
563  $('.auto-link-icon .sv-file-portlet-file a').each( function(){
564    if ($(this).hasClass('skip-auto-link-icon') == false) {
565      linktype = getLinktype($(this).attr("href"));
566      $(this).addClass('link-' + linktype + ' icon-before');
567    }
568  });
569});
570
571
572
573
574// Related ------------------------------
575
576jQuery(document).ready(function ($) {
577  $('.related-wrapper a').each( function(){
578    if ($(this).hasClass('skip-auto-link-icon') == false) {
579      linktype = getLinktype($(this).attr("href"));
580      $(this).addClass('link-' + linktype + ' icon-before');
581    }
582  });
583});
584
585
586// News ------------------------------
587
588jQuery(document).ready(function ($) {
589  $('.news .sv-channel-item a.sv-font-ingress').each( function(){
590    if ($(this).hasClass('skip-auto-link-icon') == false) {
591      linktype = getLinktype($(this).attr("href"));
592      $(this).closest('.sv-channel-item').find(">span").addClass('link-' + linktype + ' icon-after');
593    }
594  });
595});
596
597
598
599jQuery(document).ready(function ($) {
600  $(".news .sv-channel-item").on("click", function () {
601    if ( $( ".sv-editing-mode").length == 0 && $( ".sv-toolbar-loaded" ).length == 0 ) {
602      window.location = $(this).find("a").attr("href");
603      return false;
604    }
605  });
606});
607
608// Home semi important ------------------------------
609
610jQuery(document).ready(function ($) {
611  $('.home-semi-important a').each( function(){
612    if ($(this).hasClass('skip-auto-link-icon') == false) {
613      linktype = getLinktype($(this).attr("href"));
614      $(this).addClass('link-' + linktype + ' icon-before');
615    }
616  });
617});
618
619// News archive - make block clickable ------------------------------
620
621jQuery(document).ready(function ($) {
622  $( ".news-archive-wrapper" ).on( "click", ".news-entry", function() {
623    window.location = $(this).find("a").attr("href");
624    return false;
625  });
626});
627
628
629// Premises listing - make block clickable ------------------------------
630
631jQuery(document).ready(function ($) {
632  $( ".premises-listing" ).on( "click", ".sv-channel-item", function() {
633    window.location = $(this).find("a").attr("href");
634    return false;
635  });
636});
637
638
639// Newslist item - make block clickable ------------------------------
640
641jQuery(document).ready(function ($) {
642  $( ".sv-newslist-gallery" ).on( "click", ".sv-newslist__gallery-article", function() {
643    window.location = $(this).find("a").attr("href");
644    return false;
645  });
646});
647
648
649// News archive - tab-order  ----------------------
650
651jQuery(document).ready(function ($) {
652
653  if ($( ".news-archive-wrapper" ).length > 0) {
654    $( ".sidebar-box .select-date a" ).last().bind('keydown',function(e){
655      if(e.keyCode === 9) {
656        $( ".news-archive-wrapper a" ).first().focus();
657        return false;
658      }
659    });
660
661    $( ".breadcrumb a" ).last().bind('keydown',function(e){
662      if(e.keyCode === 9) {
663        $( ".sidebar-box .select-area a" ).first().focus();
664        return false;
665      }
666    });
667
668    $( ".rss-link a" ).last().bind('keydown',function(e){
669      if(e.keyCode === 9) {
670        $( "footer a" ).first().focus();
671        return false;
672      }
673    });
674  }
675});
676
677
678
679
680// Searchpage ------------------------------
681
682jQuery(document).ready(function ($) {
683  $('.standard-search-portlet a.subheading').each( function(){
684    if ($(this).hasClass('skip-auto-link-icon') == false) {
685
686      linktype = getLinktype($(this).attr("href"));
687      $(this).addClass('link-' + linktype + ' icon-before');
688    }
689  });
690});
691
692jQuery(document).ready(function ($) {
693  if ($( ".standard-search-portlet ol" ).length > 0) {
694    let standardSearchPortletStart = $('.standard-search-portlet ol').first().attr('start');
695
696    const target = document.querySelector(".standard-search-portlet")
697    const config = { attributes: false, childList: true, subtree: true }
698
699    const callback = function() {
700        var standardSearchPortletStart2 = $('.standard-search-portlet ol').first().attr('start');
701        if (standardSearchPortletStart != standardSearchPortletStart2) {
702          standardSearchPortletStart = standardSearchPortletStart2;
703          $('.standard-search-portlet a.subheading').each( function(){
704            linktype = getLinktype($(this).attr("href"));
705            if ($(this).hasClass('skip-auto-link-icon') == false) {
706              $(this).addClass('skip-auto-link-icon');
707              $(this).addClass('link-' + linktype + ' bbb icon-before');
708            }
709            addOpenInNewWindowText2(linktype, this);
710            addDocReaderLink(linktype, this);
711          });
712        }
713      }
714
715    const observer = new MutationObserver(callback);
716
717    observer.observe(target, config)
718  }
719});
720
721jQuery(document).ready(function ($) {
722  $( ".standard-search-portlet" ).on( "click", ".sv-search-hit .clickable", function() {
723    if ($(this).find("a").attr("target") == "_blank") {
724      window.open($(this).find("a").attr("href"), '_blank');
725    } else {
726      window.location = $(this).find("a").attr("href");
727    }
728
729    return false;
730  });
731});
732
733
734jQuery(document).ready(function ($) {
735
736
737  if ($( ".standard-search-portlet" ).length > 0) {
738
739    $( ".standard-search-portlet .site-search input[type='submit']" ).bind('keydown',function(e){
740      if(e.keyCode === 9) {
741       // alert('dd');
742        $( ".sidebar a" ).first().focus();
743        return false;
744      }
745    });
746
747    $( ".sidebar a" ).last().bind('keydown',function(e){
748      if(e.keyCode === 9) {
749       // alert('dd');
750        $( ".sv-search-result a" ).first().focus();
751        return false;
752      }
753    });
754
755    $( ".standard-search-portlet a" ).last().bind('keydown',function(e){
756      if(e.keyCode === 9) {
757        $( "footer a" ).first().focus();
758        return false;
759      }
760    });
761
762  }
763
764});
765
766
767// Get number of hits on search page
768
769
770jQuery(document).ready(function ($) {
771  $('a.show-hit-count').each( function(){
772    //var hitCount = "a"
773
774    var link = $(this);
775
776    // START FOR IE
777    var oldHref = $(this).attr("href");
778    var newHref = encodeURI(oldHref);
779    $(this).attr("href", newHref);
780    // END FOR IE
781
782    $.ajax({
783      url: newHref,
784      dataType: 'html',
785      success: function(response, that) {
786        var hitCount = $(response).find('#search-hit-count').val();
787        if (hitCount == null) {
788          var hitCount = '0';
789        }
790        link.closest('li').show();
791        link.append(' (' + hitCount + ')' );
792        if (hitCount == 0 && link.hasClass( "hide-if-zero" )) {
793          link.closest('li').hide();
794        }
795      }
796    });
797  });
798});
799
800
801// Button ------------------------------
802
803jQuery(document).ready(function ($) {
804  $('.sv-font-button a').each( function(){
805    if ($(this).hasClass('skip-auto-link-icon') == false) {
806      linktype = getLinktype($(this).attr("href"));
807      $(this).addClass('link-' + linktype + ' icon-before');
808    }
809  });
810});
811
812// Tabbing cookieinfo ------------------------------
813
814jQuery(document).ready(function ($) {
815   $(document).on('keydown', '.cookieinfo a', function (e) {
816     $(".cookieinfo .cookieinfo-close").each(function (i) { $(this).attr('tabindex', -1); });
817     if(e.which==9) {
818        $( ".cookieinfo .cookieinfo-close" ).first().focus();
819        return false;
820      }
821   });
822   $(document).on('keydown', '.cookieinfo .cookieinfo-close', function (e) {
823     if(e.which==9) {
824        //$( ".cookieinfo .cookieinfo-close" ).first().focus();
825        $(":tabbable").first().focus();
826        return false;
827      }
828   });
829
830});
831
832
833
834// Mobile search filter  ------------------------------
835
836jQuery(".mobile-search-filter-wrapper.expandables").remove().insertAfter(jQuery("#move-mobile-search-filter-here"));
837
838
839// readspeaker  ------------------------------
840
841
842window.rsConf = {
843general: {
844syncContainer: 'font',
845popupHref: '//app-eu.readspeaker.com/cgi-bin/rsent?customerid=5177&lang=sv_se&url=',
846usePost: true
847}
848};
849
850ReadSpeaker.q(function() {
851rspkr.c.data.browser.syncContainer = 'font';
852});
853
854
855// Expandables------------------------------
856
857
858jQuery(document).ready(function ($) {
859    $('.expandables:not(.sv-editable-layout)>.sv-vertical>.sv-vertical:first-child p').append( $( '<i class="fa fa-plus-circle plus-circle-or-minus" aria-hidden="true"></i>' ) )
860    $('.expandables:not(.sv-editable-layout)>.sv-vertical>.sv-vertical:first-child p').wrapInner( '<a href="#" aria-expanded="false"></a>' );
861});
862
863
864
865jQuery(document).ready(function ($) {
866  $(".expandables>.sv-vertical>.sv-vertical:first-child a").click(function () {
867    $parent = $(this).closest(".sv-text-portlet-content").parents().eq(2);
868    $content = $parent.find(">.sv-vertical:last-child");
869    $(this).toggleAttr( 'aria-expanded', 'true', 'false' );
870    $(this).find(".plus-circle-or-minus").toggleClass("fa-plus-circle fa-minus-circle");
871    $parent.toggleClass("active");
872    $content.slideToggle(500, function () {});
873    return false;
874  });
875});
876
877
878jQuery(document).ready(function ($) {
879  $(window).on("load resize scroll",function(e){
880    $(".expandables>.sv-vertical>.sv-vertical:first-child i").each(function(){
881      aHeight = $(this).closest("a").height();
882      marginTop = (aHeight/2) + 9;
883      $(this).css({'top': marginTop + 'px'});
884
885    });
886  });
887});
888
889jQuery(document).ready(function ($) {
890  $(".expandables:not(.sv-editable-layout)>.sv-vertical").each(function(){
891    var urlAnchor = window.location.hash.substr(1);
892    var parent = $(this);
893    var headingWrapper = parent.find(".sv-vertical:first-child");
894    var link = headingWrapper.find("a");
895    var title = link.text();
896    var anchorName = "expandera-" + convertToSlug(title);
897    link.attr("id", anchorName);
898    link.attr("name", anchorName);
899    if (urlAnchor == anchorName ) {
900      if (link.attr('aria-expanded') == "false") {
901        link.trigger( "click" );
902        link.addClass("no-focus-webkit");
903      }
904    }
905  });
906});
907
908
909// Expandables H2 ------------------------------
910
911
912jQuery(document).ready(function ($) {
913    $('.expandables-h2:not(.sv-editable-layout)>.sv-vertical>.sv-vertical:first-child h2').append( $( '<i class="fa fa-plus-circle plus-circle-or-minus" aria-hidden="true"></i>' ) )
914    $('.expandables-h2:not(.sv-editable-layout)>.sv-vertical>.sv-vertical:first-child h2').wrapInner( '<a href="#" aria-expanded="false"></a>' );
915});
916
917
918
919jQuery(document).ready(function ($) {
920  $(".expandables-h2>.sv-vertical>.sv-vertical:first-child h2 a").click(function () {
921    $parent = $(this).closest(".sv-text-portlet-content").parents().eq(2);
922    $content = $parent.find(">.sv-vertical:last-child");
923    $(this).toggleAttr( 'aria-expanded', 'true', 'false' );
924    $(this).find(".plus-circle-or-minus").toggleClass("fa-plus-circle fa-minus-circle");
925    $parent.toggleClass("active");
926    $content.slideToggle(500, function () {});
927    return false;
928  });
929});
930
931
932jQuery(document).ready(function ($) {
933  $(window).on("load resize scroll",function(e){
934    $(".expandables-h2>.sv-vertical>.sv-vertical:first-child i").each(function(){
935      aHeight = $(this).closest("a").height();
936      marginTop = (aHeight/2) + 9;
937      $(this).css({'top': marginTop + 'px'});
938
939    });
940  });
941});
942
943jQuery(document).ready(function ($) {
944  $(".expandables-h2:not(.sv-editable-layout)>.sv-vertical").each(function(){
945    var urlAnchor = window.location.hash.substr(1);
946    var parent = $(this);
947    var headingWrapper = parent.find(".sv-vertical:first-child");
948    var link = headingWrapper.find("a");
949    var title = link.text();
950    var anchorName = "expandera-" + convertToSlug(title);
951    link.attr("id", anchorName);
952    link.attr("name", anchorName);
953    if (urlAnchor == anchorName ) {
954      if (link.attr('aria-expanded') == "false") {
955        link.trigger( "click" );
956        link.addClass("no-focus-webkit");
957      }
958    }
959  });
960});
961
962
963// Expandables H3 ------------------------------
964
965
966jQuery(document).ready(function ($) {
967    $('.expandables-h3:not(.sv-editable-layout)>.sv-vertical>.sv-vertical:first-child h3').append( $( '<i class="fa fa-plus-circle plus-circle-or-minus" aria-hidden="true"></i>' ) )
968    $('.expandables-h3:not(.sv-editable-layout)>.sv-vertical>.sv-vertical:first-child h3').wrapInner( '<a href="#" aria-expanded="false"></a>' );
969});
970
971
972
973jQuery(document).ready(function ($) {
974  $(".expandables-h3>.sv-vertical>.sv-vertical:first-child h3 a").click(function () {
975    $parent = $(this).closest(".sv-text-portlet-content").parents().eq(2);
976    $content = $parent.find(">.sv-vertical:last-child");
977    $(this).toggleAttr( 'aria-expanded', 'true', 'false' );
978    $(this).find(".plus-circle-or-minus").toggleClass("fa-plus-circle fa-minus-circle");
979    $parent.toggleClass("active");
980    $content.slideToggle(500, function () {});
981    return false;
982  });
983});
984
985
986jQuery(document).ready(function ($) {
987  $(window).on("load resize scroll",function(e){
988    $(".expandables-h3>.sv-vertical>.sv-vertical:first-child i").each(function(){
989      aHeight = $(this).closest("a").height();
990      marginTop = (aHeight/2) + 9;
991      $(this).css({'top': marginTop + 'px'});
992
993    });
994  });
995});
996
997jQuery(document).ready(function ($) {
998  $(".expandables-h3:not(.sv-editable-layout)>.sv-vertical").each(function(){
999    var urlAnchor = window.location.hash.substr(1);
1000    var parent = $(this);
1001    var headingWrapper = parent.find(".sv-vertical:first-child");
1002    var link = headingWrapper.find("a");
1003    var title = link.text();
1004    var anchorName = "expandera-" + convertToSlug(title);
1005    link.attr("id", anchorName);
1006    link.attr("name", anchorName);
1007    if (urlAnchor == anchorName ) {
1008      if (link.attr('aria-expanded') == "false") {
1009        link.trigger( "click" );
1010        link.addClass("no-focus-webkit");
1011      }
1012    }
1013  });
1014});
1015
1016
1017// Expandables H4 ------------------------------
1018
1019
1020jQuery(document).ready(function ($) {
1021    $('.expandables-h4:not(.sv-editable-layout)>.sv-vertical>.sv-vertical:first-child h4').append( $( '<i class="fa fa-plus-circle plus-circle-or-minus" aria-hidden="true"></i>' ) )
1022    $('.expandables-h4:not(.sv-editable-layout)>.sv-vertical>.sv-vertical:first-child h4').wrapInner( '<a href="#" aria-expanded="false"></a>' );
1023});
1024
1025
1026
1027jQuery(document).ready(function ($) {
1028  $(".expandables-h4>.sv-vertical>.sv-vertical:first-child h4 a").click(function () {
1029    $parent = $(this).closest(".sv-text-portlet-content").parents().eq(2);
1030    $content = $parent.find(">.sv-vertical:last-child");
1031    $(this).toggleAttr( 'aria-expanded', 'true', 'false' );
1032    $(this).find(".plus-circle-or-minus").toggleClass("fa-plus-circle fa-minus-circle");
1033    $parent.toggleClass("active");
1034    $content.slideToggle(500, function () {});
1035    return false;
1036  });
1037});
1038
1039
1040jQuery(document).ready(function ($) {
1041  $(window).on("load resize scroll",function(e){
1042    $(".expandables-h4>.sv-vertical>.sv-vertical:first-child i").each(function(){
1043      aHeight = $(this).closest("a").height();
1044      marginTop = (aHeight/2) + 9;
1045      $(this).css({'top': marginTop + 'px'});
1046
1047    });
1048  });
1049});
1050
1051jQuery(document).ready(function ($) {
1052  $(".expandables-h4:not(.sv-editable-layout)>.sv-vertical").each(function(){
1053    var urlAnchor = window.location.hash.substr(1);
1054    var parent = $(this);
1055    var headingWrapper = parent.find(".sv-vertical:first-child");
1056    var link = headingWrapper.find("a");
1057    var title = link.text();
1058    var anchorName = "expandera-" + convertToSlug(title);
1059    link.attr("id", anchorName);
1060    link.attr("name", anchorName);
1061    if (urlAnchor == anchorName ) {
1062      if (link.attr('aria-expanded') == "false") {
1063        link.trigger( "click" );
1064        link.addClass("no-focus-webkit");
1065      }
1066    }
1067  });
1068});
1069
1070
1071
1072// Expandable news------------------------------
1073
1074jQuery(document).ready(function ($) {
1075    $('.expandable-news>ul>li>.sv-vertical>.sv-vertical:first-child p').append( $( '<i class="fa fa-plus-circle plus-circle-or-minus" aria-hidden="true"></i>' ) );
1076    $('.expandable-news>ul>li>.sv-vertical>.sv-vertical:first-child p').wrapInner( '<a href="#" aria-expanded="false"></a>' );
1077});
1078
1079jQuery(document).ready(function ($) {
1080  $(".expandable-news>ul>li>.sv-vertical>.sv-vertical:first-child a").click(function () {
1081    $parent = $(this).closest(".sv-text-portlet-content").parents().eq(2);
1082    $content = $parent.find(".sv-vertical:last-child");
1083    $(this).toggleAttr( 'aria-expanded', 'true', 'false' );
1084    $(this).find(".plus-circle-or-minus").toggleClass("fa-plus-circle fa-minus-circle");
1085    $parent.toggleClass("active");
1086    $content.slideToggle(500, function () {});
1087    return false;
1088  });
1089});
1090
1091
1092
1093
1094jQuery(document).ready(function ($) {
1095  $(window).on("load resize scroll",function(e){
1096    $(".expandable-news>ul>li>.sv-vertical>.sv-vertical:first-child i").each(function(){
1097      aHeight = $(this).closest("a").height();
1098      marginTop = (aHeight/2) + 9;
1099      $(this).css({'top': marginTop + 'px'});
1100
1101    });
1102  });
1103});
1104
1105jQuery(document).ready(function ($) {
1106  $('.expandable-news>ul>li>.sv-vertical>.sv-vertical:last-child a').each( function(){
1107    $('.auto-link-icon p.normal8 a').each( function(){
1108      if ($(this).hasClass('skip-auto-link-icon') == false) {
1109        linktype = getLinktype($(this).attr("href"));
1110        $(this).addClass('link-' + linktype + ' icon-before');
1111      }
1112    });
1113  });
1114});
1115
1116
1117
1118jQuery(document).ready(function ($) {
1119  $(".expandable-news>ul>li").each(function(){
1120    var urlAnchor = window.location.hash.substr(1);
1121    var parent = $(this);
1122    var headingWrapper = parent.find(">.sv-vertical>.sv-vertical:first-child");
1123    var link = headingWrapper.find("a");
1124    var title = link.text();
1125    title = $.trim(title);
1126    var anchorName = "expandera-" + convertToSlug(title);
1127    link.attr("id", anchorName);
1128    link.attr("name", anchorName);
1129    if (urlAnchor == anchorName ) {
1130      if (link.attr('aria-expanded') == "false") {
1131        link.trigger( "click" );
1132        link.addClass("no-focus-webkit");
1133      }
1134    }
1135  });
1136});
1137
1138
1139// Expand on search ------------------------------
1140
1141jQuery(document).ready(function ($) {
1142  var classes = [".expandables", ".expandables-h2", ".expandable-news"];
1143  var referrer =  document.referrer;
1144  if (/sokresultat/.test(referrer)) {
1145    var query = getReferrerParameter('query');
1146    if (query) {
1147      var words = query.split('+');
1148      for (i = 0; i < classes.length; i++) {
1149        for (i2 = 0; i2 < words.length; i2++) {
1150          $(classes[i] + ':not(.do-not-expand-by-search)>.sv-vertical').each( function(){
1151            if ($(this).is(":contains('" + words[i2] + "')")) {
1152              $(this).find(">.sv-vertical:first-child a").each( function(){
1153                if ($(this).attr('aria-expanded') == "false") {
1154                  $(this).trigger( "click" );
1155                }
1156              });
1157            }
1158          });
1159        }
1160      }
1161    }
1162  }
1163});
1164
1165jQuery.expr[':'].contains = function(a, i, m) {
1166  return jQuery(a).text().toUpperCase()
1167      .indexOf(m[3].toUpperCase()) >= 0;
1168};
1169
1170
1171
1172// Functions ------------------------------
1173
1174function getLinktype (href) {
1175  if ((/\.pdf$/.test(href)) || (/\edit-fileresource/.test(href)))
1176    return "pdf"
1177  if (/\.doc$/.test(href))
1178    return "word"
1179  if (/\.dot$/.test(href))
1180    return "word"
1181  if (/\.docx$/.test(href))
1182    return "word"
1183  if (/\.dotx$/.test(href))
1184    return "word"
1185  if (/\.xls$/.test(href))
1186    return "excel"
1187  if (/\.xlsx$/.test(href))
1188    return "excel"
1189  if (/\.ppt$/.test(href))
1190    return "powerpoint"
1191  if (/\.pptx$/.test(href))
1192    return "powerpoint"
1193  if (/\.potx$/.test(href))
1194    return "powerpoint"
1195  if (/^mailto:/.test(href))
1196    return "mail"
1197  if (/^tel:/.test(href))
1198    return "phone"
1199  if (/\.dwg$/.test(href))
1200    return "dwg"
1201  if ((/state=rss/.test(href)) || (/icon=rss/.test(href)))
1202    return "rss"
1203  else if ((/^\//.test(href)) || (/^https:\/\/www.atvidaberg.se/.test(href)))
1204  {
1205     return "internal"
1206  }
1207  else
1208  {
1209    return "generic"
1210  }
1211}
1212
1213function addOpenInNewWindowText (linktype, link) {
1214  if (jQuery(link).hasClass( "checked-if-should-open-in-new-window" ) == false) {
1215    switch (linktype) {
1216      case 'pdf':
1217      case 'word':
1218      case 'excel':
1219      case 'powerpoint':
1220	  case 'dwg':
1221          jQuery(link).attr("target", "_blank");
1222          jQuery(link).addClass('checked-if-should-open-in-new-window');
1223          jQuery(link).append(' <span class="new-window">(Öppnas i nytt fönster)</span>' );
1224    }
1225  }
1226}
1227
1228function addOpenInNewWindowText2 (linktype, link) {
1229  if (jQuery(link).hasClass( "checked-if-should-open-in-new-window" ) == false) {
1230    switch (linktype) {
1231      case 'pdf':
1232      case 'word':
1233      case 'excel':
1234      case 'powerpoint':
1235	  case 'dwg':
1236          jQuery(link).attr("target", "_blank");
1237          jQuery(link).addClass('checked-if-should-open-in-new-window');
1238          jQuery(link).append(' <span class="new-window">(Öppnas i nytt fönster)</span>' );
1239    }
1240  }
1241}
1242
1243
1244function addDocReaderLink (linktype, link) {
1245  if (jQuery(link).hasClass( "docreader-link-added" ) == false) {
1246    //jQuery(link).addClass('docreader-link-added');
1247    switch (linktype) {
1248      case 'pdf':
1249      case 'word':
1250      case 'excel':
1251      case 'powerpoint':
1252	  case 'dwg':
1253        var url = jQuery(link).attr("href");
1254        if (url.indexOf("/") == 0) {
1255          url = "https://www.atvidaberg.se" + url
1256        }
1257        var encodedUrl = encodeURIComponent(url);
1258        //jQuery(link).addClass('docreader-link-added skip-auto-link-icon');
1259        jQuery(link).addClass('docreader-link-added');
1260        jQuery(link).after("<a class=\"skip-auto-link-icon docreader-link\" rel=\"nofollow\" href=\"//docreader.readspeaker.com/docreader/?cid=bpwqu&amp;lang=sv_se&amp;url=" + encodedUrl + "\" onclick=\"window.open(this.href, 'dcrwin'); return false;\" title=\"Öppna detta dokument med ReadSpeaker docReader\"><i class=\"fa fa-volume-up\" aria-hidden=\"true\"></i></a>");
1261    }
1262  }
1263}
1264
1265
1266jQuery.fn.toggleAttr = function(attr, attr1, attr2) {
1267  return this.each(function() {
1268    var self = jQuery(this);
1269    if (self.attr(attr) == attr1)
1270      self.attr(attr, attr2);
1271    else
1272      self.attr(attr, attr1);
1273  });
1274};
1275
1276
1277var getReferrerParameter = function getUrlParameter(sParam) {
1278    var sPageURL = decodeURIComponent(document.referrer.split("?").pop()),
1279        sURLVariables = sPageURL.split('&'),
1280        sParameterName,
1281        i;
1282    for (i = 0; i < sURLVariables.length; i++) {
1283        sParameterName = sURLVariables[i].split('=');
1284
1285        if (sParameterName[0] === sParam) {
1286            return sParameterName[1] === undefined ? true : sParameterName[1];
1287        }
1288    }
1289};
1290
1291
1292function convertToSlug(str)
1293{
1294  str = str.replace(/^\s+|\s+$/g, ''); // trim
1295  str = str.toLowerCase();
1296
1297  // remove accents, swap ñ for n, etc
1298  var from = "ãà áäâẽèéëêìíïîõòóöôùúüûñç·/_,:;";
1299  var to   = "aaaaaeeeeeiiiiooooouuuunc------";
1300  for (var i=0, l=from.length ; i<l ; i++) {
1301    str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
1302  }
1303
1304  str = str.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
1305    .replace(/\s+/g, '-') // collapse whitespace and replace by -
1306    .replace(/-+/g, '-'); // collapse dashes
1307
1308  return str;
1309}

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.