PageSourceSearch

https://verdespampas.com.br/js/main.js?9209

js verdespampas.com.br collected 2026-09-25 07:57:25 UTC 4,686 bytes, 149 lines download raw bytes

1$(function () {
2  var siteSticky = function () {
3    $(".js-sticky-header").sticky({ topSpacing: 0 });
4  };
5  siteSticky();
6
7  var siteMenuClone = function () {
8    $(".js-clone-nav").each(function () {
9      var $this = $(this);
10      $this
11        .clone()
12        .attr("class", "site-nav-wrap")
13        .appendTo(".site-mobile-menu-body");
14    });
15
16    setTimeout(function () {
17      var counter = 0;
18      $(".site-mobile-menu .has-children").each(function () {
19        var $this = $(this);
20
21        $this.prepend('<span class="arrow-collapse collapsed">');
22
23        $this.find(".arrow-collapse").attr({
24          "data-toggle": "collapse",
25          "data-target": "#collapseItem" + counter,
26        });
27
28        $this.find("> ul").attr({
29          class: "collapse",
30          id: "collapseItem" + counter,
31        });
32
33        counter++;
34      });
35    }, 1000);
36
37    $("body").on("click", ".arrow-collapse", function (e) {
38      var $this = $(this);
39      if ($this.closest("li").find(".collapse").hasClass("show")) {
40        $this.removeClass("active");
41      } else {
42        $this.addClass("active");
43      }
44      e.preventDefault();
45    });
46
47    $(window).resize(function () {
48      var $this = $(this),
49        w = $this.width();
50
51      if (w > 768) {
52        if ($("body").hasClass("offcanvas-menu")) {
53          $("body").removeClass("offcanvas-menu");
54        }
55      }
56    });
57
58    $("body").on("click", ".js-menu-toggle", function (e) {
59      var $this = $(this);
60      e.preventDefault();
61
62      if ($("body").hasClass("offcanvas-menu")) {
63        $("body").removeClass("offcanvas-menu");
64        $this.removeClass("active");
65      } else {
66        $("body").addClass("offcanvas-menu");
67        $this.addClass("active");
68      }
69    });
70
71    // click outisde offcanvas
72    $(document).mouseup(function (e) {
73      var container = $(".site-mobile-menu");
74      if (!container.is(e.target) && container.has(e.target).length === 0) {
75        if ($("body").hasClass("offcanvas-menu")) {
76          $("body").removeClass("offcanvas-menu");
77        }
78      }
79    });
80  };
81  siteMenuClone();
82});
83
84// //desktop
85// var senseSpeed = 1;
86// var previousScroll = 0;
87// $(window).scroll(function(event){
88//    var scroller = $(this).scrollTop();
89//    var player_container = document.getElementById('playerButton');
90// 		//console.log(player_container.className);
91// 		if (player_container.className === 'icon-play'){
92// 		   if (scroller-senseSpeed > previousScroll){
93// 		      $("#player-container").filter(':not(:animated)').slideDown();
94// 		   } else if (scroller+senseSpeed < previousScroll) {
95// 		      $("#player-container").filter(':not(:animated)').slideUp();
96// 		   }
97// 		 }
98//    previousScroll = scroller;
99// });
100
101// //mobile
102// var senseSpeedMobile = 1;
103// var previousScrollMobile = 0;
104// $(window).scroll(function(event){
105//    var scroller = $(this).scrollTop();
106//    var player_container = document.getElementById('playerButton');
107// 		//console.log(player_container.className);
108// 		if (player_container.className === 'icon-play'){
109// 		   if (scroller-senseSpeedMobile > previousScrollMobile){
110// 		      $("#player-mobile").filter(':not(:animated)').slideUp();
111// 		   } else if (scroller+senseSpeedMobile < previousScrollMobile) {
112// 		      $("#player-mobile").filter(':not(:animated)').slideDown();
113// 		   }
114// 		 }
115//    previousScrollMobile = scroller;
116// });
117
118/* -------------------------------------------------
119   Correção: ao usar o botão “voltar” o navegador
120   trocava apenas a URL, mantendo o DOM da notícia.
121   O bloco abaixo garante que ao voltar/avançar
122   o conteúdo seja recarregado de fato.
123--------------------------------------------------*/
124(function () {
125  // 1. Impede que o Back-Forward-Cache devolva o DOM antigo
126  window.addEventListener("pageshow", function (ev) {
127    // Chrome/Edge/Firefox sinalizam bfcache com ev.persisted = true
128    // Safari sinaliza via performance.navigation.type
129    const nav = performance.getEntriesByType("navigation")[0];
130    const cameFromBfcache =
131      ev.persisted || (nav && nav.type === "back_forward");
132    if (cameFromBfcache) location.reload();
133  });
134
135  // 2. Quando o estado do histórico mudar (← ou →),
136  //    força navegação para a URL exibida na barra
137  window.addEventListener("popstate", function () {
138    // Evita loop se já estivermos na home
139    if (location.pathname !== window.__lastPathname) {
140      window.__lastPathname = location.pathname;
141      location.href = location.pathname;
142    }
143  });
144
145  // 3. Impede que o navegador lembre o scroll da página anterior
146  if ("scrollRestoration" in history) {
147    history.scrollRestoration = "manual";
148  }
149})();

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.