PageSourceSearch

https://www.octetsci.com/wp-content/plugins/top-table-of-contents/public/js/boomdevs-toc-public.js?ver=1.3.31

js octetsci.com collected 2026-10-08 11:46:53 UTC 17,642 bytes, 419 lines download raw bytes

1(function($) {
2    "use strict";
3
4    $(document).ready(function() {
5        let bdTocContentListLink = $(".bd_toc_content_list_item a"),
6            bdTocContainerWithFixed = $(".scroll-to-fixed-fixed"),
7            bdTocContainer = $(".bd_toc_container"),
8            bdTocHeader = $(".bd_toc_header"),
9            bd_toc_wrapper = $(".bd_toc_wrapper"),
10            bd_toc_content = $(".bd_toc_content"),
11            bd_toc_wrapper_height = bd_toc_wrapper.height(),
12            bd_toc_content_height = $(".bd_toc_content").height(),
13            bdTocContainerDataVal = bdTocContainer.data("fixedwidth");
14
15        bdTocHeader.click(function() {
16            bd_toc_content.slideToggle();
17
18            $('.fit_content').css({
19                width: "auto"
20            });
21
22            if ($(this).hasClass("active")) {
23                $(this).removeClass("active");
24                bdTocContainer.addClass("slide_left");
25                headerTitleWidthHeight();
26            } else {
27                $(this).addClass("active");
28                bdTocContainer.removeClass("slide_left");
29                headerTitleRemoveWidthHeight();
30            }
31        });
32
33
34        //add width to header title
35        function headerTitleWidthHeight() {
36            let headerTitleWidth = $(".bd_toc_header_title").width();
37            let bdTocWrapperPadding = bd_toc_wrapper.attr("data-wrapperPadding");
38            let bdTocHeaderPadding = bdTocHeader.attr("data-headerPadding");
39            let bdTocWrapperPaddingValue = parseInt(bdTocWrapperPadding);
40            let bdTocHeaderPaddingValue = parseInt(bdTocHeaderPadding);
41            let totleHeaderTitleWidth = parseInt(headerTitleWidth + bdTocWrapperPaddingValue + bdTocHeaderPaddingValue + 3);
42
43            if (bdTocContainer.hasClass("scroll-to-fixed-fixed")) {
44                bdTocContainerWithFixed.css({
45                    position: "fixed",
46                    top: "0px",
47                });
48            } else {
49                bdTocContainer.css(
50                    "cssText",
51                    "width: " + totleHeaderTitleWidth + "px !important;"
52                );
53            }
54        }
55
56        // remove width and height from header title
57        function headerTitleRemoveWidthHeight() {
58            bdTocContainer.css("width", 0 + "px");
59            // bd_toc_content.css("cssText", "height: " + bd_toc_content_height + "px");
60        }
61
62        //collapse button off
63        if (handle.initial_view == "0") {
64            bdTocHeader.click(function() {
65                if (bdTocContainer.hasClass("scroll-to-fixed-fixed")) {
66                    bdTocContainerWithFixed.css({
67                        position: "fixed",
68                        top: "0px",
69                    });
70                } else {
71                    bdTocContainer.css(
72                        "cssText",
73                        "width: " + 100 + "% !important;",
74                        "transition: all 0.5s ease-in-out;"
75                    );
76                }
77                bd_toc_content.css("cssText", "display: block;");
78
79                if (bdTocContainer.hasClass("slide_left")) {
80                    headerTitleWidthHeight();
81                } else {
82                    $(".bd_toc_content_list").css(
83                        "cssText",
84                        // "height: " + $(".bd_toc_content").height() + "px !important;"
85                    );
86                }
87            });
88            if (bdTocHeader.hasClass("active")) {
89                bdTocHeader.removeClass("active");
90            }
91        }
92
93        //collapse button on
94        if (handle.initial_view == "1") {
95            headerTitleRemoveWidthHeight();
96        }
97
98        function slidingTocContainer(width) {
99            $(".bd_toc_container.scroll-to-fixed-fixed").css(
100                "cssText",
101                `z-index: 1000;
102                position: fixed;
103                transition: .1s;
104                top: 0px;
105                margin-left: 0px;
106                ${sticky_mode_position.sticky_mode_position}: calc( 0% + ${width} ) !important`
107            );
108        }
109
110        $(document).on(
111            "click",
112            ".bd_toc_content_list_item ul li .collaps-button",
113            function() {
114                $(this).parent("li").toggleClass("collapsed");
115                $(this).parent("li").find("li").addClass("collapsed");
116                bd_toc_content_height = $(".bd_toc_content ul").height();
117
118                toggleContentWrapperHeight(bd_toc_content_height);
119            }
120        );
121
122        bdTocContentListLink.on("click", function() {
123            let bdTocContentListLinkHref = $(this).attr("href");
124            location.replace(bdTocContentListLinkHref);
125        });
126
127        bdTocContentListLink.on("click", function() {
128            if (screen.width < "1024") {
129                if (bdTocContainer.hasClass("active")) {
130                    slidingTocContainer("-" + bdTocContainerDataVal + "px");
131                    bdTocContainer.removeClass("active");
132                }
133            }
134        });
135
136        function toggleContentWrapperHeight(height) {
137            $(".bd_toc_container .bd_toc_content_list_item").css("height", height);
138        }
139
140        $(".layout_toggle_button").on("click", function() {
141            if (sticky_mode_position.sticky_sidebar_collapse_on_off == "1") {
142                $('.bd_toc_container.scroll-to-fixed-fixed .bd_toc_wrapper').css('opacity', '1');
143                if (bdTocContainer.hasClass("active")) {
144                    bdTocContainer.removeClass("active");
145                    slidingTocContainer(`0px`);
146                } else {
147                    bdTocContainer.addClass("active");
148                    slidingTocContainer("-" + bdTocContainerDataVal + "px");
149                }
150            }else {
151                if (bdTocContainer.hasClass("active")) {
152                    bdTocContainer.removeClass("active");
153                    slidingTocContainer("-" + bdTocContainerDataVal + "px");
154                } else {
155                    bdTocContainer.addClass("active");
156                    slidingTocContainer(`0px`);
157                }
158            }
159        });
160
161        //scroll class add form sticky sidebar when content height is greater than windows height 
162        if(bd_toc_content.height() > $(window).height()){
163            bd_toc_content.addClass("scroll");
164        }else{
165            bd_toc_content.removeClass("scroll");
166        }
167
168        //progress bar
169        if(typeof progress_bar_switcher !== 'undefined' && progress_bar_switcher.progress_bar_switcher == 1){
170            $(".bd_toc_progress_bar").addClass("progress_bar_open");
171            $(document).on("scroll", function(){
172                var pixels = $(document).scrollTop();
173                var pageHeight = $(document).height() - $(window).height();
174                var progress = 100 * pixels / pageHeight;
175                
176                $(".bd_toc_widget_progress_bar").css("width", progress + "%");
177            })
178        }
179    });
180
181    //floating content show hide option when scrolling
182    function widgetFLoatingOpen(){
183        $(window).scroll(function() {
184            let windowScrollLength = $(window).scrollTop();
185            if (windowScrollLength > $(".bd_toc_container").height() + $('.bd_toc_container').offset().top) {
186                $(".bd_toc_widget_floating").addClass("widget_floating_open");
187            } else {
188                $(".bd_toc_widget_floating").removeClass("widget_floating_open");
189            }
190        });
191    }
192    
193    //default nav scrolling and floating value update
194    $(".bd_toc_content_list_item").onePageNav({
195        currentClass: "current",
196        scrollChange: function($currentListItem) {
197            $($currentListItem).parents("li").addClass("active");
198            $($currentListItem[0]).addClass("active");
199
200            //floating title text insert when click single content element
201            // let current_list_item = $currentListItem.text();
202            let current_list_item = $(".bd_toc_content_list_item ul li.current").find(">:first-child").text();
203            $(".bd_toc_widget_floating_current_heading .current_list_item").text(current_list_item);
204
205            if(handle.isProActivated && widget_floating_option.widget_floating_option == "1"){
206                //floating content show when default content scroll
207                widgetFLoatingOpen();
208            }
209        },
210    });
211
212    //Floating Title show and value update when scrolling
213    if(handle.isProActivated && widget_floating_option.widget_floating_option == "1"){
214        $(".bd_toc_content_floating_list_item").onePageNav({
215            currentClass: "current",
216            scrollChange: function($currentListItem) {
217                // let current_list_item = $currentListItem.text();
218                let current_list_item = $(".bd_toc_content_floating_list_item ul li.current").find(">:first-child").text();
219                $(".bd_toc_widget_floating_current_heading .current_list_item").text(current_list_item);
220                
221                //floating content show when scroll floating content scroll 
222                widgetFLoatingOpen();
223            },
224        });
225    };
226
227    //Floating option
228    if(handle.isProActivated && widget_floating_option.widget_floating_option == 1){
229        $(".bd_toc_widget_item").prepend(`
230        <div class="current_list_item"></div>
231    `)
232    }
233
234    //Floating navigation insert
235    if(handle.isProActivated && widget_floating_nav.widget_floating_nav == 1){
236        $(".bd_toc_widget_item").prepend(`
237            <div class="bd_toc_widget_nav_prev">
238                <a href="#" class="bd_toc_widget_left_arrow"></a>
239            </div>
240            <div class="bd_toc_widget_nav_next">
241                <a href="#" class="bd_toc_widget_right_arrow"></a>
242            </div>
243        `)
244    }
245
246    //floating content
247    if(handle.isProActivated && widget_floating_content.widget_floating_content == 1){
248        $(".current_list_item").hover(function(){
249            $(this).parent().parent().parent().find(".bd_toc_floating_content").addClass("widget_floating_content_open");
250            $(".bd_toc_widget_floating").css({
251                "border-radius": "15px",
252            });
253        });
254
255        //floating content hide when click floating single content
256        $(".bd_toc_floating_content ul li a ").on("click", function(){
257            $('.bd_toc_floating_content').addClass("floating_content_hide");
258        })
259
260        let title_border_radius_top = widget_floating_content.title_border_radius_top + "px";
261        let title_border_radius_right = widget_floating_content.title_border_radius_right + "px";
262        let title_border_radius_bottom = widget_floating_content.title_border_radius_bottom + "px";
263        let title_border_radius_left = widget_floating_content.title_border_radius_left + "px";
264    
265        $(document).on("mouseleave", ".bd_toc_floating_content", function() {
266
267            if ($(window).width() >= 768) {
268                $(this).removeClass("floating_content_hide");
269                $(this).removeClass("widget_floating_content_open");
270                $(".bd_toc_widget_floating").css(
271                    "cssText",
272                    `
273                    border-top-left-radius: ${title_border_radius_top},
274                    border-top-right-radius: ${title_border_radius_right},
275                    border-bottom-left-radius: ${title_border_radius_bottom},
276                    border-bottom-right-radius: ${title_border_radius_left},
277                    `
278                );
279            }
280        });
281        // for mobile devices
282        if ($(window).width() <= 767) {
283            $(".floating_toc_bg_overlay").on("click", function(){
284                $(".bd_toc_floating_content").removeClass("widget_floating_content_open");
285                $('.bd_toc_widget_floating').removeClass("overlay" );
286                $('.bd_toc_widget_floating_current_heading').css({
287                    "display": "block"
288                })
289            })
290    
291            $(".bd_toc_widget_nav_overlay").on("click", function(){
292                $(this).parent().parent().parent().find(".bd_toc_floating_content").addClass("widget_floating_content_open");
293                $(".bd_toc_widget_floating").css({
294                    "border-radius": "15px"
295                });
296                $('.bd_toc_widget_floating').addClass("overlay" );
297                $('.bd_toc_widget_floating_current_heading').css({
298                    "display": "none"
299                })
300            });
301        }
302    }
303
304    //floating content hide floating position is bottom 
305    if(handle.isProActivated && widget_floating_content.widget_floating_position == "bottom"){
306        $(".current_list_item").hover(function(){
307            $(this).parent().parent().css("display", "none");
308            $(this).parent().parent().parent().find(".bd_toc_floating_content").css("display", "block");
309        });
310
311        $(document).on("mouseleave", ".bd_toc_floating_content", function() {
312            if ($(window).width() >= 768) {
313                $(".bd_toc_widget_floating_current_heading").css("display", "block");
314                $(this).css("display", "none");
315            }
316        });
317
318        if(handle.isProActivated && widget_floating_content.widget_floating_content == 0){
319            $(".current_list_item").hover(function(){
320                $(this).parent().parent().css("display", "block");
321                $(this).parent().parent().parent().find(".bd_toc_floating_content").css("display", "none");
322            });
323        }
324    }
325
326    //floating text update when click single content element
327    $(".bd_toc_content_list_item ul li a ").on("click", function(){
328        if(handle.isProActivated && widget_floating_option.widget_floating_option == "1"){
329            $(".bd_toc_content_floating_list_item").onePageNav({
330                currentClass: "current",
331                scrollChange: function($currentListItem) {
332                    let current_list_item = $(".bd_toc_content_list_item ul li.current").find(">:first-child").text();
333                    $(".bd_toc_widget_floating_current_heading .current_list_item").text(current_list_item);
334                    
335                    //floating content show when scroll floating content scroll 
336                    widgetFLoatingOpen();
337                },
338            });
339        }
340    });
341
342    if($('.bd_toc_content_floating_list_item').length > 0 ) {
343        $('.bd_toc_content_floating_list_item ul:first > li').addClass('root_parent');
344    }
345
346    //floating text update when click floating single content element
347    $(".bd_toc_content_floating_list_item ul li a ").on("click", function(){
348        let current_text = $(".bd_toc_content_floating_list_item ul li.current").find(">:first-child").text();
349        $('.bd_toc_widget_floating_current_heading .current_list_item').text(current_text);
350    });
351
352    //floating navigation when click arrow left button
353    $(".bd_toc_widget_nav_prev").on("click", function(){
354        let pre_id = "";
355        let current_dom = $(".bd_toc_floating_content .bd_toc_content_floating_list_item ul").find("li.current");
356        if(current_dom.prev().children("ul").length > 0){
357            pre_id = current_dom.prev().children("ul").find("li").last().find("a").attr("href");
358
359        }else {
360            if(current_dom.parent().children("li").hasClass("first last")){
361                pre_id = current_dom.parent().parent().find("a").attr("href");
362            }else{
363                pre_id = current_dom.prev().find("a").attr("href");
364            }
365            if(pre_id === undefined){
366                pre_id = current_dom.parent().parent().find("a").attr("href");
367            }
368        }
369        
370        $(".bd_toc_widget_nav_prev a").attr("href", pre_id);
371        $('html').css("scroll-behavior", "smooth");
372    });
373
374   //floating navigation when click arrow right button
375   $(".bd_toc_widget_nav_next").on("click", function(){
376        // e.preventDefault();
377        let next_id;
378        let current_dom = $(".bd_toc_floating_content .bd_toc_content_floating_list_item ul").find("li.current");
379
380        if(current_dom.children("ul").children("li").hasClass("first last")) {
381            next_id = current_dom.children("ul").children("li").find("a").attr("href");
382        } else {
383            let next_element = current_dom.next("li");
384            next_id = next_element.find("a").attr("href");
385            
386            if(current_dom.children("ul").length > 0) {
387                next_id = current_dom.children("ul").children("li").find("a").attr("href");
388            } else {
389                if(next_element.length === 0) {
390                    let parent_li = getFirstParentLi(current_dom[0]);
391                    next_id = $(parent_li).next().children("a").attr("href");
392                } else {
393                    next_id = current_dom.next("li").find("a").attr("href");
394                }
395            }
396        }
397        
398        $(".bd_toc_widget_nav_next a").attr("href", next_id);
399        $('html').css("scroll-behavior", "smooth");
400    });
401
402
403    function getFirstParentLi(element) {
404        if (!element.parentNode || element.parentNode.className === 'root_parent' || element.parentNode.className === 'first root_parent') {
405            return element.parentNode;
406        }
407        // Recursive case: call the function again with the parent element
408        return getFirstParentLi(element.parentNode);
409    }
410
411    let count = $(".bd_toc_container").length;
412
413    for (let i = 0; i < count; i++) {
414        if (i !== 0) {
415            $(".bd_toc_container").eq(1).remove();
416        }
417    }
418
419})(jQuery);

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.