PageSourceSearch

https://rosslandtelegraph.com/wp-content/themes/lonesheep/assets/js/scripts.js?ver=1.0.0

js rosslandtelegraph.com collected 2026-10-02 10:58:04 UTC 5,791 bytes, 233 lines download raw bytes

1jQuery(document).ready(function ($) {
2
3    const isMobile = localStorage.mobile || window.navigator.maxTouchPoints > 1;
4
5    $(document).trigger('resize');
6
7    console.log('loaded.');
8
9
10    $('#date-nav-category').on('change', function(){
11        $(this).closest('form').prop('action', $(this).find(':selected').val() );
12        $(this).closest('form').submit();
13    });
14    $('#date-nav-jurisdiction').on('change', function(){
15        $(this).closest('form').submit();
16    });
17
18    $('.lonesheep-property-switcher').on('change', function(){
19        let link = $(this).find('option:selected').val();
20        window.location = link;
21    });
22
23     /**
24      *
25      *
26      * Return to top
27      *
28      */
29     $(window).on('scroll', function() {
30
31        var scrollTop = $(document).scrollTop();
32
33        if( $(document).height() > 1500 && scrollTop > $(document).height() / 5 )
34        {
35            $('#return-to-top').fadeIn(400);
36        }
37        else
38        {
39            if( $('#return-to-top').is(':visible' ) )
40            {
41                $('#return-to-top').fadeOut(400)
42            }
43        }
44
45    });
46
47
48
49
50     /**
51      *
52      * Sticky Main Nav
53      */
54     var lastScrollTop = 0;
55
56    if (window.innerWidth > 768)
57    {
58        $(window).on('scroll', stickyNav );
59        stickyNav();
60    }
61    else
62    {
63        $('#page-header-sticky').removeClass('sticky');
64        $('body').css("paddingTop", 0 + "px"); // add the height to the body as padding.
65    }
66
67     function stickyNav()
68     {
69         let scrollTop = $(window).scrollTop();
70         let offsetHeight = $('#page-header-topbar').outerHeight();
71         offsetHeight += $('#page-header-masthead').outerHeight();
72
73         if( scrollTop > offsetHeight  )
74         {
75
76             if( scrollTop > $(window).outerHeight() / 4  )
77             {
78                 // if not shown, and scrolling up
79                 if( ! $('#page-header-nav').hasClass('sticky') )
80                 {
81                     // we need padding to offset the height of the header when we remove it from the dom.
82                     var padding = $('#page-header-nav').outerHeight();
83                     $('#page-header-nav').addClass('sticky');
84                     $('body').css("paddingTop", padding + "px"); // add the height to the body as padding.
85
86                 }
87             }
88
89
90         }
91         else
92         {
93             $('#page-header-nav').removeClass('sticky');
94             $('body').css("paddingTop",  "0px"); // restore the padding to 0.
95         }
96
97         lastScrollTop = scrollTop;
98     }
99
100    $('.post-slider').slick({
101        autoplay: true,
102        autoplaySpeed: 3000,
103        dots: true,
104        draggable: true,
105        infinite: true,
106        pauseOnHover: true,
107    });
108
109    $('.post-slider').on('init', function(event, slick, direction){
110        $('.slide-wrapper, .fancy-carousel-slider').fadeIn();
111    });
112
113
114    /**
115     *
116     * Parallax
117     *
118     * @param node
119     * @returns {boolean}
120     */
121    function isInViewport(node) {
122        var rect = node.getBoundingClientRect()
123        return (
124            (rect.height > 0 || rect.width > 0) &&
125            rect.bottom >= 0 &&
126            rect.right >= 0 &&
127            rect.top <= (window.innerHeight || document.documentElement.clientHeight) &&
128            rect.left <= (window.innerWidth || document.documentElement.clientWidth)
129        )
130    }
131
132
133
134    $("a[href*='https://']:not([href*='"+location.hostname.replace("www.","")+"'])").each(function() {
135        $(this).attr('target', '_blank');
136    });
137    $(document).on('click', 'a[href$=".docx"]', function() {
138        $(this).attr('target', "_blank");
139    });
140    $(document).on('click', 'a[href$=".pdf"]', function() {
141        $(this).attr('target', "_blank");
142    });
143
144
145
146    $(window).on('shown.bs.modal', function(e) {
147        if( e.target = "div#searchModal.modal.fade.show" )
148        {
149            $('#search-input').focus();
150        }
151    });
152
153    if( isMobile )
154    {
155        $('li.menu-item-has-children a').on('click', function (){
156
157
158            if( $(this).hasClass('currently-active') )
159            {
160                return true;
161            }
162            else
163            {
164                $('li.menu-item-has-children a').removeClass('currently-active');
165                $(this).addClass('currently-active');
166                return false;
167            }
168
169        })
170    }
171
172
173
174    addRead();
175
176    function addRead() {
177        const post_id = $('article.main-content').data('post_id');
178        console.log('Sending read receipt');
179        if( post_id )
180        {
181            $.ajax({
182                method: "GET",
183                url: ajax_object.ajax_url,
184                dataType: 'json',
185                data: {
186                    action : 'add_read',
187                    post_id : post_id
188                },
189                success: function( response ) {
190                    console.log(response);
191                },
192                error:function(request, status, error) {
193                    // silence.
194                }
195            });
196        }
197    }
198
199
200    /*
201
202    Bruce disabled Sept 1
203
204    setTimeout(function() {
205
206        const post_id = $('article.main-content').data('post_id');
207
208        if( post_id )
209        {
210            $.ajax({
211                method: "GET",
212                url: ajax_object.ajax_url,
213                dataType: 'json',
214                data: {
215                    action : 'add_read',
216                    post_id : post_id
217                },
218                success: function( response ) {
219                    console.log(response);
220                },
221                error:function(request, status, error) {
222                    // silence.
223                }
224            });
225        }
226
227    }, 5000 ); // 5s to record a 'read'.
228
229 */
230
231});
232
233

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.