![]() Server : LiteSpeed System : Linux premium84.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : claqxcrl ( 523) PHP Version : 8.1.32 Disable Function : NONE Directory : /home/claqxcrl/www/wp-content/themes/newsup/inc/ansar/admin/js/ |
/** * Remove activate button and replace with activation in progress button. */ /* global newsup_start_page */ /* global console */ jQuery( document ).ready( function ( $ ) { $.pluginInstall = { 'init': function () { this.handleInstall(); this.handleActivate(); }, 'handleInstall': function () { var self = this; $( 'body' ).on( 'click', '.install-now', function ( e ) { e.preventDefault(); var button = $( this ); var slug = button.attr( 'data-slug' ); var url = button.attr( 'href' ); var redirect = $( button ).data( 'redirect' ); button.text( wp.updates.l10n.installing ); button.addClass( 'updating-message' ); wp.updates.installPlugin( { slug: slug, success: function () { button.text( newsup_start_page.activating + '...' ); self.activatePlugin( url, redirect ); } } ); } ); }, 'activatePlugin': function ( url, redirect ) { if ( typeof url === 'undefined' || !url ) { return; } jQuery.ajax( { async: true, type: 'GET', url: url, success: function () { // Reload the page. if ( typeof(redirect) !== 'undefined' && redirect !== '' ) { window.location.replace( redirect ); location.reload(); } else { location.reload(); } }, error: function ( jqXHR, exception ) { var msg = ''; if ( jqXHR.status === 0 ) { msg = 'Not connect.\n Verify Network.'; } else if ( jqXHR.status === 404 ) { msg = 'Requested page not found. [404]'; } else if ( jqXHR.status === 500 ) { msg = 'Internal Server Error [500].'; } else if ( exception === 'parsererror' ) { msg = 'Requested JSON parse failed.'; } else if ( exception === 'timeout' ) { msg = 'Time out error.'; } else if ( exception === 'abort' ) { msg = 'Ajax request aborted.'; } else { msg = 'Uncaught Error.\n' + jqXHR.responseText; } console.log( msg ); }, } ); }, 'handleActivate': function () { var self = this; $( 'body' ).on( 'click', '.activate-now', function ( e ) { e.preventDefault(); var button = $( this ); var url = button.attr( 'href' ); var redirect = button.attr( 'data-redirect' ); button.addClass( 'updating-message' ); button.text( newsup_start_page.activating + '...' ); self.activatePlugin( url, redirect ); } ); }, }; $.pluginInstall.init(); } );