2019-03-13 19:55:11 +00:00
|
|
|
/**
|
|
|
|
* Handles version information modal.
|
|
|
|
*
|
2022-06-08 01:39:59 +00:00
|
|
|
* @package
|
2019-03-13 19:55:11 +00:00
|
|
|
*/
|
|
|
|
|
2022-06-08 01:58:25 +00:00
|
|
|
// eslint-disable-next-line no-undef
|
2022-06-08 01:39:59 +00:00
|
|
|
jQuery( function ( $ ) {
|
2018-06-06 08:02:45 +00:00
|
|
|
/**
|
2018-06-06 12:28:24 +00:00
|
|
|
* Version information
|
2018-06-06 08:02:45 +00:00
|
|
|
*/
|
2022-06-08 01:39:59 +00:00
|
|
|
const wc_beta_tester_version_information = {
|
2018-06-06 08:02:45 +00:00
|
|
|
/**
|
2018-06-06 12:28:24 +00:00
|
|
|
* Initialize Version Information click
|
2018-06-06 08:02:45 +00:00
|
|
|
*/
|
2022-06-08 01:39:59 +00:00
|
|
|
init() {
|
|
|
|
$( '#wp-admin-bar-show-version-info' ).on(
|
|
|
|
'click',
|
|
|
|
this.showModal
|
|
|
|
);
|
2018-06-06 08:02:45 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
2018-06-06 12:28:24 +00:00
|
|
|
* Handler for showing/hiding version information modal
|
2022-06-08 01:39:59 +00:00
|
|
|
*
|
2022-06-08 01:58:25 +00:00
|
|
|
* @param {Event} event
|
2018-06-06 08:02:45 +00:00
|
|
|
*/
|
2022-06-08 01:39:59 +00:00
|
|
|
showModal( event ) {
|
2018-06-06 08:02:45 +00:00
|
|
|
event.preventDefault();
|
|
|
|
|
2019-03-14 15:26:54 +00:00
|
|
|
// Prevent multiple modals.
|
2022-06-08 01:39:59 +00:00
|
|
|
if (
|
|
|
|
$( '.wc-backbone-modal-beta-tester-version-info' ).length > 0
|
|
|
|
) {
|
2019-03-14 15:26:54 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-06-08 01:39:59 +00:00
|
|
|
$( this ).WCBackboneModal( {
|
2018-06-06 08:02:45 +00:00
|
|
|
template: 'wc-beta-tester-version-info',
|
|
|
|
variable: {
|
2022-06-08 01:58:25 +00:00
|
|
|
// eslint-disable-next-line no-undef
|
2018-06-06 08:02:45 +00:00
|
|
|
version: wc_beta_tester_version_info_params.version,
|
2022-06-08 01:58:25 +00:00
|
|
|
// eslint-disable-next-line no-undef
|
2018-06-06 08:02:45 +00:00
|
|
|
description: wc_beta_tester_version_info_params.description,
|
|
|
|
},
|
2022-06-08 01:39:59 +00:00
|
|
|
} );
|
|
|
|
},
|
2018-06-06 08:02:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
wc_beta_tester_version_information.init();
|
2022-06-08 01:39:59 +00:00
|
|
|
} );
|