Prevents double-execution of ci_page_loaded
As gerrit is a big JS-based webapp, traditional hooks for executing code on page-load (window.onload and friends) don't get executed on every page as a user is exploring the UI. Instead we rely on the appearance and disappearance of the "working..." message to know when a user is looking at a new page. The test for this was not precise enough, which was causing the ci_page_loaded function to be called twice on page load. This patch changes the MutationObserver so that it only calls the function once, by checking that it is the "style" attribute that has changed. The other call was being triggered by a change to the "aria-hidden" attribute. Change-Id: If870d53b5760c140c84e5711ada94609a60e0cdb
This commit is contained in:
parent
ff55bbcbfc
commit
90bfe69e4f
@ -291,6 +291,7 @@ window.onload = function() {
|
|||||||
var span = $("span.rpcStatus");
|
var span = $("span.rpcStatus");
|
||||||
$.each(mutations, function(i, mutation) {
|
$.each(mutations, function(i, mutation) {
|
||||||
if (mutation.target === span[0] &&
|
if (mutation.target === span[0] &&
|
||||||
|
mutation.attributeName === "style" &&
|
||||||
(!(span.is(":visible:")))) {
|
(!(span.is(":visible:")))) {
|
||||||
ci_page_loaded();
|
ci_page_loaded();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user