| 1 |
(function( $ ) { |
| 2 |
'use strict'; |
| 3 |
|
| 4 |
var tables = $( '#wp-tables' ); |
| 5 |
|
| 6 |
tables.bsmSelect({ |
| 7 |
animate: true, |
| 8 |
title: dbReset.selectTable, |
| 9 |
plugins: [$.bsmSelect.plugins.compatibility()] |
| 10 |
}); |
| 11 |
|
| 12 |
$( '#select-all' ).on('click', function(e) { |
| 13 |
e.preventDefault(); |
| 14 |
|
| 15 |
tables.children() |
| 16 |
.attr( 'selected', 'selected' ) |
| 17 |
.end() |
| 18 |
.change(); |
| 19 |
}); |
| 20 |
|
| 21 |
tables.on( 'change', function() { |
| 22 |
$( '#reactivate' ).showIfSelected( 'options' ); |
| 23 |
$( '#disclaimer' ).showIfSelected( 'users' ); |
| 24 |
}); |
| 25 |
|
| 26 |
$( '#db-reset-code-confirm' ).on( 'change keyup paste', function() { |
| 27 |
$( '#db-reset-submit' ).prop( 'disabled', $( this ).val() !== $( "#security-code" ).text() ); |
| 28 |
}); |
| 29 |
|
| 30 |
$( '#db-reset-submit' ).on('click', function(e) { |
| 31 |
e.preventDefault(); |
| 32 |
|
| 33 |
if ( confirm( dbReset.confirmAlert ) ) { |
| 34 |
$( '#db-reset-form' ).submit(); |
| 35 |
$( '#loader' ).show(); |
| 36 |
} |
| 37 |
}); |
| 38 |
|
| 39 |
$.fn.showIfSelected = function( selectValue ) { |
| 40 |
$( this ).toggle( $( "option[value='" + selectValue + "']:selected", tables ).length > 0 ); |
| 41 |
} |
| 42 |
|
| 43 |
})( jQuery ); |
| 44 |
|