]> git.joonet.de Git - adminer.git/commitdiff
Display AJAX loader favicon only on blur
authorJakub Vrana <jakub@vrana.cz>
Tue, 15 Mar 2011 11:58:04 +0000 (12:58 +0100)
committerJakub Vrana <jakub@vrana.cz>
Tue, 15 Mar 2011 11:58:04 +0000 (12:58 +0100)
adminer/static/functions.js

index f2654b36c3323f892a59e56ff77099cf6fdcb447..11bb20660f07d66035af476f5f3d5a9629cbee9a 100644 (file)
@@ -280,7 +280,9 @@ var ajaxState = 0;
 */
 function ajaxSend(url, data, popState) {
        var currentState = ++ajaxState;
-       replaceFavicon('../adminer/static/loader.gif');
+       onblur = function () {
+               replaceFavicon('../adminer/static/loader.gif');
+       };
        setHtml('loader', '<img src="../adminer/static/loader.gif" alt="">');
        return ajax(url, function (xmlhttp) {
                if (currentState == ajaxState) {
@@ -295,6 +297,7 @@ function ajaxSend(url, data, popState) {
                                }
                                return ajaxSend(redirect);
                        }
+                       onblur = function () { };
                        replaceFavicon('../adminer/static/favicon.ico');
                        if (!xmlhttp.status) {
                                setHtml('loader', '');
@@ -355,7 +358,7 @@ function ajaxMain(url, data, event) {
 /** Revive page from history
 * @param PopStateEvent|history
 */
-window.onpopstate = function (event) {
+onpopstate = function (event) {
        ajaxSend(location.href, event.state, 1); // 1 - disable pushState
 }