2016-03-16 05:18:16 +00:00
/ * *
* Patch testing component for the Joomla ! CMS
*
2023-10-10 09:50:26 +00: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 05:18:16 +00:00
* /
2015-12-05 18:08:38 +00:00
2016-03-16 05:18:16 +00:00
if ( typeof Joomla === 'undefined' ) {
throw new Error ( 'PatchTester JavaScript requires the Joomla core JavaScript API' )
}
2015-12-05 18:08:38 +00:00
2023-10-06 21:12:23 +00: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 09:50:26 +00:00
document . querySelectorAll ( ".submitPatch" ) . forEach ( ( element ) => element . addEventListener ( "click" , ( event ) => {
2023-10-10 10:00:31 +00:00
const element = document . getElementById ( 'pull_id' ) ;
const target = event . currentTarget ;
2023-10-10 09:50:26 +00:00
2023-10-10 10:00:31 +00:00
if ( element ) {
element . value = parseInt ( target . dataset . id ) ;
2023-10-10 09:50:26 +00:00
}
2020-03-21 10:26:42 +00:00
2023-10-10 10:00:31 +00:00
Joomla . submitform ( ` ${ target . dataset . task } . ${ target . dataset . task } ` ) ;
2023-10-10 09:50:26 +00:00
} ) ) ;