PageSourceSearch

https://newsd.in/wp-content/themes/wpzoom-prime-news/js/functions.js

js newsd.in collected 2026-10-02 05:28:43 UTC 6,040 bytes, 230 lines download raw bytes

1/**
2 * Theme functions file
3 */
4(function ($) {
5    'use strict';
6
7    var $document = $(document);
8    var $window = $(window);
9
10
11    /**
12    * Document ready (jQuery)
13    */
14    $(function () {
15
16
17        /**
18         * Activate superfish menu.
19         */
20        $('.sf-menu').superfish({
21            'speed': 'fast',
22            'delay' : 0,
23            'animation': {
24                'height': 'show'
25            }
26        });
27
28
29       /**
30        * SlickNav
31        */
32
33       $('#menu-main-slide').slicknav({
34           prependTo:'.navbar-header-main',
35           allowParentLinks: true,
36           closedSymbol: "",
37           openedSymbol: ""
38           }
39       );
40
41
42       var viewableOffset = $(".main-navbar").offset().top - $(window).scrollTop();
43
44
45       /**
46        * Activate Headroom.
47        */
48       $('.main-navbar').headroom({
49          tolerance: {
50              up: 0,
51              down: 0
52          },
53          offset : viewableOffset
54       });
55
56
57
58            /**
59             * Sidebar Panel
60             */
61            $('.side-panel-btn a').click(function(e){
62                e.preventDefault();
63                   setTimeout(function(){
64                       $window.trigger('resize');
65                   }, 100);
66                $('#pageslide').addClass("visible").hide().fadeIn(100);
67                $('#pageslide .panel').hide().show("slide", {"direction":($('#pageslide').hasClass("slide-from-right")?"right":"left")}, 100);
68            });
69
70            $('#pageslide').click(function(e){ if(e.target == this) closePageSlide(e); });
71            $('#pageslide .closeBtn').click(closePageSlide);
72            $(document).keydown(function(e){ if ( $('#pageslide').hasClass("visible") && e.keyCode == 27 ) closePageSlide(e); });
73            function closePageSlide(event) {
74                event.preventDefault();
75                $('#pageslide').removeClass("visible").fadeOut(100);
76                $('#pageslide .panel').hide("slide", {"direction":($('#pageslide').hasClass("slide-from-right")?"right":"left")}, 100);
77            }
78
79
80               $('<span class="child-arrow">&#62279;</span>')
81                .click(function(e){
82                    e.preventDefault();
83
84                    var $li = $(this).closest('li'),
85                        $sub = $li.find('> ul');
86
87                    if ( $sub.is(':visible') ) {
88                        $sub.slideUp();
89                        $li.removeClass('open');
90                    } else {
91                        $sub.slideDown();
92                        $li.addClass('open');
93                    }
94                })
95                .appendTo('#pageslide .panel .widget.widget_nav_menu ul.menu li.menu-item-has-children > a');
96
97
98
99
100        /**
101         * FitVids - Responsive Videos in posts
102         */
103        $(".entry-content, .widget").fitVids();
104
105
106        /**
107         * Search form in header.
108         */
109        $(".sb-search").sbSearch();
110
111
112        /**
113         * News ticker.
114         */
115        $('#ticker').ticker();
116
117
118
119    });
120
121    $window.on('load', function() {
122        // $window.ready(function() {
123
124        /**
125         * Activate main slider.
126         */
127        $('#slider').sllider();
128
129
130    });
131
132
133    $.fn.sllider = function() {
134        return this.each(function () {
135            var $this = $(this);
136
137            var $slides = $this.find('.slide');
138
139            if ($slides.length <= 1) {
140                $slides.addClass('is-selected');
141
142                return;
143            }
144
145            var flky = new Flickity('.slides', {
146                autoPlay: (zoomOptions.slideshow_auto ? parseInt(zoomOptions.slideshow_speed, 10) : false),
147                cellAlign: 'center',
148                contain: true,
149                percentPosition: false,
150                //prevNextButtons: false,
151                pageDots: true,
152                wrapAround: true,
153                arrowShape: {
154                  x0: 10,
155                  x1: 60, y1: 50,
156                  x2: 60, y2: 45,
157                  x3: 15
158                },
159                accessibility: false
160            });
161        });
162    };
163
164
165    $.fn.ticker = function() {
166        return this.each(function () {
167            var $this = $(this);
168
169            var _scroll = {
170                delay: 1000,
171                easing: 'linear',
172                items: 1,
173                duration: 0.05,
174                timeoutDuration: 0,
175                pauseOnHover: 'immediate'
176            };
177
178            $this.carouFredSel({
179                width: 1000,
180                align: false,
181                items: {
182                    width: 'variable',
183                    height: 35,
184                    visible: 1
185                },
186                scroll: _scroll
187            });
188
189            $this.parent('.caroufredsel_wrapper').css('width', '100%');
190        }) ;
191    };
192
193
194    $.fn.sbSearch = function() {
195       return this.each(function() {
196           new UISearch( this );
197       });
198    };
199
200    UISearch.prototype.open = function() {
201        var self = this;
202        var headerMisc = this.el.parentElement;
203        var menuTop = headerMisc.getElementsByClassName('menu-search-container')[0];
204        classie.add( this.el, 'sb-search-open' );
205        classie.add( menuTop, 'sb-search-menu-hidden' );
206        // focus the input
207        this.inputEl.focus();
208
209        // close the search input if body is clicked
210        var bodyFn = function( ev ) {
211            self.close();
212            this.removeEventListener( 'click', bodyFn );
213            this.removeEventListener( 'touchstart', bodyFn );
214        };
215        document.addEventListener( 'click', bodyFn );
216        document.addEventListener( 'touchstart', bodyFn );
217    }
218
219    UISearch.prototype.close = function() {
220        var headerMisc = this.el.parentElement;
221        var menuTop = headerMisc.getElementsByClassName('menu-search-container')[0];
222        this.inputEl.blur();
223        classie.remove( this.el, 'sb-search-open' );
224        classie.remove( menuTop, 'sb-search-menu-hidden' );
225    }
226
227
228    retinajs();
229
230})(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.