33
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2025-01-24 07:38:26 +00:00

34 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-03-16 01:18:16 -04:00
/**
* Patch testing component for the Joomla! CMS
*
2023-10-10 12:50:26 +03:00
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
2016-03-16 01:18:16 -04:00
*/
2016-03-16 01:18:16 -04:00
if (typeof Joomla === 'undefined') {
throw new Error('PatchTester JavaScript requires the Joomla core JavaScript API')
}
2023-10-07 00:12:23 +03:00
Joomla.submitbutton = (task) => {
if (task !== 'reset' || confirm(Joomla.JText._('COM_PATCHTESTER_CONFIRM_RESET', 'Resetting will attempt to revert all applied patches and removes all backed up files. This may result in a corrupted environment. Are you sure you want to continue?'))) {
Joomla.submitform(task);
}
};
/**
* EventListener which listens on submitPatch Button,
* checks if it is an apply or revert method and
* processes the patch action
*
* @param {Event} event
*/
2023-10-10 12:50:26 +03:00
document.querySelectorAll(".submitPatch").forEach((element) => element.addEventListener("click", (event) => {
const value = document.getElementById('pull_id')?.value;
if (value) {
value = parseInt(event.currentTarget.dataset.id);
}
2023-10-10 12:50:26 +03:00
Joomla.submitform(`${event.currentTarget.dataset.task}.${currentTarget.dataset.task}`);
}));