From 3f4365b8a67758f3fb3adbc26b54b1dc1cf856fe Mon Sep 17 00:00:00 2001 From: danysirota Date: Tue, 12 Jun 2018 10:17:20 +0300 Subject: [PATCH] Don't touch dom in unfocused tabs stops high cpu usage in chrome with LOTS of BigQuery tabs --- js/devtools.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/js/devtools.js b/js/devtools.js index c5ca570..3455ee5 100644 --- a/js/devtools.js +++ b/js/devtools.js @@ -8,6 +8,9 @@ $(document).ready(function() { createGraphButtons(); modifyAndKeepOpenValidatorBox(); var t = setInterval(function() { + if (document.hidden) { + return + } // check if results exist if ($('#body') && $('#outer-body') && $('#main') && !hasResized) { hasResized = true; @@ -63,6 +66,9 @@ $(document).ready(function() { // make results rows clickable to expand setInterval(function() { + if (document.hidden) { + return + } $(".row-number").css("background-color", "#F9EDBE"); $(".records-cell").css("max-width", "1000px").css("overflow", "hidden"); @@ -102,6 +108,9 @@ var hasFoundStatusBox = false; function modifyAndKeepOpenValidatorBox() { // make sure validator is always open setInterval(function() { + if (document.hidden) { + return + } if ($('.validate-status-box').length > 0) { $('.validate-status-box').removeClass('ng-hide'); if (!hasFoundStatusBox) {