| 1 |
/** |
| 2 |
* JavaScript code for the "Options" screen, without the CodeMirror handling |
| 3 |
* |
| 4 |
* @package TablePress |
| 5 |
* @subpackage Views JavaScript |
| 6 |
* @author Tobias Bäthge |
| 7 |
* @since 1.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
/* global confirm, tablepress_strings */ |
| 11 |
|
| 12 |
jQuery( function( $ ) { |
| 13 |
|
| 14 |
'use strict'; |
| 15 |
|
| 16 |
/** |
| 17 |
* Enable/disable the regular textarea according to state of "Load Custom CSS" checkbox. |
| 18 |
* |
| 19 |
* @since 1.0.0 |
| 20 |
*/ |
| 21 |
$( '#option-use-custom-css' ).on( 'change', function() { |
| 22 |
$( '#option-custom-css' ).prop( 'disabled', ! $(this).prop( 'checked' ) ); |
| 23 |
} ).trigger( 'change' ); |
| 24 |
|
| 25 |
/** |
| 26 |
* On form submit: Enable disabled fields, so that they are transmitted in the POST request. |
| 27 |
* |
| 28 |
* @since 1.0.0 |
| 29 |
*/ |
| 30 |
$( '#tablepress-page' ).on( 'submit', 'form', function() { |
| 31 |
$(this).find( 'input, select, textarea' ).prop( 'disabled', false ); |
| 32 |
} ); |
| 33 |
|
| 34 |
/** |
| 35 |
* Require double confirmation when wanting to uninstall TablePress. |
| 36 |
* |
| 37 |
* @since 1.0.0 |
| 38 |
*/ |
| 39 |
$( '#uninstall-tablepress' ).on( 'click', function() { |
| 40 |
if ( confirm( tablepress_strings.uninstall_warning_1 ) ) { |
| 41 |
return confirm( tablepress_strings.uninstall_warning_2 ); |
| 42 |
} |
| 43 |
|
| 44 |
return false; |
| 45 |
} ); |
| 46 |
|
| 47 |
} ); |
| 48 |
|