Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
639 getKey.keys = { | 639 getKey.keys = { |
640 9: "Tab", | 640 9: "Tab", |
641 13: "Enter", | 641 13: "Enter", |
642 27: "Escape" | 642 27: "Escape" |
643 }; | 643 }; |
644 | 644 |
645 // Initialize navigation sidebar | 645 // Initialize navigation sidebar |
646 ext.backgroundPage.sendMessage( | 646 ext.backgroundPage.sendMessage( |
647 { | 647 { |
648 type: "app.get", | 648 type: "app.get", |
649 what: "addonVersion" | 649 what: "info" |
650 }, | 650 }, |
651 function(addonVersion) | 651 function(info) |
652 { | 652 { |
653 E("abp-version").textContent = addonVersion; | 653 E("abp-version").textContent = info.addonVersion; |
654 }); | 654 |
655 getDocLink("releases", function(link) | 655 fetch("https://adblockplus.org/atom/?section=releases&limit=100").then(fun ction(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
| |
656 { | 656 { |
657 E("link-version").setAttribute("href", link); | 657 return repsonse.ok ? response.text() : ""; |
658 }).then( | |
659 function(text) | |
660 { | |
661 var doc = new DOMParser().parseFromString(text, "application/xml"); | |
662 var entries = doc.getElementsByTagName("entry"); | |
663 for (var i = 0; i < entries.length; i++) | |
664 { | |
665 var entry = entries[i]; | |
666 var title = entry.getElementsByTagName("title")[0]; | |
667 if (!title) | |
668 continue; | |
669 | |
670 var lowerCaseTitleText = title.textContent.toLowerCase(); | |
671 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
| |
672 continue; | |
673 if (lowerCaseTitleText.split(/\s+/).indexOf(info.addonVersion) == -1) | |
674 continue; | |
675 | |
676 var links = entry.getElementsByTagName("link"); | |
677 for (var j = 0; j < links.length; j++) | |
678 { | |
679 var link = links[j]; | |
680 var href = link.getAttribute("href"); | |
681 | |
682 if (link.getAttribute("rel") == "alternate" && href) | |
683 { | |
684 E("version").setAttribute("href", href); | |
685 return; | |
686 } | |
687 } | |
688 } | |
689 }).catch(function() {}); | |
658 }); | 690 }); |
659 | 691 |
660 getDocLink("contribute", function(link) | 692 getDocLink("contribute", function(link) |
661 { | 693 { |
662 document.querySelector("#tab-contribute a").setAttribute("href", link); | 694 document.querySelector("#tab-contribute a").setAttribute("href", link); |
663 }); | 695 }); |
664 | 696 |
665 updateShareLink(); | 697 updateShareLink(); |
666 | 698 |
667 // Initialize interactive UI elements | 699 // Initialize interactive UI elements |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1018 filter: ["added", "loaded", "removed"] | 1050 filter: ["added", "loaded", "removed"] |
1019 }); | 1051 }); |
1020 ext.backgroundPage.sendMessage( | 1052 ext.backgroundPage.sendMessage( |
1021 { | 1053 { |
1022 type: "subscriptions.listen", | 1054 type: "subscriptions.listen", |
1023 filter: ["added", "disabled", "homepage", "lastDownload", "removed", "title" ] | 1055 filter: ["added", "disabled", "homepage", "lastDownload", "removed", "title" ] |
1024 }); | 1056 }); |
1025 | 1057 |
1026 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1058 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
1027 })(); | 1059 })(); |
OLD | NEW |