PluginProbe
TablePress – Tables in WordPress made easy / 1.14
TablePress – Tables in WordPress made easy v1.14
3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 2.4.4 All 44 releases
tablepress / admin / js / common.js

common.js in TablePress – Tables in WordPress made easy 1.14, at admin/js/common.js

63 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * JavaScript code for all TablePress admin screens
3 *
4 * @package TablePress
5 * @subpackage Views JavaScript
6 * @author Tobias Bäthge
7 * @since 1.0.0
8 */
9
10 /* global confirm, tp, postboxes, pagenow, tp, tablepress_common */
11
12 // Ensure the global `tp` object exists.
13 window.tp = window.tp || {};
14
15 jQuery( function( $ ) {
16
17 'use strict';
18
19 /**
20 * Enable toggle/order functionality for post meta boxes
21 * For TablePress, pagenow has the form "tablepress_{$action}"
22 *
23 * @since 1.0.0
24 */
25 postboxes.add_postbox_toggles( pagenow );
26
27 /**
28 * Check that numerical fields (e.g. column/row number fields) only contain numbers
29 *
30 * Provides this functionality for browsers that don't yet support <input type="number" />.
31 *
32 * @since 1.0.0
33 */
34 $( '#tablepress-page' ).on( 'blur', '.numbers-only, .form-field-numbers-only input', function( /* event */ ) {
35 var $input = $(this);
36 $input.val( $input.val().replace( /[^0-9]/g, '' ) );
37 } );
38
39 /**
40 * Show a AYS warning when a "Delete" link is clicked
41 *
42 * @since 1.0.0
43 */
44 $( '#tablepress-page' ).on( 'click', '.delete-link', function() {
45 if ( ! confirm( tablepress_common.ays_delete_single_table ) ) {
46 return false;
47 }
48
49 // Prevent onunload warning.
50 tp.made_changes = false;
51 } );
52
53 /**
54 * Select all text in the Shortcode (readonly) text fields, when clicked
55 *
56 * @since 1.0.0
57 */
58 $( '#tablepress-page' ).on( 'click', '.table-shortcode', function() {
59 $(this).trigger( 'focus' ).trigger( 'select' );
60 } );
61
62 } );
63