PageSourceSearch

https://impa.br/wp-content/themes/impa-2024/snippets/time_line/scripts.js?v=1790846399

js impa.br collected 2026-10-01 09:22:49 UTC 3,098 bytes, 112 lines download raw bytes

1(function ($) {
2	let modalSwiperTL; // instância do Swiper do modal
3
4	$("[show_modal_timeLine_ajax] .timeline__item-btn").on("click", function () {
5		const idModalTimeLine = $(this).attr("data_id_time_line");
6		const data_post_id = $(this).attr("data_post_id");
7
8		console.log("Abrindo modal timeline:", idModalTimeLine, data_post_id);
9
10		load_modal_timeLine({ idModalTimeLine, data_post_id });
11	});
12
13	function load_modal_timeLine(itemArgs) {
14		const requestData = {
15			action: "load_modal_timeLine",
16			args: itemArgs,
17		};
18
19		$.ajax({
20			type: "POST",
21			url: ajax_object.ajax_url,
22			data: requestData,
23			dataType: "json",
24			success: function (response) {
25				try {
26					const data = response.data.post_content;
27					console.log("Dados carregados:", data);
28
29					// Preencher dados no modal
30					$("[data-ano]").html(data.ano || "");
31					$("[data-legenda]").html(data.legenda || "");
32					$("[data-editor]").html(data.popup?.texto || "");
33
34					// Carregar imagens no Swiper do modal
35					const fotos = data.popup?.imagens || [];
36					const $swiperWrapper = $("#modal-timeline .swiper-wrapper");
37					$swiperWrapper.empty();
38
39					fotos.forEach((imagem) => {
40						$swiperWrapper.append(`
41							<div class="swiper-slide">
42								<img src="${imagem.url}" alt="${imagem.alt || "Imagem"}">
43								${imagem.caption ? `<p>${imagem.caption}</p>` : ""}
44								${imagem.description ? `<p>${imagem.description}</p>` : ""}
45							</div>
46						`);
47					});
48
49					// Abrir modal com Fancybox
50					Fancybox.show(
51						[
52							{
53								src: "#modal-timeline",
54								type: "inline",
55							},
56						],
57						{
58							mainClass: "modal-timeline",
59
60							on: {
61								done: () => {
62									// Destruir swiper antigo se existir
63									if (modalSwiperTL) {
64										modalSwiperTL.destroy(true, true);
65									}
66
67									// Inicializar Swiper do modal
68									modalSwiperTL = new Swiper("#modal-timeline .swiper", {
69										navigation: {
70											nextEl: "#modal-timeline .swiper-button-timeline-next",
71											prevEl: "#modal-timeline .swiper-button-timeline-prev",
72										},
73										pagination: {
74											el: "#modal-timeline .swiper-pagination-timeline",
75											clickable: true,
76										},
77									});
78
79									modalSwiperTL.slideTo(0);
80								},
81
82								close: () => {
83									// Resetar conteúdo
84									$("[data-ano]").html("");
85									$("[data-legenda]").html("");
86									$("[data-editor]").html("");
87									$("#modal-timeline .swiper-wrapper").empty();
88
89									// Destruir swiper do modal
90									if (modalSwiperTL) {
91										modalSwiperTL.destroy(true, true);
92										modalSwiperTL = null;
93									}
94								},
95							},
96						}
97					);
98				} catch (error) {
99					console.error("Erro ao processar resposta:", error);
100				}
101			},
102			error: function (jqXHR, textStatus, errorThrown) {
103				console.error(
104					"Erro na requisição AJAX:",
105					jqXHR.responseText,
106					textStatus,
107					errorThrown
108				);
109			},
110		});
111	}
112})(jQuery);

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.