PageSourceSearch

https://www.jornalcruzeiro.com.br/js/scripts.js?v=40

js jornalcruzeiro.com.br collected 2026-09-24 09:01:14 UTC 8,400 bytes, 277 lines download raw bytes

1var Application = Application || {}; 
2Application.LandingPage = (function(){
3
4	var doc = $(document),
5        windowH = $(window).height(),
6        windowW = $(window).width();
7
8	function smooth(){
9
10	    if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\//,'') && location.hostname === this.hostname) {
11	      var target = $(this.hash);
12	      target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
13	      if (target.length) {
14	        $('html,body').animate({
15	          scrollTop: target.offset().top -50
16	        }, 1000);
17	        return false;
18	      }
19	    }
20	}
21
22	function owl(category){
23
24		var carousel = $('.owl-carousel.'+category);
25
26		function setOwlDotsA11y($carousel) {
27			$carousel.find('.owl-dots .owl-dot').each(function(index) {
28				var label = 'Ir para slide ' + (index + 1);
29				$(this).attr('aria-label', label);
30				$(this).attr('title', label);
31			});
32		}
33		
34		carousel.on({
35		    'initialized.owl.carousel': function () {
36		        carousel.find('.item').show();
37		        carousel.find('.loading-placeholder').hide();
38		        setOwlDotsA11y(carousel);
39		    }
40		,
41			'refreshed.owl.carousel changed.owl.carousel': function () {
42				setOwlDotsA11y(carousel);
43			}
44		}).owlCarousel({
45		    margin:30,
46		    dots: false,
47		    nav: true,
48		    navText: ["<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-chevron-left'><polyline points='15 18 9 12 15 6'></polyline></svg>","<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-chevron-right'><polyline points='9 18 15 12 9 6'></polyline></svg>"],
49		    responsive:{
50		        0:{
51		            items:1
52		        },
53		        600:{
54		            items:3
55		        },
56		        1000:{
57		            items:3
58		        }
59		    }
60		});
61	}
62
63	function subpop(category){
64		$('.sub-pop').removeClass('active');
65		$('.sub-pop.'+category).addClass('active');
66		owl(category);
67	}
68
69	function isMovingToSubmenu(event){
70		var toEl = event.relatedTarget;
71		if (!toEl) {
72			return false;
73		}
74
75		if ($(toEl).closest('.sub-pop').length > 0) {
76			return true;
77		}
78
79		var navRect = $('.nav-cruzeiro')[0] ? $('.nav-cruzeiro')[0].getBoundingClientRect() : null;
80		var subActive = $('.sub-pop.active')[0];
81		if (!navRect || !subActive) {
82			return false;
83		}
84
85		var subRect = subActive.getBoundingClientRect();
86		var x = event.clientX;
87		var y = event.clientY;
88
89		var inHorizontalTolerance = x >= (subRect.left - 40) && x <= (subRect.right + 40);
90		var inVerticalGap = y >= (navRect.bottom - 5) && y <= (subRect.top + 35);
91
92		return inHorizontalTolerance && inVerticalGap;
93	}
94
95
96function bindElements(){
97
98	   function setOwlDotsA11y($carousel) {
99			$carousel.find('.owl-dots .owl-dot').each(function(index) {
100				var label = 'Ir para slide ' + (index + 1);
101				$(this).attr('aria-label', label);
102				$(this).attr('title', label);
103			});
104	   }
105
106	   $(window).scroll(function () {
107            scroll = $(this).scrollTop();
108
109            if (scroll > windowH){  
110                $('.header').addClass("fixed");
111            } else {
112                $('.header').removeClass("fixed");
113            }
114
115        });
116
117
118	   $('.goto').on('click', smooth);
119
120	   $('.show-nav').on('click', function(){
121	   		scrolly = $(document).scrollTop();
122	   		$('.aside-nav').toggleClass('active').css('height',$(document).height());
123	   });
124
125	   $('.hide-nav').on('click', function(){
126	   		$('.aside-nav').removeClass('active');
127	   });
128
129	   $('#search-field-nav').focus(function(){
130	   		$(this).parent().toggleClass('active');
131	   }).blur(function(){
132	   		$(this).parent().toggleClass('active');
133	   });
134
135	   document.getElementById('search-mobile').addEventListener('submit', function (event) {
136			event.preventDefault();
137			event.stopPropagation();
138			window.location = '/busca?q=' + encodeURI(document.getElementById('search-field-nav').value);
139		});
140
141	   $('.btn-search-submit').on('click', function(){
142		window.location = '/busca?q=' + encodeURI(document.getElementById('searchFieldInput').value);
143	   });
144
145	   document.getElementById('search-desktop').addEventListener('submit', function (event) {
146			event.preventDefault();
147			event.stopPropagation();
148			window.location = '/busca?q=' + encodeURI(document.getElementById('searchFieldInput').value);
149		});
150
151		document.getElementById('searchFieldButton').addEventListener('click', function (event) {
152			event.preventDefault();
153			event.stopPropagation();
154			window.location = '/busca?q=' + encodeURI(document.getElementById('searchFieldInput').value);
155		});
156
157	   feather.replace();
158
159
160	   $('.search-button a').on('click', function(){
161	   	$('.overlay').fadeIn();
162	   	$('#search-main').css('display','block');
163	   	$('#searchFieldInput').focus();
164	   });
165
166	   $('.search-close').on('click', function (){
167	   	$('.overlay').fadeOut('fast');
168	   	$('#search-main').css('display','none');
169	   });
170
171	   $('.has-sub').on('mouseenter', function(){
172
173	   	$('.has-sub').remove('active');
174	   	$(this).addClass('active');
175	   	$(this).siblings().removeClass('active');
176
177	   	var category = $(this).data('section');
178	   	subpop(category);
179
180	   });
181
182	   $('.nav-cruzeiro').on('mouseleave', function(e){
183		if (!isMovingToSubmenu(e)) {
184			$('.has-sub').removeClass('active');
185			$('.sub-pop').removeClass('active');
186		}
187	   });
188
189	   $('.sub-pop').on('mouseleave', function(){
190	   	$(this).removeClass('active');
191	   	$('.has-sub').removeClass('active');
192	   });
193
194	   $('.owl-stories').owlCarousel({
195		    margin:15,
196		    dots: true,
197		    navText: ["<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-chevron-left'><polyline points='15 18 9 12 15 6'></polyline></svg>","<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-chevron-right'><polyline points='9 18 15 12 9 6'></polyline></svg>"],
198		    responsive:{
199		        0:{
200		            items:2
201		        },
202		        600:{
203		            items:4
204		        },
205		        1000:{
206		            items:6
207		        }
208		    }
209		});
210
211	   setOwlDotsA11y($('.owl-stories'));
212	   $('.owl-stories').on('refreshed.owl.carousel changed.owl.carousel initialized.owl.carousel', function(){
213			setOwlDotsA11y($(this));
214	   });
215
216		$('.owl-breaking').owlCarousel({
217		    margin:0,
218		    dots: false,
219		    navText: ["<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-chevron-left'><polyline points='15 18 9 12 15 6'></polyline></svg>","<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-chevron-right'><polyline points='9 18 15 12 9 6'></polyline></svg>"],
220		    responsive:{
221		        0:{
222		            items:2
223		        },
224		        600:{
225		            items:4
226		        },
227		        1000:{
228		            items:6
229		        }
230		    }
231		});
232
233	   setOwlDotsA11y($('.owl-breaking'));
234	   $('.owl-breaking').on('refreshed.owl.carousel changed.owl.carousel initialized.owl.carousel', function(){
235			setOwlDotsA11y($(this));
236	   });
237
238
239	   $('.gallery-thumbs').owlCarousel({
240		    margin:15,
241		    dots: true,
242		    responsive:{
243		        0:{
244		            items:4
245		        },
246		        600:{
247		            items:6
248		        },
249		        1000:{
250		            items:8
251		        }
252		    }
253		});
254
255	   setOwlDotsA11y($('.gallery-thumbs'));
256	   $('.gallery-thumbs').on('refreshed.owl.carousel changed.owl.carousel initialized.owl.carousel', function(){
257			setOwlDotsA11y($(this));
258	   });
259
260	   $('.gallery-thumbs a').jqPhotoSwipe({
261			forceSingleGallery: true
262		});
263
264	   $('.gallery-banner').on('click', function(e){
265	   	e.preventDefault();
266	   	$('.gallery-start').trigger('click');
267	   });
268	
269}
270
271	doc.ready(function(){
272
273		bindElements();
274		
275	});
276
277})();

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.