Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: devtools-panel.js

Issue 29522650: Issue 5316 - Adds dynamic filter types to devtools panel (Closed)
Patch Set: Created Sept. 12, 2017, 12:10 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « devtools-panel.html ('k') | messageResponder.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: devtools-panel.js
===================================================================
--- a/devtools-panel.js
+++ b/devtools-panel.js
@@ -14,16 +14,33 @@
* You should have received a copy of the GNU General Public License
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
"use strict";
let lastFilterQuery = null;
+ext.backgroundPage.sendMessage({type: "types.get"},
+ (filterTypes) =>
+ {
+ let filterTypesElem = document.getElementById("filter-type");
+ let filterStyleElem = document.createElement("style");
+ for (let type of filterTypes)
+ {
+ filterStyleElem.innerHTML +=
+ `#items[data-filter-type=${type}] tr:not([data-type=${type}])` +
+ "{display: none;}";
+ let optionNode = document.createElement("option");
+ optionNode.appendChild(document.createTextNode(type));
+ filterTypesElem.appendChild(optionNode);
+ }
+ document.body.appendChild(filterStyleElem);
+ });
+
function generateFilter(request, domainSpecific)
{
let filter = request.url.replace(/^[\w-]+:\/+(?:www\.)?/, "||");
let options = [];
if (request.type == "POPUP")
{
options.push("popup");
« no previous file with comments | « devtools-panel.html ('k') | messageResponder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld