README.md
6 years ago
class-jetpack-calypsoify.php
2 years ago
mods-gutenberg.js
2 years ago
mods.js
6 years ago
style-gutenberg-rtl.min.css
2 years ago
style-gutenberg.min.css
2 years ago
mods.js
80 lines
| 1 | /* global pagenow, ajaxurl, CalypsoifyOpts */ |
| 2 | ( function ( $ ) { |
| 3 | $( window ).load( function () { |
| 4 | // On Plugins.php |
| 5 | if ( 'plugins' === pagenow ) { |
| 6 | // pagenow === $current_screen->id |
| 7 | // Remove | and () from the plugins filter bar |
| 8 | $.each( $( 'ul.subsubsub li' ), function ( i, el ) { |
| 9 | var li = $( el ); |
| 10 | li.html( li.html().replace( '|', '' ).replace( '(', '' ).replace( ')', '' ) ); |
| 11 | } ); |
| 12 | |
| 13 | // Add in the AJAX-y goodness for toggling autoupdates. |
| 14 | $( 'input.autoupdate-toggle' ).change( function ( event ) { |
| 15 | var el = event.target; |
| 16 | |
| 17 | el.disabled = true; |
| 18 | el.classList.add( 'is-toggling' ); |
| 19 | |
| 20 | jQuery.post( |
| 21 | ajaxurl, |
| 22 | { |
| 23 | action: 'jetpack_toggle_autoupdate', |
| 24 | type: 'plugins', |
| 25 | slug: el.dataset.slug, |
| 26 | active: el.checked, |
| 27 | _wpnonce: CalypsoifyOpts.nonces.autoupdate_plugins, |
| 28 | }, |
| 29 | function () { |
| 30 | // Add something to test and confirm that `el.dataset.slug` is missing from `response.data` ? |
| 31 | el.disabled = false; |
| 32 | el.classList.remove( 'is-toggling' ); |
| 33 | } |
| 34 | ); |
| 35 | } ); |
| 36 | } |
| 37 | |
| 38 | $( '#wp-admin-bar-root-default' ).on( 'click', 'li', function ( event ) { |
| 39 | location.href = $( event.target ).closest( 'a' ).attr( 'href' ); |
| 40 | } ); |
| 41 | |
| 42 | $( '#wp-admin-bar-top-secondary' ).on( 'click', 'li#wp-admin-bar-my-account', function ( |
| 43 | event |
| 44 | ) { |
| 45 | location.href = $( event.target ).closest( 'a' ).attr( 'href' ); |
| 46 | } ); |
| 47 | |
| 48 | if ( document && document.location && document.location.search ) { |
| 49 | var params_array = document.location.search.substr( 1 ).split( '&' ), |
| 50 | params_object = {}, |
| 51 | body = $( document.body ), |
| 52 | i, |
| 53 | key_value, |
| 54 | pluginEl; |
| 55 | |
| 56 | if ( params_array && params_array.length ) { |
| 57 | for ( i = 0; i < params_array.length; i++ ) { |
| 58 | key_value = params_array[ i ].split( '=' ); |
| 59 | params_object[ key_value[ 0 ] ] = key_value[ 1 ]; |
| 60 | } |
| 61 | |
| 62 | if ( params_object.s && params_object[ 'modal-mode' ] && params_object.plugin ) { |
| 63 | pluginEl = $( |
| 64 | '.plugin-card-' + params_object.plugin + ' .thickbox.open-plugin-details-modal' |
| 65 | ); |
| 66 | if ( pluginEl && pluginEl.length ) { |
| 67 | pluginEl.click(); |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | body.on( 'thickbox:iframe:loaded', function () { |
| 73 | $( '#TB_window' ).on( 'click', 'button#TB_closeWindowButton', function () { |
| 74 | $( '#TB_closeWindowButton' ).click(); |
| 75 | } ); |
| 76 | } ); |
| 77 | } |
| 78 | } ); |
| 79 | } )( jQuery ); |
| 80 |