Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: options.js

Issue 29339387: Issue 3890 - Fix "Downloading..." indication for subscriptions on the options page (Closed)
Patch Set: Pass URL to Synchronizer.isExecuting() Created April 6, 2016, 5:20 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « messageResponder.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: options.js
===================================================================
--- a/options.js
+++ b/options.js
@@ -201,42 +201,35 @@
control.setAttribute("disabled", true);
}
- var downloadStatus = item.downloadStatus;
var dateElement = element.querySelector(".date");
var timeElement = element.querySelector(".time");
- if(dateElement && timeElement)
+ if (dateElement && timeElement)
{
var message = element.querySelector(".message");
- ext.backgroundPage.sendMessage(
+ if (item.isDownloading)
{
- type: "subscriptions.isDownloading",
- url: item.url
- },
- function(isDownloading)
+ var text = getMessage("options_filterList_lastDownload_inProgress");
+ message.textContent = text;
+ element.classList.add("show-message");
+ }
+ else if (item.downloadStatus != "synchronize_ok")
{
- if (isDownloading)
- {
- var text = getMessage("options_filterList_lastDownload_inProgress");
- message.textContent = text;
- element.classList.add("show-message");
- }
- else if (downloadStatus && downloadStatus != "synchronize_ok")
- {
- if (downloadStatus in filterErrors)
- message.textContent = getMessage(filterErrors[downloadStatus]);
- else
- message.textContent = item.downloadStatus;
- element.classList.add("show-message");
- }
- else if (item.lastDownload > 0)
- {
- var dateTime = i18n_formatDateTime(item.lastDownload * 1000);
- dateElement.textContent = dateTime[0];
- timeElement.textContent = dateTime[1];
- element.classList.remove("show-message");
- }
- });
+ var error = filterErrors[item.downloadStatus];
+ if (error)
+ message.textContent = getMessage(error);
+ else
+ message.textContent = item.downloadStatus;
+ element.classList.add("show-message");
+ }
+ else if (item.lastDownload > 0)
+ {
+ var dateTime = i18n_formatDateTime(item.lastDownload * 1000);
+ dateElement.textContent = dateTime[0];
+ timeElement.textContent = dateTime[1];
+ element.classList.remove("show-message");
+ }
}
+
var websiteElement = element.querySelector(".context-menu .website");
var sourceElement = element.querySelector(".context-menu .source");
if (websiteElement && item.homepage)
@@ -418,24 +411,21 @@
if (!Object.observe)
{
- ["disabled", "lastDownload"].forEach(function(property)
+ Object.keys(subscription).forEach(function(property)
{
- subscription["$" + property] = subscription[property];
+ var value = subscription[property];
Object.defineProperty(subscription, property,
{
get: function()
{
- return this["$" + property];
+ return value;
},
set: function(newValue)
{
- var oldValue = this["$" + property];
- if (oldValue != newValue)
+ if (value != newValue)
{
- this["$" + property] = newValue;
- var change = Object.create(null);
- change.name = property;
- onObjectChanged([change]);
+ value = newValue;
+ onObjectChanged([{name: property}]);
}
}
});
@@ -992,6 +982,8 @@
updateShareLink();
break;
case "lastDownload":
+ case "downloadStatus":
+ case "downloading":
updateSubscription(subscription);
break;
case "homepage":
@@ -1180,7 +1172,7 @@
{
type: "subscriptions.listen",
filter: ["added", "disabled", "homepage", "lastDownload", "removed",
- "title"]
+ "title", "downloadStatus", "downloading"]
});
window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
« no previous file with comments | « messageResponder.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld