33
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2025-02-10 23:48:25 +00:00

33 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-03-16 01:18:16 -04:00
/**
* Patch testing component for the Joomla! CMS
*
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2018 Open Source Matters, Inc. All rights reserved.
2016-03-16 01:18:16 -04:00
* @license GNU General Public License version 2 or later
*/
2016-03-16 01:18:16 -04:00
if (typeof Joomla === 'undefined') {
throw new Error('PatchTester JavaScript requires the Joomla core JavaScript API')
}
document.addEventListener("DOMContentLoaded", (event) => {
let submitPatch = document.querySelectorAll(".submitPatch");
let pullIdForm = document.querySelector("#pull_id");
2016-03-16 01:18:16 -04:00
/**
* EventListener which listens on submitPatch Button,
* checks if it is an apply or revert method and
* processes the patch action
*
* @param {Event} event
*/
submitPatch.forEach((element) => element.addEventListener("click", (event) => {
let currentTarget = event.currentTarget,
data = currentTarget.dataset.task.split("-"),
task = data[0];
2016-03-16 01:18:16 -04:00
pullIdForm.value = data[1];
Joomla.submitform(task);
}));
});