PageSourceSearch

https://sinalaberto.pt/wp-content/themes/digiqole/assets/js/script.js?ver=2.0.2

js sinalaberto.pt collected 2026-10-02 12:25:46 UTC 17,772 bytes, 529 lines download raw bytes

1jQuery( document ).ready( function($){
2   "use strict";
3
4 
5   /**-------------------------------------------------
6     *Fixed Header
7     *----------------------------------------------------**/
8    $(window).on('scroll', function () {
9
10      /**Fixed header**/
11      if ($(window).scrollTop() > 250) {
12      $('.navbar-sticky').addClass('sticky fade_down_effect');
13      } else {
14      $('.navbar-sticky').removeClass('sticky fade_down_effect');
15      }
16    });
17    
18
19
20  /* ----------------------------------------------------------- */
21  /*  Menu
22  /* ----------------------------------------------------------- */
23   $('.dropdown > a').on('click', function(e) {
24      e.preventDefault();
25      if($(window).width() > 991)
26      {
27         location.href = this.href; 
28      } 
29      var dropdown = $(this).parent('.dropdown');
30      dropdown.find('>.dropdown-menu').slideToggle('show');
31      $(this).toggleClass('opened');
32      return false;
33    });
34
35    $('.digiqole-elementskit-menu').each(function(){
36        $(this).parents('.navbar').addClass('digiqole-elementskit-menu-container');
37    });
38
39    /*==========================================================
40                39. scroll bar
41    ======================================================================*/
42
43
44   /* ----------------------------------------------------------- */
45   /*  tooltip
46   /* ----------------------------------------------------------- */
47   $(document).ready(function () {
48      $('[data-toggle="tooltip"]').tooltip();
49   });
50
51    /*==========================================================
52                   search popup
53        ======================================================================*/
54        if ($('.xs-modal-popup').length > 0) {
55            $('.xs-modal-popup').magnificPopup({
56                type: 'inline',
57                fixedContentPos: false,
58                fixedBgPos: true,
59                overflowY: 'auto',
60                closeBtnInside: false,
61                callbacks: {
62                    beforeOpen: function beforeOpen() {
63                        this.st.mainClass = "my-mfp-slide-bottom xs-promo-popup";
64                    }
65                }
66            });
67        }
68
69    /* ----------------------------------------------------------- */
70   /*  Video popup
71   /* ----------------------------------------------------------- */
72
73  if ($('.ts-play-btn').length > 0) {
74   $('.ts-play-btn').magnificPopup({
75       type: 'iframe',
76       mainClass: 'mfp-with-zoom',
77       zoom: {
78           enabled: true, // By default it's false, so don't forget to enable it
79
80           duration: 300, // duration of the effect, in milliseconds
81           easing: 'ease-in-out', // CSS transition easing function
82
83           opener: function (openerElement) {
84               return openerElement.is('img') ? openerElement : openerElement.find('img');
85           }
86       }
87   });
88}
89
90  if ($('.play-btn').length > 0) {
91   $('.play-btn').magnificPopup({
92       type: 'iframe',
93       mainClass: 'mfp-with-zoom',
94       zoom: {
95           enabled: true, // By default it's false, so don't forget to enable it
96
97           duration: 300, // duration of the effect, in milliseconds
98           easing: 'ease-in-out', // CSS transition easing function
99
100           opener: function (openerElement) {
101               return openerElement.is('img') ? openerElement : openerElement.find('img');
102           }
103       }
104   });
105}
106
107
108   /* ----------------------------------------------------------- */
109   /*  Back to top
110   /* ----------------------------------------------------------- */
111
112   $(window).on('scroll', function () {
113    if ($(window).scrollTop() > $(window).height()) {
114       $(".BackTo").fadeIn('slow');
115    } else {
116       $(".BackTo").fadeOut('slow');
117    }
118
119    });
120    $("body, html").on("click", ".BackTo", function (e) {
121        e.preventDefault();
122        $('html, body').animate({
123          scrollTop: 0
124        }, 800);
125    });
126
127    /*==========================================================
128                related post slider 
129    ======================================================================*/
130
131    related_post_slider($);
132
133
134    /*==========================================================
135                category feature slider
136    ======================================================================*/
137    $(function() {
138        let slide_loop = false;
139        let slide_autoplay = true;
140        let slide_autoplay_delay = 2500;
141        let slider_space_between = 30;
142        new Swiper( '.category-feature-slider', {
143            slidesPerView: 1,
144            centeredSlides: false,
145            spaceBetween: slider_space_between,
146            loop: slide_loop,
147            slidesPerGroup: 1,
148            wrapperClass: 'swiper-wrapper',
149            slideClass: 'swiper-slide',
150            grabCursor: false,
151            allowTouchMove: true,
152            speed: 1200, //slider transition speed
153            parallax: true,
154            autoplay: slide_autoplay ? { delay: slide_autoplay_delay } : false,
155            effect: 'slide',
156            mousewheelControl: 1,
157            pagination: {
158                el: '.swiper-pagination',
159                type: 'bullets',
160                dynamicBullets: true,
161                clickable: true,
162            },
163            navigation: {
164                nextEl: '.swiper-next-button',
165                prevEl: '.swiper-prev-button',
166            },
167            
168        } );
169    });
170
171    
172
173    /*==========================================================
174                     scroll bar
175        ======================================================================*/
176
177        $('.video-tab-list .post-tab-list li').on('click',function(){
178            $('.video-index').html($(this).data('index'));
179        });
180
181        if ($(".video-tab-scrollbar").length > 0) {
182
183         $(".video-tab-scrollbar").mCustomScrollbar({
184             mouseWheel: true,
185             scrollButtons: {
186                 enable: true
187             }
188         });
189         
190     }
191    
192          /*==========================================================
193                    review rating circle
194        ======================================================================*/
195        $(function() {
196            $('.review-chart').easyPieChart({
197              scaleColor: "",
198              lineWidth: 5,
199              lineCap: 'butt',
200              barColor: '#1abc9c',
201              trackColor:	"rgba(34,34,34, .4)",
202              size: 70,
203              animate: 70
204            });
205          });
206
207         /*==========================================================
208                   reading progressbar
209        ======================================================================*/  
210       
211        window.onscroll = function() { reading_progressbar() };
212
213         function reading_progressbar() {
214               var digiqole_winScroll = document.body.scrollTop || document.documentElement.scrollTop;
215               var digiqole_height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
216               var digiqole_scrolled = (digiqole_winScroll / digiqole_height) * 100;
217               if (document.getElementById("readingProgressbar")) {
218                document.getElementById("readingProgressbar").style.width = digiqole_scrolled + "%";
219            }
220         }
221       
222        reading_progress_bar_post();
223  
224         function reading_progress_bar_post() {
225           
226            var progressWrap = $('.digiqole_progress_container');
227            var entry_top = $('.entry-content');
228       
229            if (entry_top.length > 0) {
230                if ( progressWrap.length > 0 ) {
231                    var didScroll = false,
232                        windowWrap = $(window),
233
234                        contentWrap = $('.entry-content'),
235                        contentHeight = contentWrap.height(),
236                        windowHeight = windowWrap.height() * .85;
237        
238                    $(window).scroll(function() {
239                        didScroll = true;
240                    });
241        
242                    $(window).on('resize', function(){
243                        windowHeight = windowWrap.height() * .85;
244                        progressReading();
245                    });
246        
247                    setInterval(function() {
248                        if ( didScroll ) {
249                            didScroll = false;
250                            progressReading();
251                        }
252                    }, 150);
253        
254                    var progressReading = function() {
255        
256                        var windowScroll = windowWrap.scrollTop(),
257                            contentOffset = contentWrap.offset().top,
258                            contentScroll = ( windowHeight - contentOffset ) + windowScroll,
259                            progress = 0;
260        
261                        if ( windowHeight > contentHeight + contentOffset ) {
262                            progressWrap.find('.progress-bar').width(0);
263                        } else {
264                            if ( contentScroll > contentHeight ) {
265                                progress = 100;
266                            } else if ( contentScroll > 0 ) {
267                                progress = ( contentScroll / contentHeight ) * 100 ;
268                            
269                            }
270        
271                            progressWrap.find('.progress-bar').width(progress + '%');
272                        }
273                    }
274                }
275            } else{
276                return false;
277            }
278        }
279
280        /* ----------------------------------------------------------- */
281        /*sticky sidebar
282        /* ----------------------------------------------------------- */
283        sticky_sidebar($);
284
285
286
287    /* ----------------------------------------------------------- */
288    /*single  post gallery  slider
289    /* ----------------------------------------------------------- */
290    $(function() {
291        let $container = $( '.single-post-gallery-wrap' );            
292        if ( $container.length > 0 ) {
293            let slides_to_show = 4;
294            let slider_space_between = 10;			
295            // eslint-disable-next-line
296            var galleryTop = new Swiper(".single-post-sync-slider1", {
297                loop: true,
298                loopedSlides: 5, //looped slides should be the same
299                thumbs: {
300                    swiper: new Swiper( '.sync-slider2', {
301                    spaceBetween: slider_space_between,
302                    slidesPerView: slides_to_show,
303                    loop: true,
304                    freeMode: true,
305                    loopedSlides: 5, //looped slides should be the same
306                    watchSlidesVisibility: true,
307                    watchSlidesProgress: true,
308                    breakpoints: {
309                        0: {
310                            slidesPerView: 1,
311                        },
312                        767: {
313                            slidesPerView: 2,
314                        },
315                        1024: {
316                            slidesPerView: 3,
317                        },
318                    },
319                    } ),
320                },
321            } );
322        }
323    });
324
325      /*==========================================================
326                        Preloader
327      ======================================================================*/
328      $(window).on('load', function () {
329         
330        setTimeout(() => {
331           $('#preloader').addClass('loaded');
332        }, 1000);
333        
334        });
335        
336     // preloader close
337     $('.preloader-cancel-btn').on('click', function (e) {
338        e.preventDefault();
339        if (!($('#preloader').hasClass('loaded'))) {
340           $('#preloader').addClass('loaded');
341        }
342     });
343
344
345     /*==========================================================
346                       scroll
347      ======================================================================*/
348   
349    $.fn.isInViewport = function () {
350        let elementTop = $(this).offset().top;
351        let elementBottom = elementTop + $(this).outerHeight();
352    
353        let viewportTop = $(window).scrollTop();
354        let viewportBottom = viewportTop + $(window).height();
355    
356        return elementBottom > viewportTop && elementTop < viewportBottom;
357    };
358
359
360    $(window).on('scroll', function () {
361
362        $('.ajax-loader-current-url').each(function(){
363            if ($(this).isInViewport()) {
364                var current_url = $(this).data('current-url');
365                if(window.location.href != current_url){
366                    window.history.pushState('html', 'title', current_url);
367                }
368            }
369        });
370
371        $('.blog-ajax-load-more-trigger').each(function(index){
372            if ($(this).isInViewport()) {
373                var current_post = index + 1;
374                var _this = $(this);
375                var next_post_url = $(this).data('next-post-url');
376                var max_posts = $(this).data('max-posts');
377                var content_loaded = $(this).data('content-loaded');
378
379                if( current_post >= max_posts){
380                    _this.fadeOut(2000);
381                    return;
382                }
383
384                if(content_loaded == 'no'){
385                    $.ajax({
386                        type: "GET",
387                        url: next_post_url,
388                        success: function (content) {
389                            var content = $(content).find('#blog-ajax-load-more-container').html();
390                            _this.after(content);
391                            related_post_slider($);
392                            sticky_sidebar($);
393                        }
394                    });
395                }
396                _this.fadeOut(2000);
397                _this.data('content-loaded', 'yes');
398            } 
399        });
400    });
401    /*--------------scroll end---------*/
402
403    
404    
405    /*==========================================================
406                             Dark-light mode
407    ======================================================================*/
408    $(document).on('click', '.change-mode', function(){
409        
410		var defaultSkin = $('html').data('skin'),
411		    siteSkin    = 'light';
412
413		if( $('html').hasClass( 'dark-mode' ) ){
414			siteSkin = 'dark';
415		}
416
417    var switchTo = ( siteSkin == 'dark' ) ? 'light' : 'dark';
418            if( 'undefined' != typeof localStorage ){
419                localStorage.setItem( 'digi-skin', switchTo );
420            }
421
422            if( defaultSkin == switchTo ){
423                $('html').removeClass('digi-skin-switch');
424            }
425            else{
426                $('html').addClass('digi-skin-switch');
427            }
428
429            if( switchTo == 'dark' ){
430                $('html').addClass( 'dark-mode' );			
431            }
432            else{
433                $('html').removeClass( 'dark-mode' );
434            }
435    });
436
437    const loadScripts_PreloadTimer=setTimeout(triggerScriptLoader_Preload,8e3),userInteractionEvents_Preload=["mouseover","keydown","touchstart","touchmove","wheel"];
438    function triggerScriptLoader_Preload(){
439        document.querySelector("html").classList.add("is-active-page"),clearTimeout(loadScripts_PreloadTimer)
440    }
441    userInteractionEvents_Preload.forEach(function(e){
442        window.addEventListener(e,triggerScriptLoader_Preload,{
443            passive:!0
444        })
445    });
446
447
448    if ( fontList ) {
449    const observeFontList = fontList.map((fontName) => {
450		const observer = new FontFaceObserver(fontName);
451		return observer.load();
452	});
453
454	Promise.all(observeFontList).then(function(){
455        document.documentElement.className += " fonts-loaded";
456    });
457    } else {
458        const barlowObserver = new FontFaceObserver('Barlow');
459        const robotoObserver = new FontFaceObserver('Roboto');
460        Promise.all([
461            barlowObserver.load(),
462            robotoObserver.load()
463            ]).then(function(){
464            document.documentElement.className += " fonts-loaded";
465        });
466
467    }
468
469} );
470
471// Related post slider function
472
473function related_post_slider($){
474    let slide_loop = true;
475    let slide_autoplay = true;
476    let slide_autoplay_delay = 2500;
477    let slider_space_between = 30;
478    new Swiper( '.popular-grid-slider', {
479        slidesPerView: 3,
480        centeredSlides: false,
481        spaceBetween: slider_space_between,
482        loop: slide_loop,
483        slidesPerGroup: 1,
484        wrapperClass: 'swiper-wrapper',
485        slideClass: 'swiper-slide',
486        grabCursor: false,
487        allowTouchMove: true,
488        speed: 1200, //slider transition speed
489        parallax: true,
490        autoplay: slide_autoplay ? { delay: slide_autoplay_delay } : false,
491        effect: 'slide',
492        mousewheelControl: 1,
493        pagination: {
494            el: '.swiper-pagination',
495            type: 'bullets',
496            dynamicBullets: true,
497            clickable: true,
498        },
499        navigation: {
500            nextEl: '.swiper-next-button',
501            prevEl: '.swiper-prev-button',
502        },
503        breakpoints: {
504            0: {
505                slidesPerView: 1,
506                slidesPerGroup: 1,
507            },
508            767: {
509                slidesPerView: 2,
510                slidesPerGroup: 1,
511            },
512            1024: {
513                slidesPerView: 3,
514                slidesPerGroup: 1,
515            },
516        },
517        
518    } );
519
520}
521
522function sticky_sidebar($){
523    if(digiqole_ajax.blog_sticky_sidebar == 'yes'){               
524    // Sticky sidebar
525    $('.digiqole-content > .col-lg-4, .digiqole-content > .col-lg-8').theiaStickySidebar({
526        additionalMarginTop: 30
527      });
528    }
529}

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.