| 1 |
/** |
| 2 |
* Adminimize script to select all checkbox for each rows. |
| 3 |
* Only load and usage on settings page. |
| 4 |
* |
| 5 |
* @version 2015-12-20 |
| 6 |
*/ |
| 7 |
jQuery( document ).ready( function( $ ) { |
| 8 |
'use strict'; |
| 9 |
|
| 10 |
$( 'thead input:checkbox' ).change( function() { |
| 11 |
|
| 12 |
var className = this.className, |
| 13 |
input = 'input:checkbox.' + className; |
| 14 |
|
| 15 |
$( input ).prop( |
| 16 |
'checked', $( this ).prop( 'checked' ) |
| 17 |
); |
| 18 |
} ); |
| 19 |
|
| 20 |
$( '.postbox h3' ).on( 'click', function( e ) { |
| 21 |
$( this ).closest( '.postbox' ).toggleClass( 'closed' ); |
| 22 |
e.preventDefault(); |
| 23 |
} ); |
| 24 |
|
| 25 |
// Close every box other than the first, to keep the page clean. |
| 26 |
$('.postbox:not(:first)').addClass('closed'); |
| 27 |
|
| 28 |
// Open the box when the user clicks the shortcut |
| 29 |
$('#minimenu a').on('click',function(e){ |
| 30 |
var ID = $(this).attr('href'); |
| 31 |
$(ID).closest( '.postbox' ).removeClass('closed'); |
| 32 |
}); |
| 33 |
|
| 34 |
// Scroll to top |
| 35 |
$('.adminimize-scroltop').on('click',function(e){ |
| 36 |
e.preventDefault(); |
| 37 |
$('html,body').animate({scrollTop:0},700); |
| 38 |
}); |
| 39 |
|
| 40 |
// Adminimize export switch |
| 41 |
$('#adminimize-toggle').on('click', function(e){ |
| 42 |
var value = $(this).attr('checked'); |
| 43 |
if ( value == 'checked'){ |
| 44 |
$('#adminimize-export-role').css('display', 'none'); |
| 45 |
$('#adminimize-export').css('display', 'block'); |
| 46 |
} else { |
| 47 |
$('#adminimize-export-role').css('display', 'flex'); |
| 48 |
$('#adminimize-export').css('display', 'none'); |
| 49 |
} |
| 50 |
}); |
| 51 |
|
| 52 |
$('#mw_adminimize_export_select_roles').select2({ |
| 53 |
width: '100%' |
| 54 |
}); |
| 55 |
|
| 56 |
} ); |