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

Unified Diff: lib/cssRules.js

Issue 29335650: Issue 2595 - Use the core code from adblockpluscore (Closed)
Patch Set: Created Feb. 4, 2016, 6:35 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 | « lib/antiadblockInit.js ('k') | lib/downloader.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/cssRules.js
===================================================================
deleted file mode 100644
--- a/lib/cssRules.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * This file is part of Adblock Plus <https://adblockplus.org/>,
- * Copyright (C) 2006-2016 Eyeo GmbH
- *
- * Adblock Plus is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * Adblock Plus is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- * @fileOverview CSS property filtering implementation.
- */
-
-let {ElemHide} = require("elemHide");
-let {Filter} = require("filterClasses");
-
-let filters = Object.create(null);
-
-/**
- * CSS rules component
- * @class
- */
-let CSSRules = exports.CSSRules =
-{
- /**
- * Removes all known filters
- */
- clear: function()
- {
- filters = Object.create(null);
- },
-
- /**
- * Add a new CSS property filter
- * @param {CSSPropertyFilter} filter
- */
- add: function(filter)
- {
- filters[filter.text] = true;
- },
-
- /**
- * Removes a CSS property filter
- * @param {CSSPropertyFilter} filter
- */
- remove: function(filter)
- {
- delete filters[filter.text];
- },
-
- /**
- * Returns a list of all rules active on a particular domain
- * @param {String} domain
- * @return {CSSPropertyFilter[]}
- */
- getRulesForDomain: function(domain)
- {
- let result = [];
- let keys = Object.getOwnPropertyNames(filters);
- for (let key of keys)
- {
- let filter = Filter.fromText(key);
- if (filter.isActiveOnDomain(domain) && !ElemHide.getException(filter, domain))
- result.push(filter);
- }
- return result;
- }
-};
« no previous file with comments | « lib/antiadblockInit.js ('k') | lib/downloader.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld