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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 // Show user's filters | 102 // Show user's filters |
103 reloadFilters(); | 103 reloadFilters(); |
104 } | 104 } |
105 $(loadOptions); | 105 $(loadOptions); |
106 | 106 |
107 function onMessage(msg) | 107 function onMessage(msg) |
108 { | 108 { |
109 if (msg.type == "add-subscription") | 109 if (msg.type == "add-subscription") |
110 startSubscriptionSelection(msg.title, msg.url); | 110 startSubscriptionSelection(msg.title, msg.url); |
| 111 else if (msg.type == "focus-section") |
| 112 { |
| 113 var tabs = document.getElementsByClassName("ui-tabs-panel"); |
| 114 for (var i = 0; i < tabs.length; i++) |
| 115 { |
| 116 var found = tabs[i].querySelector("[data-section='" + msg.section + "']"); |
| 117 if (!found) |
| 118 continue; |
| 119 |
| 120 var previous = document.getElementsByClassName("focused"); |
| 121 if (previous.length > 0) |
| 122 previous[0].classList.remove("focused"); |
| 123 |
| 124 var tab = $("[href='#" + tabs[i].id + "']"); |
| 125 $("#tabs").tabs("select", tab.parent().index()); |
| 126 found.classList.add("focused"); |
| 127 } |
| 128 } |
111 }; | 129 }; |
112 | 130 |
113 // Reloads the displayed subscriptions and filters | 131 // Reloads the displayed subscriptions and filters |
114 function reloadFilters() | 132 function reloadFilters() |
115 { | 133 { |
116 // Load user filter URLs | 134 // Load user filter URLs |
117 var container = document.getElementById("filterLists"); | 135 var container = document.getElementById("filterLists"); |
118 while (container.lastChild) | 136 while (container.lastChild) |
119 container.removeChild(container.lastChild); | 137 container.removeChild(container.lastChild); |
120 | 138 |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 links[i].href = arguments[i + 1]; | 682 links[i].href = arguments[i + 1]; |
665 links[i].setAttribute("target", "_blank"); | 683 links[i].setAttribute("target", "_blank"); |
666 } | 684 } |
667 else if (typeof arguments[i + 1] == "function") | 685 else if (typeof arguments[i + 1] == "function") |
668 { | 686 { |
669 links[i].href = "javascript:void(0);"; | 687 links[i].href = "javascript:void(0);"; |
670 links[i].addEventListener("click", arguments[i + 1], false); | 688 links[i].addEventListener("click", arguments[i + 1], false); |
671 } | 689 } |
672 } | 690 } |
673 } | 691 } |
OLD | NEW |