PageSourceSearch

https://basquetgirona.com/wp-content/themes/basquetgirona/assets/js/pages/entrades.js?ver=7.1.2

js basquetgirona.com collected 2026-09-24 22:56:39 UTC 4,020 bytes, 121 lines download raw bytes

1// Timer Proxim partit
2window.addEventListener("load", () => {
3  var fechaYHora = EntradesParam.timer;
4  fechaYHora = fechaYHora.replace(/%/g, "");
5
6  var [fecha, hora] = fechaYHora.split(" ");
7  var timer = fecha + "T" + hora;
8
9  var countDownDate = Date.parse(timer);
10
11  // Check if the date is valid
12  if (isNaN(countDownDate)) {
13    console.error("Fecha no válida");
14    return;
15  }
16
17  var x = setInterval(function () {
18    var now = new Date().getTime();
19    var distance = countDownDate - now;
20
21    var days = Math.floor(distance / (1000 * 60 * 60 * 24));
22    var hours = Math.floor(
23      (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)
24    );
25    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
26    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
27
28    // Output the result in an element with id="timer"
29    const timerEl = document.querySelectorAll(".timer");
30    timerEl.forEach((el) => {
31      el.querySelector(".days").innerHTML = (days < 10 ? "0" : "") + days;
32      el.querySelector(".hours").innerHTML = (hours < 10 ? "0" : "") + hours;
33      el.querySelector(".minutes").innerHTML =
34        (minutes < 10 ? "0" : "") + minutes;
35      el.querySelector(".seconds").innerHTML =
36        (seconds < 10 ? "0" : "") + seconds;
37    });
38  }, 10);
39});
40
41document.addEventListener("DOMContentLoaded", function () {
42  const filters = document.querySelectorAll("ul li a[data-filter]");
43  const partits = document.querySelectorAll(".entrades-lst ul li");
44
45  // Funció per aplicar el filtre
46  function aplicarFiltre(filterValue) {
47    filters.forEach((f) => f.classList.remove("active"));
48    const activeFilter = document.querySelector(
49      `ul li a[data-filter="${filterValue}"]`
50    );
51    if (activeFilter) activeFilter.classList.add("active");
52
53    partits.forEach((partit) => {
54      if (filterValue === "tots") {
55        partit.style.display = "block";
56      } else {
57        if (partit.classList.contains(filterValue)) {
58          partit.style.display = "block";
59        } else {
60          partit.style.display = "none";
61        }
62      }
63    });
64  }
65
66  // Event click
67  filters.forEach((filter) => {
68    filter.addEventListener("click", function (e) {
69      e.preventDefault();
70      const filterValue = this.getAttribute("data-filter");
71      aplicarFiltre(filterValue);
72    });
73  });
74
75  const urlParams = new URLSearchParams(window.location.search);
76  const lliga = urlParams.get("lliga");
77  if (lliga) {
78    aplicarFiltre(lliga);
79  }
80});
81
82// Popup avis entrades
83document.addEventListener("DOMContentLoaded", function () {
84  const enllaços = document.querySelectorAll(".obrir-popup");
85  const popup = document.getElementById("popup-avisa");
86  const titol = document.getElementById("popup-titol");
87  const tancar = document.querySelector(".popup-avisa .tancar");
88  const img = document.getElementById("popup-img");
89
90  enllaços.forEach((enllaç) => {
91    enllaç.addEventListener("click", function () {
92      const local = this.getAttribute("data-local");
93      const visitant = this.getAttribute("data-visitant");
94      const imgSrc = this.getAttribute("data-img");
95      const jornada = this.getAttribute("data-jornada");
96
97      titol.innerHTML =
98        "ENTRADES <br> <strong>" + local + " - " + visitant + "</strong>";
99      if (img && imgSrc) img.src = imgSrc;
100
101      // Omplir els hidden del CF7
102      const inputEquips = popup.querySelector('input[name="equips"]');
103      const inputJornada = popup.querySelector('input[name="jornada"]');
104
105      if (inputEquips) inputEquips.value = local + " - " + visitant;
106      if (inputJornada) inputJornada.value = jornada;
107
108      popup.style.display = "flex";
109    });
110  });
111
112  tancar.addEventListener("click", function () {
113    popup.style.display = "none";
114  });
115
116  window.addEventListener("click", function (e) {
117    if (e.target === popup) {
118      popup.style.display = "none";
119    }
120  });
121});

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.