Нет описания

jetpack-admin.js 1.5KB

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