From c708fa1c69c36a5378ff1599c58be9f99ede63d2 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Tue, 15 Mar 2011 12:58:04 +0100 Subject: [PATCH] Display AJAX loader favicon only on blur --- adminer/static/functions.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/adminer/static/functions.js b/adminer/static/functions.js index f2654b36..11bb2066 100644 --- a/adminer/static/functions.js +++ b/adminer/static/functions.js @@ -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', ''); 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 }