admin-folders.js
3 years ago
admin-galleries.js
3 years ago
admin-gallery.js
3 years ago
admin-media.js
5 years ago
admin-plugins.js
3 years ago
admin-widgets.js
5 years ago
admin.js
5 years ago
front-basicmasonry.js
3 years ago
front-basicslider.js
4 years ago
front.js
3 years ago
gutenberg.min.js
4 years ago
admin-plugins.js
69 lines
| 1 | ( function( $ ) { |
| 2 | |
| 3 | // ready event |
| 4 | $( function() { |
| 5 | // cancel deactivation |
| 6 | $( document ).on( 'click', '.rl-deactivate-plugin-cancel', function( e ) { |
| 7 | tb_remove(); |
| 8 | |
| 9 | return false; |
| 10 | } ); |
| 11 | |
| 12 | // simple deactivation |
| 13 | $( document ).on( 'click', '.rl-deactivate-plugin-simple', function( e ) { |
| 14 | // display spinner |
| 15 | $( '.rl-deactivation-buttons .spinner' ).addClass( 'is-active' ); |
| 16 | } ); |
| 17 | |
| 18 | // deactivation with sending data |
| 19 | $( document ).on( 'click', '.rl-deactivate-plugin-data', function( e ) { |
| 20 | var spinner = $( '.rl-deactivation-buttons .spinner' ), |
| 21 | url = $( this ).attr( 'href' ); |
| 22 | |
| 23 | // display spinner |
| 24 | spinner.addClass( 'is-active' ); |
| 25 | |
| 26 | // submit data |
| 27 | $.post( ajaxurl, { |
| 28 | action: 'rl-deactivate-plugin', |
| 29 | option_id: $( 'input[name="rl_deactivation_option"]:checked' ).val(), |
| 30 | other: $( 'textarea[name="rl_deactivation_other"]' ).val(), |
| 31 | nonce: rlArgsPlugins.nonce |
| 32 | } ).done( function( response ) { |
| 33 | // deactivate plugin |
| 34 | window.location.href = url; |
| 35 | } ).fail( function() { |
| 36 | // deactivate plugin |
| 37 | window.location.href = url; |
| 38 | } ); |
| 39 | |
| 40 | return false; |
| 41 | } ); |
| 42 | |
| 43 | // click on deactivation link |
| 44 | $( document ).on( 'click', '.rl-deactivate-plugin-modal', function( e ) { |
| 45 | var modalBox = $( '#rl-deactivation-container' ).closest( '#TB_window' ); |
| 46 | |
| 47 | tb_show( rlArgsPlugins.deactivate, '#TB_inline?inlineId=rl-deactivation-modal&modal=false' ); |
| 48 | |
| 49 | if ( modalBox.length > 0 ) { |
| 50 | $( modalBox ).addClass( 'rl-deactivation-modal' ); |
| 51 | $( modalBox ).find( '#TB_closeWindowButton' ).on( 'blur' ); |
| 52 | } |
| 53 | |
| 54 | return false; |
| 55 | } ); |
| 56 | |
| 57 | // change radio |
| 58 | $( document ).on( 'change', 'input[name="rl_deactivation_option"]', function( e ) { |
| 59 | var last = $( 'input[name="rl_deactivation_option"]' ).last().get( 0 ); |
| 60 | |
| 61 | // last element? |
| 62 | if ( $( this ).get( 0 ) === last ) |
| 63 | $( '.rl-deactivation-textarea textarea' ).prop( 'disabled', false ); |
| 64 | else |
| 65 | $( '.rl-deactivation-textarea textarea' ).prop( 'disabled', true ); |
| 66 | } ); |
| 67 | } ); |
| 68 | |
| 69 | } )( jQuery ); |