summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/_inc/jetpack-admin.js')
-rw-r--r--plugins/jetpack/_inc/jetpack-admin.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/plugins/jetpack/_inc/jetpack-admin.js b/plugins/jetpack/_inc/jetpack-admin.js
new file mode 100644
index 00000000..3908c297
--- /dev/null
+++ b/plugins/jetpack/_inc/jetpack-admin.js
@@ -0,0 +1,58 @@
+( function( $ ) {
+ ///////////////////////////////////////
+ // INIT
+ ///////////////////////////////////////
+
+ $( document ).ready( function() {
+ initEvents();
+ configFixedElements();
+ } );
+
+ ///////////////////////////////////////
+ // FUNCTIONS
+ ///////////////////////////////////////
+
+ function configFixedElements() {
+ var jpTopFrame = $( '.frame.top' ),
+ jpBottomFrame = $( '.frame.bottom' ),
+ $body = $( 'body' );
+
+ $body.scroll( function() {
+ if ( 33 > jpTopFrame.offset().top ) {
+ jpTopFrame.addClass( 'fixed' );
+ $body.addClass( 'jp-frame-top-fixed' );
+ }
+ if ( 120 <= jpBottomFrame.offset().top ) {
+ jpTopFrame.removeClass( 'fixed' );
+ $body.removeClass( 'jp-frame-top-fixed' );
+ }
+ } );
+
+ $( 'table.jetpack-modules', jpBottomFrame ).addClass( 'with-transparency' );
+ $( '.manage-left', jpBottomFrame ).css( 'width', '' );
+ $( '.manage-right', jpBottomFrame ).show();
+ }
+
+ function initEvents() {
+ // toggle search and filters at mobile resolution
+ $( '.filter-search' ).on( 'click', function() {
+ $( this ).toggleClass( 'active' );
+ $( '.manage-right' ).toggleClass( 'show' );
+ $( '.shade' ).toggle();
+ } );
+
+ // Toggle all checkboxes
+ $( '.checkall' ).on( 'click', function() {
+ $( '.table-bordered' )
+ .find( ':checkbox' )
+ .prop( 'checked', this.checked );
+ } );
+
+ // Clicking outside modal, or close X closes modal
+ $( '.shade, .modal .close' ).on( 'click', function( event ) {
+ $( '.shade, .modal' ).hide();
+ $( '.manage-right' ).removeClass( 'show' );
+ event.preventDefault();
+ } );
+ }
+} )( jQuery );