Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: components/dom_distiller/content/resources/dom_distiller_viewer.js

Issue 444143002: Loading Indicator for Distilled Pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: styling Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/content/resources/dom_distiller_viewer.js
diff --git a/components/dom_distiller/content/resources/dom_distiller_viewer.js b/components/dom_distiller/content/resources/dom_distiller_viewer.js
index 94299467ef3df0b6ffa129f1ee149d008e58eec8..ea1c5651d2f9f388aba3e6cafeb780af353638a4 100644
--- a/components/dom_distiller/content/resources/dom_distiller_viewer.js
+++ b/components/dom_distiller/content/resources/dom_distiller_viewer.js
@@ -11,6 +11,7 @@ function addToPage(html) {
function showLoadingIndicator(isLastPage) {
document.getElementById('loadingIndicator').className =
isLastPage ? 'hidden' : 'visible';
+ updateLoadingIndicator(isLastPage);
}
// Maps JS theme to CSS class and then changes body class name.
@@ -26,3 +27,21 @@ function useTheme(theme) {
}
document.body.className = cssClass;
}
+
+var updateLoadingIndicator = function() {
+ var colors = ["red", "yellow", "green", "blue"];
+ return function(isLastPage) {
+ if (!isLastPage && typeof this.colorShuffle == "undefined") {
+ var loader = document.getElementById("loader");
+ if (loader) {
+ var colorIndex = -1;
+ this.colorShuffle = setInterval(function() {
+ colorIndex = (colorIndex + 1) % colors.length;
+ loader.className = colors[colorIndex];
+ }, 600);
+ }
+ } else if (isLastPage && typeof this.colorShuffle != "undefined") {
+ clearInterval(this.colorShuffle);
+ }
+ };
+}();

Powered by Google App Engine
This is Rietveld 408576698