| 1 |
( function ( $ ) { |
| 2 |
/////////////////////////////////////// |
| 3 |
// INIT |
| 4 |
/////////////////////////////////////// |
| 5 |
|
| 6 |
$( document ).ready( function () { |
| 7 |
initEvents(); |
| 8 |
configFixedElements(); |
| 9 |
} ); |
| 10 |
|
| 11 |
/////////////////////////////////////// |
| 12 |
// FUNCTIONS |
| 13 |
/////////////////////////////////////// |
| 14 |
|
| 15 |
function configFixedElements() { |
| 16 |
var jpTopFrame = $( '.frame.top' ), |
| 17 |
jpBottomFrame = $( '.frame.bottom' ), |
| 18 |
$body = $( 'body' ); |
| 19 |
|
| 20 |
$body.scroll( function () { |
| 21 |
if ( 33 > jpTopFrame.offset().top ) { |
| 22 |
jpTopFrame.addClass( 'fixed' ); |
| 23 |
$body.addClass( 'jp-frame-top-fixed' ); |
| 24 |
} |
| 25 |
if ( 120 <= jpBottomFrame.offset().top ) { |
| 26 |
jpTopFrame.removeClass( 'fixed' ); |
| 27 |
$body.removeClass( 'jp-frame-top-fixed' ); |
| 28 |
} |
| 29 |
} ); |
| 30 |
|
| 31 |
$( 'table.jetpack-modules', jpBottomFrame ).addClass( 'with-transparency' ); |
| 32 |
$( '.manage-left', jpBottomFrame ).css( 'width', '' ); |
| 33 |
$( '.manage-right', jpBottomFrame ).show(); |
| 34 |
} |
| 35 |
|
| 36 |
function initEvents() { |
| 37 |
// toggle search and filters at mobile resolution |
| 38 |
$( '.filter-search' ).on( 'click', function () { |
| 39 |
$( this ).toggleClass( 'active' ); |
| 40 |
$( '.manage-right' ).toggleClass( 'show' ); |
| 41 |
$( '.shade' ).toggle(); |
| 42 |
} ); |
| 43 |
|
| 44 |
// Toggle all checkboxes |
| 45 |
$( '.checkall' ).on( 'click', function () { |
| 46 |
$( '.table-bordered' ).find( ':checkbox' ).not( ':disabled' ).prop( 'checked', this.checked ); |
| 47 |
} ); |
| 48 |
|
| 49 |
// Clicking outside modal, or close X closes modal |
| 50 |
$( '.shade, .modal .close' ).on( 'click', function ( event ) { |
| 51 |
$( '.shade, .modal' ).hide(); |
| 52 |
$( '.manage-right' ).removeClass( 'show' ); |
| 53 |
event.preventDefault(); |
| 54 |
} ); |
| 55 |
} |
| 56 |
} )( jQuery ); |
| 57 |
|