PageSourceSearch

https://fra.ro/media/mod_icagenda_calendar/js/icagenda-calendar.js?1.1.0

js fra.ro collected 2026-10-02 06:54:45 UTC 4,252 bytes, 115 lines download raw bytes

1/**
2 * iCagenda v4.0.12 2026-08-14 (https://www.joomlic.com)
3 * @copyright  (C) 2012-2026 Cyril Reze / JoomliC. All rights reserved.
4 * @license    GNU General Public License version 3 or later; see LICENSE.txt
5 */
6
7window.JoomliC = window.JoomliC || {};
8
9(function(JoomliC, document) {
10	"use strict";
11
12	JoomliC.updateCalendar = (moduleid) => {
13		const calendar  = document.querySelector('[data-modid="'+ moduleid +'"]');
14		let monthSelect = document.querySelector('[data-month-id="'+ moduleid +'"]'),
15			yearInput   = document.querySelector('[data-year-id="'+ moduleid +'"]');
16
17		let modid  = moduleid ? moduleid : calendar.dataset.modid,
18			month  = monthSelect.value,
19			year   = yearInput.value;
20
21		JoomliC.changeMonth(modid, year, month);
22	};
23
24	JoomliC.changeMonth = (modid, year, month) => {
25		const paths = Joomla.getOptions('system.paths');
26		Joomla.request({
27			url: `${paths ? `${paths.root}/index.php` : window.location.pathname}?option=com_ajax&module=icagenda_calendar&method=calendar&format=raw&modid=${modid}&year=${year}&month=${month}`,
28			method: 'GET',
29			perform: true,
30			onSuccess(data) {
31				if (data.length !== 0) {
32					const calendar = document.querySelector('[data-modid="'+ modid +'"]');
33					calendar.innerHTML = data;
34				}
35			},
36			onError(xhr) {
37				Joomla.renderMessages(Joomla.ajaxErrorsMessages(xhr));
38				const response = JSON.parse(xhr.response);
39				Joomla.renderMessages({ 'error': [response.message] }, undefined, true);
40			}
41		});
42		return false;
43	};
44
45	JoomliC.loadEvents = (modid, date) => {
46		const paths = Joomla.getOptions('system.paths');
47		Joomla.request({
48			url: `${paths ? `${paths.root}/index.php` : window.location.pathname}?option=com_ajax&module=icagenda_calendar&method=events&format=raw&modid=${modid}&date=${date}`,
49			method: 'GET',
50			perform: true,
51			onSuccess(data) {
52				if (data.length !== 0) {
53					let icDialog = document.querySelector('[data-dialog-id="'+ modid +'"]');
54//					@TODO: Modal for events with options - open
55//					icDialog.showModal();
56					icDialog.show();
57
58					const allowedHtml = {
59						time: ['class'],
60						button: ['class', 'style', 'onclick'],
61						div: ['class', 'style'],
62						dialog: ['style'],
63						img: ['src', 'srcset', 'alt', 'title', 'width', 'height', 'class', 'style'],
64						span: ['style', 'hidden']
65					};
66					icDialog.innerHTML = Joomla.sanitizeHtml(data, allowedHtml);
67					let calendarBlock = document.querySelector('.ic-calendar-container');
68
69					let style = calendarBlock.currentStyle || window.getComputedStyle(calendarBlock),
70//						width    = calendarBlock.offsetWidth, // or use style.width
71//						marginX  = parseFloat(style.marginLeft) + parseFloat(style.marginRight),
72//						paddingX = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight),
73//						borderX  = parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth),
74						height   = calendarBlock.offsetHeight, // or use style.height
75						marginY  = parseFloat(style.marginTop) + parseFloat(style.marginBottom),
76						paddingY = parseFloat(style.paddingTop) + parseFloat(style.paddingBottom),
77						borderY  = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
78
79					let dialogHeight = (height + marginY - paddingY + borderY + 3);
80
81					icDialog.style.height = dialogHeight+"px";
82//					icDialog.style.width = dialogWidth+"px";
83					const closeButton = document.querySelector('#dialog-close');
84
85					closeButton.addEventListener("click", () => {
86//						icDialog.style.display = 'none';
87						icDialog.innerHTML = '';
88						icDialog.close();
89					});
90					document.addEventListener('keyup', function (event) {
91						if (event.key === "Escape") {
92							icDialog.close();
93						}
94					});
95
96					// Click outside the dialog close it.
97					window.addEventListener('click', function(e) {
98						var element = document.querySelector('.ic-calendar-container');
99
100						if (e.target !== element && !element.contains(e.target)) {
101							icDialog.close();
102						}
103					});
104				}
105			},
106			onError(xhr) {
107				Joomla.renderMessages(Joomla.ajaxErrorsMessages(xhr));
108				const response = JSON.parse(xhr.response);
109				Joomla.renderMessages({ 'error': [response.message] }, undefined, true);
110			}
111		});
112		return false;
113	};
114
115}(JoomliC, document));

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.