LEFT | RIGHT |
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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 "use strict"; | 18 "use strict"; |
19 | 19 |
20 (function() | 20 (function() |
21 { | 21 { |
22 var subscriptionsMap = Object.create(null); | 22 var subscriptionsMap = Object.create(null); |
23 var filtersMap = Object.create(null); | 23 var filtersMap = Object.create(null); |
24 var collections = Object.create(null); | 24 var collections = Object.create(null); |
25 var acceptableAdsUrl = null; | 25 var acceptableAdsUrl = null; |
26 var maxItemId = 0; | |
27 var getMessage = ext.i18n.getMessage; | 26 var getMessage = ext.i18n.getMessage; |
28 var filterErrors = | 27 var filterErrors = |
29 { | 28 { |
30 "synchronize_invalid_url": "options_filterList_lastDownload_invalidURL", | 29 "synchronize_invalid_url": "options_filterList_lastDownload_invalidURL", |
31 "synchronize_connection_error": "options_filterList_lastDownload_connectionE
rror", | 30 "synchronize_connection_error": "options_filterList_lastDownload_connectionE
rror", |
32 "synchronize_invalid_data": "options_filterList_lastDownload_invalidData", | 31 "synchronize_invalid_data": "options_filterList_lastDownload_invalidData", |
33 "synchronize_checksum_mismatch": "options_filterList_lastDownload_checksumMi
smatch" | 32 "synchronize_checksum_mismatch": "options_filterList_lastDownload_checksumMi
smatch" |
34 }; | 33 }; |
35 | 34 |
36 function Collection(details) | 35 function Collection(details) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 }.bind(this)); | 93 }.bind(this)); |
95 | 94 |
96 for (var j = 0; j < this.details.length; j++) | 95 for (var j = 0; j < this.details.length; j++) |
97 { | 96 { |
98 var table = E(this.details[j].id); | 97 var table = E(this.details[j].id); |
99 var template = table.querySelector("template"); | 98 var template = table.querySelector("template"); |
100 for (var i = 0; i < arguments.length; i++) | 99 for (var i = 0; i < arguments.length; i++) |
101 { | 100 { |
102 var item = arguments[i]; | 101 var item = arguments[i]; |
103 var listItem = document.createElement("li"); | 102 var listItem = document.createElement("li"); |
104 var itemId = "item-" + (++maxItemId); | |
105 listItem.appendChild(document.importNode(template.content, true)); | 103 listItem.appendChild(document.importNode(template.content, true)); |
| 104 listItem.setAttribute("aria-label", this._getItemTitle(item, j)); |
106 listItem.setAttribute("data-access", item.url || item.text); | 105 listItem.setAttribute("data-access", item.url || item.text); |
107 listItem.setAttribute("id", itemId); | |
108 listItem.setAttribute("role", "section"); | 106 listItem.setAttribute("role", "section"); |
109 | 107 |
110 var label = listItem.querySelector(".display"); | 108 var label = listItem.querySelector(".display"); |
111 label.setAttribute("for", itemId); | |
112 if (item.recommended && label.hasAttribute("data-tooltip")) | 109 if (item.recommended && label.hasAttribute("data-tooltip")) |
113 { | 110 { |
114 var tooltipId = label.getAttribute("data-tooltip"); | 111 var tooltipId = label.getAttribute("data-tooltip"); |
115 tooltipId = tooltipId.replace("%value%", item.recommended); | 112 tooltipId = tooltipId.replace("%value%", item.recommended); |
116 label.setAttribute("data-tooltip", tooltipId); | 113 label.setAttribute("data-tooltip", tooltipId); |
117 } | 114 } |
118 | 115 |
119 var controls = listItem.querySelectorAll(".control"); | 116 var controls = listItem.querySelectorAll(".control"); |
120 for (var k = 0; k < controls.length; k++) | 117 for (var k = 0; k < controls.length; k++) |
121 { | 118 { |
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1174 }); | 1171 }); |
1175 ext.backgroundPage.sendMessage( | 1172 ext.backgroundPage.sendMessage( |
1176 { | 1173 { |
1177 type: "subscriptions.listen", | 1174 type: "subscriptions.listen", |
1178 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1175 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
1179 "title", "downloadStatus", "downloading"] | 1176 "title", "downloadStatus", "downloading"] |
1180 }); | 1177 }); |
1181 | 1178 |
1182 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1179 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
1183 })(); | 1180 })(); |
LEFT | RIGHT |