Index: options.js |
=================================================================== |
--- a/options.js |
+++ b/options.js |
@@ -646,15 +646,47 @@ |
ext.backgroundPage.sendMessage( |
{ |
type: "app.get", |
- what: "addonVersion" |
+ what: "info" |
}, |
- function(addonVersion) |
+ function(info) |
{ |
- E("abp-version").textContent = addonVersion; |
- }); |
- getDocLink("releases", function(link) |
- { |
- E("link-version").setAttribute("href", link); |
+ E("abp-version").textContent = info.addonVersion; |
+ |
+ fetch("https://adblockplus.org/atom/?section=releases&limit=100").then(function(response) |
Thomas Greiner
2016/02/05 14:24:37
We shouldn't ping our servers everytime someone op
Wladimir Palant
2016/02/05 14:29:44
Indeed. If we need this feature we need to set up
Sebastian Noack
2016/02/05 14:37:18
Please note the alternative approach in patch set
|
+ { |
+ return repsonse.ok ? response.text() : ""; |
+ }).then( |
+ function(text) |
+ { |
+ var doc = new DOMParser().parseFromString(text, "application/xml"); |
+ var entries = doc.getElementsByTagName("entry"); |
+ for (var i = 0; i < entries.length; i++) |
+ { |
+ var entry = entries[i]; |
+ var title = entry.getElementsByTagName("title")[0]; |
+ if (!title) |
+ continue; |
+ |
+ var lowerCaseTitleText = title.textContent.toLowerCase(); |
+ if (lowerCaseTitleText.split(/\W+/).indexOf(info.application) == -1) |
Thomas Greiner
2016/02/05 14:24:37
That doesn't seem too reliable because it's more o
Sebastian Noack
2016/02/05 14:37:18
I guess we could omit that check as well. Not sure
|
+ continue; |
+ if (lowerCaseTitleText.split(/\s+/).indexOf(info.addonVersion) == -1) |
+ continue; |
+ |
+ var links = entry.getElementsByTagName("link"); |
+ for (var j = 0; j < links.length; j++) |
+ { |
+ var link = links[j]; |
+ var href = link.getAttribute("href"); |
+ |
+ if (link.getAttribute("rel") == "alternate" && href) |
+ { |
+ E("version").setAttribute("href", href); |
+ return; |
+ } |
+ } |
+ } |
+ }).catch(function() {}); |
}); |
getDocLink("contribute", function(link) |