PageSourceSearch

https://jornaldaqui.com.br/content-wp/themes/mts_schema/js/customscript.js

js jornaldaqui.com.br collected 2026-10-02 13:30:44 UTC 8,704 bytes, 229 lines download raw bytes

1jQuery.fn.exists = function(callback) {
2  var args = [].slice.call(arguments, 1);
3  if (this.length) {
4    callback.call(this, args);
5  }
6  return this;
7};
8
9/*----------------------------------------------------
10/* Show/hide Scroll to top
11/*--------------------------------------------------*/
12jQuery(document).ready(function($) {
13	//move-to-top arrow
14	jQuery("body").prepend("<a id='move-to-top' class='animate ' href='#blog'><i class='fa fa-angle-double-up'></i></a>");
15
16	var scrollDes = 'html,body';
17	/*Opera does a strange thing if we use 'html' and 'body' together so my solution is to do the UA sniffing thing*/
18	if(navigator.userAgent.match(/opera/i)){
19		scrollDes = 'html';
20	}
21	//show ,hide
22	jQuery(window).scroll(function () {
23		if (jQuery(this).scrollTop() > 160) {
24			jQuery('#move-to-top').addClass('filling').removeClass('hiding');
25		} else {
26			jQuery('#move-to-top').removeClass('filling').addClass('hiding');
27		}
28	});
29});
30
31
32/*----------------------------------------------------
33/* Make all anchor links smooth scrolling
34/*--------------------------------------------------*/
35jQuery(document).ready(function($) {
36 // scroll handler
37  var scrollToAnchor = function( id, event ) {
38    // grab the element to scroll to based on the name
39    var elem = $("a[name='"+ id +"']");
40    // if that didn't work, look for an element with our ID
41    if ( typeof( elem.offset() ) === "undefined" ) {
42      elem = $("#"+id);
43    }
44    // if the destination element exists
45    if ( typeof( elem.offset() ) !== "undefined" ) {
46      // cancel default event propagation
47      event.preventDefault();
48
49      // do the scroll
50      // also hide mobile menu
51      var scroll_to = elem.offset().top;
52      $('html, body').removeClass('mobile-menu-active').animate({
53              scrollTop: scroll_to
54      }, 600, 'swing', function() { if (scroll_to > 46) window.location.hash = id; } );
55    }
56  };
57  // bind to click event
58  $("a").click(function( event ) {
59    // only do this if it's an anchor link
60    var href = $(this).attr("href");
61    if ( href && href.match("#") && href !== '#' ) {
62      // scroll to the location
63      var parts = href.split('#'),
64        url = parts[0],
65        target = parts[1];
66      if ((!url || url == window.location.href.split('#')[0]) && target)
67        scrollToAnchor( target, event );
68    }
69  });
70});
71
72
73/*----------------------------------------------------
74/* Responsive Navigation
75/*--------------------------------------------------*/
76if (mts_customscript.responsive && mts_customscript.nav_menu != 'none') {
77    jQuery(document).ready(function($){
78        $('#secondary-navigation').append('<div id="mobile-menu-overlay" />');
79        // merge if two menus exist
80        if (mts_customscript.nav_menu == 'both' && !$('.navigation.mobile-only').length) {
81            $('.navigation').not('.mobile-menu-wrapper').find('.menu').clone().appendTo('.mobile-menu-wrapper').hide();
82        }
83        $('nav').find('.header-social-icons').clone().appendTo('.mobile-menu-wrapper').hide();
84        $('nav').find('.mts-cart').clone().appendTo('.mobile-menu-wrapper').hide();
85
86        $('.toggle-mobile-menu').click(function(e) {
87            e.preventDefault();
88            e.stopPropagation();
89            $('body').toggleClass('mobile-menu-active');
90
91            if ( $('body').hasClass('mobile-menu-active') ) {
92                if ( $(document).height() > $(window).height() ) {
93                    var scrollTop = ( $('html').scrollTop() ) ? $('html').scrollTop() : $('body').scrollTop();
94                    $('html').addClass('noscroll').css( 'top', -scrollTop );
95                }
96                $('#mobile-menu-overlay').fadeIn();
97            } else {
98                var scrollTop = parseInt( $('html').css('top') );
99                $('html').removeClass('noscroll');
100                $('html,body').scrollTop( -scrollTop );
101                $('#mobile-menu-overlay').fadeOut();
102            }
103        });
104    }).on('click', function(event) {
105
106        var $target = jQuery(event.target);
107        if ( ( $target.hasClass("fa") && $target.parent().hasClass("toggle-caret") ) ||  $target.hasClass("toggle-caret") ) {// allow clicking on menu toggles
108            return;
109        }
110        jQuery('body').removeClass('mobile-menu-active');
111        jQuery('html').removeClass('noscroll');
112        jQuery('#mobile-menu-overlay').fadeOut();
113    });
114}
115
116/*----------------------------------------------------
117/*  Dropdown menu
118/* ------------------------------------------------- */
119jQuery(document).ready(function($) {
120    var $pullToggle = $('#pull');
121    function mtsDropdownMenu() {
122        if(!$pullToggle.is(':visible')) {
123            $('.navigation ul.sub-menu, .navigation ul.children').hide();
124            var timer;
125            var delay = 100;
126            $('.navigation li').hover(
127              function() {
128                var $this = $(this);
129                timer = setTimeout(function() {
130                    $this.children('ul.sub-menu, ul.children').slideDown('fast');
131                }, delay);
132
133              },
134              function() {
135                $(this).children('ul.sub-menu, ul.children').hide();
136                clearTimeout(timer);
137              }
138            );
139        } else {
140            $('.navigation li').unbind('hover');
141            $('.navigation li.active > ul.sub-menu, .navigation li.active > ul.children').show();
142        }
143    }
144
145    mtsDropdownMenu();
146
147    $(window).resize(function() {
148        mtsDropdownMenu();
149    });
150});
151
152/*---------------------------------------------------
153/*  Vertical menus toggles
154/* -------------------------------------------------*/
155jQuery(document).ready(function($) {
156
157    $('.widget_nav_menu, .navigation .menu').addClass('toggle-menu');
158    $('.toggle-menu ul.sub-menu, .toggle-menu ul.children').addClass('toggle-submenu');
159    $('.toggle-menu ul.sub-menu').parent().addClass('toggle-menu-item-parent');
160
161    $('.toggle-menu .toggle-menu-item-parent').append('<span class="toggle-caret"><i class="fa fa-plus"></i></span>');
162
163    $('.toggle-caret').click(function(e) {
164        e.preventDefault();
165        $(this).parent().toggleClass('active').children('.toggle-submenu').slideToggle('fast');
166    });
167});
168
169/*----------------------------------------------------
170/* Social button scripts
171/*---------------------------------------------------*/
172jQuery(document).ready(function($){
173	(function(d, s) {
174	  var js, fjs = d.getElementsByTagName(s)[0], load = function(url, id) {
175		if (d.getElementById(id)) {return;}
176		js = d.createElement(s); js.src = url; js.id = id;
177		fjs.parentNode.insertBefore(js, fjs);
178	  };
179	jQuery('span.facebookbtn, span.facebooksharebtn, .facebook_like').exists(function() {
180      load('//connect.facebook.net/en_US/all.js#xfbml=1&version=v2.8', 'fbjssdk');
181    });
182	jQuery('span.gplusbtn').exists(function() {
183	  load('https://apis.google.com/js/plusone.js', 'gplus1js');
184	});
185	jQuery('span.twitterbtn').exists(function() {
186	  load('//platform.twitter.com/widgets.js', 'tweetjs');
187	});
188	jQuery('span.linkedinbtn').exists(function() {
189	  load('//platform.linkedin.com/in.js', 'linkedinjs');
190	});
191	jQuery('span.pinbtn').exists(function() {
192	  load('//assets.pinterest.com/js/pinit.js', 'pinterestjs');
193	});
194	jQuery('span.stumblebtn').exists(function() {
195	  load('//platform.stumbleupon.com/1/widgets.js', 'stumbleuponjs');
196	});
197	}(document, 'script'));
198});
199
200/*----------------------------------------------------
201/* Lazy load avatars
202/*---------------------------------------------------*/
203jQuery(document).ready(function($){
204    var lazyloadAvatar = function(){
205        $('.comment-author .avatar').each(function(){
206            var distanceToTop = $(this).offset().top;
207            var scroll = $(window).scrollTop();
208            var windowHeight = $(window).height();
209            var isVisible = distanceToTop - scroll < windowHeight;
210            if( isVisible ){
211                var hashedUrl = $(this).attr('data-src');
212                if ( hashedUrl ) {
213                    $(this).attr('src',hashedUrl).removeClass('loading');
214                }
215            }
216        });
217    };
218    if ( $('.comment-author .avatar').length > 0 ) {
219        $('.comment-author .avatar').each(function(i,el){
220            $(el).attr('data-src', el.src).removeAttr('src').addClass('loading');
221        });
222        $(function(){
223            $(window).scroll(function(){
224                lazyloadAvatar();
225            });
226        });
227        lazyloadAvatar();
228    }
229});

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.