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
* /
2015-12-05 13:08:38 -05:00
2016-03-16 01:18:16 -04:00
if ( typeof Joomla === 'undefined' ) {
throw new Error ( 'PatchTester JavaScript requires the Joomla core JavaScript API' )
}
2015-12-05 13:08:38 -05:00
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 ) ;
}
2020-03-21 11:26:42 +01:00
2023-10-10 12:50:26 +03:00
Joomla . submitform ( ` ${ event . currentTarget . dataset . task } . ${ currentTarget . dataset . task } ` ) ;
} ) ) ;