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