diff --git a/common.js b/common.js
index fe0b4a0..bbee2e4 100644
--- a/common.js
+++ b/common.js
@@ -14,7 +14,8 @@ var prefs = {
custom: {},
mode: 'blacklist',
color: '#ffa643',
- cache: true
+ cache: true,
+ exactMatch: false
};
chrome.storage.local.get(prefs, ps => {
Object.assign(prefs, ps);
@@ -160,13 +161,27 @@ function match({url, tabId}) {
if (prefs.mode === 'blacklist') {
if (prefs.blacklist.length) {
const h = hostname(url);
- return prefs.blacklist.some(s => s === h);
+ return prefs.blacklist.some(s => () => {
+ if (s === h) {
+ return true;
+ }
+ else if (prefs.exactMatch === false) {
+ return s.endsWith(h) || h.endsWith(s);
+ }
+ });
}
}
else if (prefs.mode === 'whitelist') {
if (prefs.whitelist.length) {
const h = hostname(url);
- return prefs.whitelist.some(s => s === h) === false;
+ return prefs.whitelist.some(s => {
+ if (s === h) {
+ return true;
+ }
+ else if (prefs.exactMatch === false) {
+ return s.endsWith(h) || h.endsWith(s);
+ }
+ }) === false;
}
else {
return true;
diff --git a/data/options/index.html b/data/options/index.html
index 6d3e285..2befbd8 100644
--- a/data/options/index.html
+++ b/data/options/index.html
@@ -45,6 +45,9 @@
|
+
+ |
+
|
diff --git a/data/options/index.js b/data/options/index.js
index 4fbf0bc..ba923a9 100644
--- a/data/options/index.js
+++ b/data/options/index.js
@@ -29,6 +29,7 @@ function save() {
}
chrome.storage.local.set({
+ exactMatch: document.getElementById('exactMatch').checked,
faqs: document.getElementById('faqs').checked,
cache: document.getElementById('cache').checked,
blacklist: prepare(document.getElementById('blacklist').value),
@@ -43,6 +44,7 @@ function save() {
function restore() {
chrome.storage.local.get({
+ exactMatch: false,
faqs: true,
cache: true,
mode: 'blacklist',
@@ -50,6 +52,7 @@ function restore() {
blacklist: [],
custom: {}
}, prefs => {
+ document.getElementById('exactMatch').checked = prefs.exactMatch;
document.getElementById('faqs').checked = prefs.faqs;
document.getElementById('cache').checked = prefs.cache;
document.querySelector(`[name="mode"][value="${prefs.mode}"`).checked = true;