PageSourceSearch

https://www.newsbots.eu/wp-content/themes/hantus/assets/js/custom.js?ver=1

js newsbots.eu collected 2026-09-26 16:56:15 UTC 14,136 bytes, 329 lines download raw bytes

1jQuery(function($) {
2
3    $(document).ready(function() {
4        // Header Slider
5        var owlMainSlider = $('.header-slider');
6        owlMainSlider.owlCarousel({
7            rtl:$("html").attr("dir") == 'rtl' ? true : false,
8            items: 1,
9            loop: true,
10            dots: false,
11            nav: true,
12            navText: ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'],
13            autoplay: false,
14            smartSpeed: 1000,
15            responsive: {
16                0: {},
17                768: {},
18                992: {}
19            }
20        });
21        // Header Slide items with animate.css    
22        owlMainSlider.owlCarousel();
23        owlMainSlider.on('translate.owl.carousel', function (event) {
24            var data_anim = $("[data-animation]");
25            data_anim.each(function() {
26                var anim_name = $(this).data('animation');
27                $(this).removeClass('animated ' + anim_name).css('opacity', '0');
28            });
29        });
30        $("[data-delay]").each(function() {
31            var anim_del = $(this).data('delay');
32            $(this).css('animation-delay', anim_del);
33        });
34        $("[data-duration]").each(function() {
35            var anim_dur = $(this).data('duration');
36            $(this).css('animation-duration', anim_dur);
37        });
38        owlMainSlider.on('translated.owl.carousel', function() {
39            var data_anim = owlMainSlider.find('.owl-item.active').find("[data-animation]");
40            data_anim.each(function() {
41                var anim_name = $(this).data('animation');
42                $(this).addClass('animated ' + anim_name).css('opacity', '1');
43            });
44        });
45
46        $(".testimonial-content").owlCarousel({
47            nav: true,
48        	navText: ['<i class="fa fa-long-arrow-left"></i>', '<i class="fa fa-long-arrow-right"></i>'],
49            items: 1,
50            margin: 1,
51            dots: false,
52            linked: ".testimonial-thumb"
53        });
54        var sync2 = $(".testimonial-thumb");
55        $(sync2).owlCarousel({
56            loop: true,
57            dots: false,
58            items: 3,
59            center: true,
60            nav: false,
61            margin: 10,
62            linked: sync2.prev()
63        }).on('initialized.owl.carousel linked.to.owl.carousel', function() {
64            sync2.find('.owl-item.current').removeClass('current');
65            var current = sync2.find('.owl-item.active.center').length ? sync2.find('.owl-item.active.center') : sync2.find('.owl-item.active').eq(0);
66            current.addClass('current');
67        });
68
69        /* --------------------------------------
70            Scroll UP
71        -------------------------------------- */
72
73        $(window).on('scroll', function() {
74            if ($(this).scrollTop() > 100) {
75                $('.scrollup').fadeIn();
76            } else {
77                $('.scrollup').fadeOut();
78            }
79        });
80
81        $('.scrollup').on('click', function() {
82            $("html, body").animate({
83                scrollTop: 0
84            }, 600);
85            return false;
86        });
87
88        // Search
89        var changeClass = function(name) {
90            $('#search').removeAttr('class').addClass(name);
91        }
92
93        /*------------------------------------
94            Search
95        --------------------------------------*/
96
97        $('.sb-icon-search').on('click', function(e) {
98            var $searchbox = $('.sb-search');
99            if ($searchbox.hasClass('sb-search-open')) {
100                $searchbox.removeClass('sb-search-open');
101                $(".sb-search-toggle").focus();
102            } else {
103                $searchbox.addClass('sb-search-open');
104                $('.sb-search-input').focus();
105            }
106            e.preventDefault();
107            var links,i,len,searchItem=document.querySelector('.sb-search-popup'),fieldToggle=document.querySelector('.sb-search-input');let focusableElements='button, [href], input, select, textarea, [tabindex]:not
107([tabindex="-1"])';let firstFocusableElement=fieldToggle;let focusableContent=searchItem.querySelectorAll(focusableElements);let lastFocusableElement=focusableContent[focusableContent.length-1];if(!searchItem){return!1}
108            links=searchItem.getElementsByTagName('button');for(i=0,len=links.length;i<len;i++){links[i].addEventListener('focus',toggleFocus,!0);links[i].addEventListener('blur',toggleFocus,!0)}
109            function toggleFocus(){var self=this;while(-1===self.className.indexOf('sb-search-popup')){if('input'===self.tagName.toLowerCase()){if(-1!==self.className.indexOf('focus')){self.className=self.className.replace('focus','')}else{self.className+=' focus'}}
110            self=self.parentElement}}
111            document.addEventListener('keydown',function(e){let isTabPressed=e.key==='Tab'||e.keyCode===9;if(!isTabPressed){return}
112            if(e.shiftKey){if(document.activeElement===firstFocusableElement){lastFocusableElement.focus();e.preventDefault()}}else{if(document.activeElement===lastFocusableElement){firstFocusableElement.focus();e.preventDefault()}}})
113        });
114        /*------------------------------------
115            Cart
116        --------------------------------------*/
117        function overlayToggle() {
118            if ($('.cart-overlay').hasClass('active')) {
119                $('.cart-overlay').removeClass('active');
120                $('body').removeClass('overflowed');
121            } else {
122                $('.cart-overlay').addClass('active');
123                $('body').addClass('overflowed');
124            }
125        }
126        $('.cart--open, .cart-overlay, .close-sidenav').on('click', function(e) {
127            var $sidecart = $('.sidenav.cart');
128            if ($sidecart.hasClass('active')) {
129                $sidecart.removeClass('active');
130                $(".cart--open").focus();
131            } else {
132                $sidecart.addClass('active');
133                $("button.close-sidenav").focus();
134            }
135            //alert('Click the OK button Now !');
136            overlayToggle();
137            e.preventDefault();
138            var linksCart,iCart,lenCart,cartItem=document.querySelector('.sidenav-div'),cartToggle=document.querySelector('.close-sidenav');let focusableCart='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';let firstFocusCartElement=cartToggle;let focusCartContent=cartItem.querySelectorAll(focusableCart);let lastFocusCartElement=focusCartContent[focusCartContent.length-1];if(!cartItem){return!1}
139            linksCart=cartItem.getElementsByTagName('button');for(iCart=0,lenCart=linksCart.length;iCart<lenCart;iCart++){linksCart[iCart].addEventListener('focus',toggleFocus,!0);linksCart[iCart].addEventListener('blur',toggleFocus,!0)}
140            function toggleFocus(){var self=this;while(-1===self.className.indexOf('sidenav-div')){if('input'===self.tagName.toLowerCase()){if(-1!==self.className.indexOf('focus')){self.className=self.className.replace('focus','')}else{self.className+=' focus'}}
141            self=self.parentElement}}
142            document.addEventListener('keydown',function(e){let isTabPressed=e.key==='Tab'||e.keyCode===9;if(!isTabPressed){return}
143            if(e.shiftKey){if(document.activeElement===firstFocusCartElement){lastFocusCartElement.focus();e.preventDefault()}}else{if(document.activeElement===lastFocusCartElement){firstFocusCartElement.focus();e.preventDefault()}}})
144        });
145
146        /*------------------------------------
147            Sticky Menu
148        --------------------------------------*/
149        var $window       = $( window );
150        var lastScrollTop = 0;
151        var $header       = $( '.sticky-nav' );
152        var headerBottom  = $header.position().top + $header.outerHeight( true );
153
154        $window.scroll( function() {
155
156            var windowTop  = $window.scrollTop();
157
158            // Add custom sticky class 
159            if ( windowTop >= headerBottom ) {
160                $header.addClass( 'is-sticky' );
161                $header.addClass( 'swingOutX' );
162                $header.removeClass( 'swingInX' );
163            } else {
164                $header.removeClass( 'is-sticky' );
165                $header.removeClass( 'show' );
166                $header.removeClass( 'swingOutX' );
167                $header.addClass( 'swingInX' );
168            }
169
170            // Show/hide
171            if ( $header.hasClass( 'is-sticky' ) ) {
172                if ( windowTop <= headerBottom || windowTop < lastScrollTop ) {
173                    $header.addClass( 'show' );
174                    $header.addClass( 'swingInX' );
175                    $header.removeClass( 'swingOutX' );
176                } else {
177                    $header.removeClass( 'show' );
178                    $header.removeClass( 'swingInX' );
179                    $header.addClass( 'swingOutX' );
180                }
181            }
182
183            lastScrollTop = windowTop;
184
185        } );
186
187        /*------------------------------------
188            jQuery MeanMenu
189        --------------------------------------*/
190        $('.mobile-menu-active').meanmenu({
191            meanScreenWidth: "991",
192            meanMenuContainer: '.mobile-menu'
193        });
194
195        /* last  2 li child add class */
196        $('ul.menu > li').slice(-2).addClass('last-elements');
197
198        // Add/Remove .focus class for accessibility
199        $('.main-menu').find( 'a' ).on( 'focus blur', function() {
200            $( this ).parents( 'ul, li' ).toggleClass( 'focus' );
201        });
202    });
203
204    function processAutoheight() {
205        var maxHeight = 0;
206
207        // This will check first level children ONLY as intended.
208        $(".navbar-area .navigation:not(.cr-dropdown-menu)").each(function(){
209
210            height = $(this).outerHeight(true); // outerHeight will add padding and margin to height total
211            if (height > maxHeight ) {
212                maxHeight = height;
213            }
214        });
215
216        $(".navbar-area").css('min-height', maxHeight);
217    }
218
219    // Recalculate under any condition that the viewport dimension has changed
220    $(document).ready(function() {
221
222        $(window).resize(function() { processAutoheight(); });
223
224        // BOTH were required to work on any device "document" and "window".
225        // I don't know if newer jQuery versions fixed this issue for any device.
226        $(document).resize(function() { processAutoheight(); });
227
228        // First processing when document is ready
229        processAutoheight();
230    });
231
232    $(document).ready(function() {
233        var formFields = $('.input-hantus');
234        formFields.each(function(){
235            var field = $(this);
236            var input = field.find('input, textarea');
237            var label = field.find('label span, label');            
238            function checkInput() {
239                var valueLength = input.val().length;
240                if (valueLength >= 0) {
241                    input.addClass('_2Pfbi');
242                    label.addClass('_2tL9P');
243                } 
244                else{
245                    input.removeClass('_2Pfbi');
246                    label.removeClass('_2tL9P');
247                }
248            }
249        
250            input.focus(function() {
251                input.addClass('_2Pfbi');
252                label.addClass('_2tL9P');
253                checkInput()
254            })
255            input.focusout(function() {
256                 checkInput();
257                if(input.val().length<= 0){
258                    input.removeClass('_2Pfbi');
259                    label.removeClass('_2tL9P');
260                }
261            })
262        });
263    });
264
265    $(document).ready(function() {
266        var formFields = $('.search-form');
267        formFields.each(function(){
268            var field = $(this);
269            var input = field.find('label input');
270            var label = field.find('label span');            
271            function checkInput() {
272                var valueLength = input.val().length;
273                if (valueLength >= 0) {
274                    input.addClass('_2Pfbi');
275                    label.addClass('_2tL9P');
276                } 
277                else{
278                    input.removeClass('_2Pfbi');
279                    label.removeClass('_2tL9P');
280                }
281            }        
282            input.focus(function() {
283                input.addClass('_2Pfbi');
284                label.addClass('_2tL9P');
285                checkInput()
286            })
287            input.focusout(function() {
288                 checkInput();
289                if(input.val().length<= 0){
290                    input.removeClass('_2Pfbi');
291                    label.removeClass('_2tL9P');
292                }
293            })
294        });
295    });
296
297    $(document).ready(function() {
298        var formFields = $('[class*="comment-form-"], .woocommerce-product-search');
299        formFields.each(function(){
300            var field = $(this);
301            var input = field.find('input, textarea');
302            var label = field.find('label');            
303            function checkInput() {
304                var valueLength = input.val().length;
305                if (valueLength >= 0) {
306                    input.addClass('_2Pfbi');
307                    label.addClass('_2tL9P');
308                } 
309                else{
310                    input.removeClass('_2Pfbi');
311                    label.removeClass('_2tL9P');
312                }
313            }        
314            input.focus(function() {
315                input.addClass('_2Pfbi');
316                label.addClass('_2tL9P');
317                checkInput()
318            })
319            input.focusout(function() {
320                 checkInput();
321                if(input.val().length<= 0){
322                    input.removeClass('_2Pfbi');
323                    label.removeClass('_2tL9P');
324                }
325            })
326        });
327    });
328
329});

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.