summaryrefslogtreecommitdiff
path: root/data/extensions/spyblock@gnu.org/lib/common.js
diff options
context:
space:
mode:
Diffstat (limited to 'data/extensions/spyblock@gnu.org/lib/common.js')
-rw-r--r--data/extensions/spyblock@gnu.org/lib/common.js53
1 files changed, 0 insertions, 53 deletions
diff --git a/data/extensions/spyblock@gnu.org/lib/common.js b/data/extensions/spyblock@gnu.org/lib/common.js
deleted file mode 100644
index e2c2db5..0000000
--- a/data/extensions/spyblock@gnu.org/lib/common.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * This file is part of Adblock Plus <https://adblockplus.org/>,
- * Copyright (C) 2006-2017 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/>.
- */
-
-// We are currently limited to ECMAScript 5 in this file, because it is being
-// used in the browser tests. See https://issues.adblockplus.org/ticket/4796
-
-/**
- * Converts filter text into regular expression string
- * @param {string} text as in Filter()
- * @return {string} regular expression representation of filter text
- */
-function filterToRegExp(text)
-{
- return text
- // remove multiple wildcards
- .replace(/\*+/g, "*")
- // remove anchors following separator placeholder
- .replace(/\^\|$/, "^")
- // escape special symbols
- .replace(/\W/g, "\\$&")
- // replace wildcards by .*
- .replace(/\\\*/g, ".*")
- // process separator placeholders (all ANSI characters but alphanumeric
- // characters and _%.-)
- .replace(/\\\^/g, "(?:[\\x00-\\x24\\x26-\\x2C\\x2F\\x3A-\\x40\\x5B-\\x5E\\x60\\x7B-\\x7F]|$)")
- // process extended anchor at expression start
- .replace(/^\\\|\\\|/, "^[\\w\\-]+:\\/+(?!\\/)(?:[^\\/]+\\.)?")
- // process anchor at expression start
- .replace(/^\\\|/, "^")
- // process anchor at expression end
- .replace(/\\\|$/, "$")
- // remove leading wildcards
- .replace(/^(\.\*)/, "")
- // remove trailing wildcards
- .replace(/(\.\*)$/, "");
-}
-
-if (typeof exports != "undefined")
- exports.filterToRegExp = filterToRegExp;