PageSourceSearch

https://clspectrum.com/scripts/PV%20Sites/pubNavAdjustPubPage.js

js clspectrum.com collected 2026-10-02 04:15:44 UTC 3,771 bytes, 110 lines download raw bytes

1// Combined JavaScript Document
2
3jQuery(document).ready(function($) {
4    var pubsOpen = false;
5
6    var openNavs = function(){
7        $('.body-overlay').addClass('overlay-on');
8        $('.pubs-nav-carousel').addClass('pubs-carousel-open');
9        $('.pubsToggle').addClass('pubsShow');
10        pubsOpen = true;
11        updateSidebarStyles();
12    }
13
14    var closeNavs = function(){
15        $('.body-overlay').removeClass('overlay-on');
16        $('.pubs-nav-carousel').removeClass('pubs-carousel-open');
17        $('.pubsToggle').removeClass('pubsShow');
18        pubsOpen = false;
19        resetSidebarStyles();
20    }
21
22    $('.pubsToggle').click( function(event) {
23        event.stopPropagation();
24        var toggle = pubsOpen ? closeNavs : openNavs;
25        toggle();
26    });
27
28    $('.toggleSidebar').click( function(event) {
29        event.stopPropagation();
30        closeNavs();
31    });
32
33    $(document).click( function(event){
34        if ( !$(event.target).closest('.pubs-nav-carousel').length && !$(event.target).closest('.toggleSidebar').length ) {
35            closeNavs();   
36        }
37    });
38
39    var topAd = document.getElementById("topAd");
40    var topNav = document.getElementById("topNav");
41    var pubNav = document.getElementById("pubNav");
42
43    function updateSidebarStyles() {
44        if (pubsOpen) {
45            var scrollOffset = window.scrollY;
46            var windowWidth = window.innerWidth;
47            var topNavOffset = topNav.getBoundingClientRect().bottom;
48
49            // Check if the window width is less than 750px and hide topAd accordingly
50           /* if (windowWidth < 750) {
51                topAd.style.display = "none";
52            } else {
53                topAd.style.display = "grid"; // Change "block" to "grid"
54            }
55            */
56            var topAdHeight = topAd.offsetHeight;
57            var topNavHeight = topNav.offsetHeight;
58
59            if (scrollOffset < topAdHeight + topNavHeight) {
60                pubNav.style.transition = "top 0.1s";
61                pubNav.style.top = (topAdHeight + topNavHeight - scrollOffset) + "px";
62            } else {
63                pubNav.style.transition = "top 0.1s";
64                pubNav.style.top = (topAdHeight + topNavHeight - scrollOffset) + "px";
65            }
66            
67            if (topNavOffset <= 0) {
68                // Scrolled past topNav, toggle off specific classes
69                $('.body-overlay').removeClass('overlay-on');
70                $('.pubs-nav-carousel').removeClass('pubs-carousel-open');
71                $('.pubsToggle').removeClass('pubsShow');
72
73                // Remove top and transition properties
74                pubNav.style.top = "";
75                pubNav.style.transition = "none";
76            }
77        }
78    }
79
80    
81    function resetSidebarStyles() {
82        // Reset top and transition
83        pubNav.style.transition = "none";
84        pubNav.style.top = "";
85    }
86
87    function handleResize() {
88        // Reset transition to zero to avoid transition during resize
89        pubNav.style.transition = "none";
90        // Call the updateSidebarStyles function on window resize
91        updateSidebarStyles();
92        // Trigger a reflow before adding back the transition to ensure it takes effect
93        void pubNav.offsetWidth;
94        pubNav.style.transition = "top 0.1s";
95    }
96
97    window.addEventListener("scroll", updateSidebarStyles);
98    
99    // Add event listener for window resize
100    window.addEventListener("resize", handleResize);
101
102    // Initial update when the page loads
103    updateSidebarStyles();
104
105    // Update every 10 seconds
106    //setInterval(updateSidebarStyles, 500);
107});
108
109
110                        

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.