PageSourceSearch

https://www.falkoping.se/download/18.1f50a3e119581f99cbb1e15/1744105158515/tocbot.js

js falkoping.se collected 2026-10-02 06:57:59 UTC 4,312 bytes, 104 lines download raw bytes

1
2svDocReady(function() {
3   (function () {
4      
5      if ($svjq('.lp-content h2').length > 0 ) {
6         var currentMode;
7         
8         const initTobcot = () => {
9            if(window.innerWidth > 800 && currentMode != "Desktop"){
10               currentMode = "Desktop";
11               tocbot.destroy();
12               tocbot.init({
13                  // Where to render the first anchorlinks.
14                  tocSelector: '.lp-tocbot--container',
15                  // Where to grab the headings to build the table of contents.
16                  contentSelector: '.lp-content',
17                  // Which headings to grab inside of the contentSelector element.
18                  headingSelector: 'h2',
19                  ignoreSelector: '*:not([id])',
20                  // For headings inside relative or absolute positioned containers within content.
21                  hasInnerContainers: true,
22                  // instead of ordered lists (ol)
23                  orderedList: true,
24                  headingsOffset: 40,
25                  scrollSmoothOffset: -40,
26                  // heading node instead of just including the textContent.
27                  includeHtml: false,
28               });
29
30               $svjq('.lp-tocbot--container').find('.toc-list li').find('a').each(function(){
31                  $svjq(this).attr('aria-label', () => {
32                     return 'Hoppa till rubriken "' + $svjq(this).text() + '"';
33                  });
34               });
35
36               const tocItems = $svjq('.lp-tocbot--container ol'),
37                     tocTitle = $svjq('.lp-tocbot--container .tocbot-heading');
38               if ($svjq(tocItems).length ) {
39                  $svjq(tocTitle).addClass('active');
40               }
41
42            }else if(window.innerWidth <= 800 && currentMode != "Mobile"){
43               currentMode = "Mobile";
44               tocbot.destroy();
45               tocbot.init({
46                  // Where to render the first anchorlinks.
47                  tocSelector: '.lp-main__anchor-mobile',
48                  // Where to grab the headings to build the table of contents.
49                  contentSelector: '.lp-content',
50                  // Which headings to grab inside of the contentSelector element.
51                  headingSelector: 'h2',
52                  ignoreSelector: '*:not([id])',
53                  // For headings inside relative or absolute positioned containers within content.
54                  hasInnerContainers: true,
55                  // instead of ordered lists (ol)
56                  orderedList: true,
57                  onClick: function (e) {
58                     $svjq('.lp-tocbot-mobile--button').trigger('click');
59                  },
60                  headingsOffset: 100,
61                  scrollSmoothOffset: -50,
62                  // heading node instead of just including the textContent.
63                  includeHtml: false,
64               });
65               $svjq('.lp-main__anchor-mobile').find('.toc-list').attr('aria-label', 'Ankarlänkar på sidan');
66               $svjq('.lp-main__anchor-mobile').find('.toc-list li').find('a').each(function(){
67                  $svjq(this).attr('aria-label', () => {
68                     return 'Hoppa till rubriken "' + $svjq(this).text() + '"';
69                  });
70               });
71               const tocItemsMobile = $svjq('.lp-main__anchor-mobile ol'),
72                     tocButtonMobile = $svjq('.lp-tocbot-mobile');
73               if($svjq(tocItemsMobile).length){
74                  tocButtonMobile.show();
75               }
76            }
77
78         };
79         $svjq(window).on('resize', function(){
80            initTobcot();
81         });
82         initTobcot();
83      }
84   }(jQuery));
85});    
86
87
88
89svDocReady(function() {
90   (function () {
91      $svjq('.lp-tocbot-mobile--button').on('click', function(){
92         const $toggleElement = $svjq('#' + $svjq(this).attr('aria-controls'));
93         $toggleElement.slideToggle('fast');
94         $toggleElement.attr('aria-hidden', function(){
95            return $toggleElement.attr('aria-hidden') == "false";
96         });
97         $svjq(this).toggleClass('active');
98         $svjq(this).attr('aria-expanded', function(){
99            return $svjq(this).attr('aria-expanded') == "false";
100         });
101      });
102
103   }(jQuery));
104});   

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.