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 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1107 switch (message.action) | 1107 switch (message.action) |
1108 { | 1108 { |
1109 case "addSubscription": | 1109 case "addSubscription": |
1110 var subscription = message.args[0]; | 1110 var subscription = message.args[0]; |
1111 var dialog = E("dialog-content-predefined"); | 1111 var dialog = E("dialog-content-predefined"); |
1112 dialog.querySelector("h3").textContent = subscription.title || ""; | 1112 dialog.querySelector("h3").textContent = subscription.title || ""; |
1113 dialog.querySelector(".url").textContent = subscription.url; | 1113 dialog.querySelector(".url").textContent = subscription.url; |
1114 openDialog("predefined"); | 1114 openDialog("predefined"); |
1115 break; | 1115 break; |
1116 case "focusSection": | 1116 case "focusSection": |
1117 document.body.setAttribute("data-tab", message.args[0]); | 1117 var tabs = document.querySelectorAll("nav [id^=tab-]"); |
Thomas Greiner
2016/04/11 18:34:40
Instead of manually checking the contents of each
| |
1118 for (var i = 0; i < tabs.length; i++) | |
1119 { | |
1120 var tab = tabs[i]; | |
1121 var section = document.querySelector( | |
1122 "#content-" + tab.id.substr(4) + | |
1123 " [data-section='" + message.args[0] + "']" | |
1124 ); | |
1125 | |
1126 if (section) | |
1127 { | |
1128 // Switch to the corresponding tab and scroll to the section. | |
1129 tab.click(); | |
Thomas Greiner
2016/04/11 18:34:40
This is a hack. The tab switching functionality is
| |
1130 section.scrollIntoView(); | |
1131 | |
1132 // Focus the first UI element inside the section. | |
1133 var walker = document.createTreeWalker(section, NodeFilter.SHOW_ ELEMENT); | |
1134 do | |
1135 walker.currentNode.focus(); | |
Thomas Greiner
2016/04/11 18:34:40
How do you know that the element is focusable? You
| |
1136 while (walker.currentNode != document.activeElement && walker.ne xtNode()) | |
1137 } | |
1138 } | |
1118 break; | 1139 break; |
1119 } | 1140 } |
1120 break; | 1141 break; |
1121 case "filters.respond": | 1142 case "filters.respond": |
1122 onFilterMessage(message.action, message.args[0]); | 1143 onFilterMessage(message.action, message.args[0]); |
1123 break; | 1144 break; |
1124 case "prefs.respond": | 1145 case "prefs.respond": |
1125 onPrefMessage(message.action, message.args[0], false); | 1146 onPrefMessage(message.action, message.args[0], false); |
1126 break; | 1147 break; |
1127 case "subscriptions.respond": | 1148 case "subscriptions.respond": |
(...skipping 21 matching lines...) Expand all Loading... | |
1149 }); | 1170 }); |
1150 ext.backgroundPage.sendMessage( | 1171 ext.backgroundPage.sendMessage( |
1151 { | 1172 { |
1152 type: "subscriptions.listen", | 1173 type: "subscriptions.listen", |
1153 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1174 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
1154 "title", "downloadStatus", "downloading"] | 1175 "title", "downloadStatus", "downloading"] |
1155 }); | 1176 }); |
1156 | 1177 |
1157 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1178 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
1158 })(); | 1179 })(); |
OLD | NEW |