PageSourceSearch

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

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