diff --git a/chrome/content/zotero/bindings/itembox.xml b/chrome/content/zotero/bindings/itembox.xml index 02e4e796fd..1e4184f068 100644 --- a/chrome/content/zotero/bindings/itembox.xml +++ b/chrome/content/zotero/bindings/itembox.xml @@ -341,7 +341,7 @@ fieldNames.push(Zotero.ItemFields.getName(fields[i])); } - if (! (this.item instanceof Zotero.FeedItem)) { + if (!(this.item instanceof Zotero.FeedItem)) { fieldNames.push("dateAdded", "dateModified"); } } diff --git a/chrome/content/zotero/feedSettings.js b/chrome/content/zotero/feedSettings.js index 56555a1d61..fd0db9d85a 100644 --- a/chrome/content/zotero/feedSettings.js +++ b/chrome/content/zotero/feedSettings.js @@ -36,31 +36,28 @@ var Zotero_Feed_Settings = new function() { urlTainted = false; let cleanURL = function(url) { - let cleanUrl = Zotero.Utilities.cleanURL(url, true); + let cleanURL = Zotero.Utilities.cleanURL(url, true); - if (cleanUrl) { - if (/^https?:\/\/[^\/\s]+\/\S/.test(cleanUrl)) { - return cleanUrl; + if (cleanURL) { + if (/^https?:\/\/[^\/\s]+\/\S/.test(cleanURL)) { + return cleanURL; } else { - Zotero.debug(uri.scheme + " is not a supported protocol for feeds."); + Zotero.debug(uri.scheme + " is not a supported protocol for feeds"); } } }; - this.init = function() { + this.init = Zotero.Promise.coroutine(function* () { this.toggleAdvancedOptions(false); data = window.arguments[0]; if (data.url) { document.getElementById('feed-url').value = data.url; - } - - if (!data.url) { - this.invalidateUrl(); - } else { // Do not allow to change URL for existing feed document.getElementById('feed-url').readOnly = true; + } else { + this.invalidateURL(); } if (data.title) { @@ -71,20 +68,20 @@ var Zotero_Feed_Settings = new function() { if (data.ttl !== undefined) { ttl = Math.floor(data.ttl / 60); } else { - ttl = 1; + ttl = Zotero.Prefs.get('feeds.defaultTTL'); } document.getElementById('feed-ttl').value = ttl; let cleanupAfter = data.cleanupAfter; - if (cleanupAfter === undefined) cleanupAfter = 2; + if (cleanupAfter === undefined) cleanupAfter = Zotero.Prefs.get('feeds.defaultCleanupAfter'); document.getElementById('feed-cleanupAfter').value = cleanupAfter; if (data.url && !data.urlIsValid) { - this.validateUrl(); + yield this.validateURL(); } - }; + }); - this.invalidateUrl = function() { + this.invalidateURL = function() { urlTainted = true; if (feedReader) { feedReader.terminate(); @@ -100,7 +97,7 @@ var Zotero_Feed_Settings = new function() { document.documentElement.getButton('accept').disabled = true; }; - this.validateUrl = Zotero.Promise.coroutine(function* () { + this.validateURL = Zotero.Promise.coroutine(function* () { if (feedReader) { feedReader.terminate(); feedReader = null; @@ -111,11 +108,11 @@ var Zotero_Feed_Settings = new function() { if (!url) return; try { - let fr = feedReader = new Zotero.FeedReader(url); + var fr = feedReader = new Zotero.FeedReader(url); yield fr.process(); let feed = fr.feedProperties; // Prevent progress if textbox changes triggered another call to - // validateUrl / invalidateUrl (old session) + // validateURL / invalidateURL (old session) if (feedReader !== fr || urlTainted) return; let title = document.getElementById('feed-title'); diff --git a/chrome/content/zotero/feedSettings.xul b/chrome/content/zotero/feedSettings.xul index 2550c9ca7a..2cc6e22140 100644 --- a/chrome/content/zotero/feedSettings.xul +++ b/chrome/content/zotero/feedSettings.xul @@ -15,36 +15,48 @@