Code Monkey home page Code Monkey logo

Comments (5)

phc369 avatar phc369 commented on May 25, 2024

Mmm .. let me see if Ajax call does not have a callback for such situations.

If not, I'll see how to do it with a timeout function that can be canceled
in the situation that there is a satisfactory response, since in the case
of a timeout, we should not reset the data reports of the AO admin bar.

2016-08-02 15:34 GMT-03:00 frank goossens [email protected]:

@pablocusto https://github.com/pablocusto ; a tester had a problem with
the ajax request not getting a response
https://wordpress.org/support/topic/preparing-for-autoptimize-210-wanna-test?replies=8#post-8709332
when clearing the cache from the toolbar. could we add a timeout of e.g. 5s
in the static toolbar JS & handle that gracefully somehow?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#54, or mute the thread
https://github.com/notifications/unsubscribe-auth/AArPdY88XK9H2xHn_yYepn6uYDWbDY88ks5qb43DgaJpZM4Ja6bi
.

from autoptimize.

futtta avatar futtta commented on May 25, 2024

this seems the relevant SO answer; http://stackoverflow.com/a/5225624/237449 ;-)

from autoptimize.

phc369 avatar phc369 commented on May 25, 2024

Nice! Excelent!!

So basically it would be something like this:

jQuery.ajax({

type : 'GET',
url : autoptimize_ajax_object.ajaxurl,
data : {'action':action, 'nonce':autoptimize_ajax_object.nonce},
dataType: 'json',
cache : false,
timeout : 5000,
success : function( data )
{
// Remove the Autoptimize Loading Modal
modal_loading.remove();
// Reset output values & class names of cache info
jQuery( '#wp-admin-bar-autoptimize-cache-info .size' ).attr( 'class',
'size green' ).html( '0.00 B' );
jQuery( '#wp-admin-bar-autoptimize-cache-info .files' ).html( '0' );
jQuery( '#wp-admin-bar-autoptimize-cache-info .percentage .numbers'
).attr( 'class', 'numbers green' ).html( '0%' );
jQuery( '#wp-admin-bar-autoptimize-cache-info .autoptimize-radial-bar
.fill' ).attr( 'class', 'fill bg-green' );
// Reset the class names of bullet icon
jQuery( '#wp-admin-bar-autoptimize' ).attr( 'class', 'menupop
bullet-green' );
// Reset the Radial Bar progress
jQuery( '#wp-admin-bar-autoptimize-cache-info .autoptimize-radial-bar
.mask.full, #wp-admin-bar-autoptimize-cache-info .autoptimize-radial-bar
.fill' ).css({
'-webkit-transform' : 'rotate(0deg)',
'-ms-transform' : 'rotate(0deg)',
'transform' : 'rotate(0deg)'
});
},
error: function( jqXHR, textStatus )
{
if ( textStatus === 'timeout' )
{
// Remove the Autoptimize Loading Modal
modal_loading.remove();
}
}
});

Now, we must think how to report that cleaning was not performed
successfully because of a timeout.

You have something in mind of how you want us to make this report?

Some nice Popup, modify the loading icon by another representative, or with
a simple javascript alert?

2016-08-02 17:49 GMT-03:00 frank goossens [email protected]:

this seems the relevant SO answer;
http://stackoverflow.com/a/5225624/237449 ;-)


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#54 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AArPdR40IbQOpL95xR_Jl7DpIHBOa1cPks5qb61egaJpZM4Ja6bi
.

from autoptimize.

futtta avatar futtta commented on May 25, 2024

Let's try to insert a div with class "notice notice-error" underneath the first .wrap > h1, saying something like "Your Autoptimize cache might not have been purged successfully, please check on the Autoptimize settings-page." (string to go in autoptimizeToolbar.php in wp_localized_script).

from autoptimize.

futtta avatar futtta commented on May 25, 2024

fixed with #56

from autoptimize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.