exact match pref should work for custom mode too

This commit is contained in:
Ray Lothian 2018-11-04 11:16:25 +01:00
parent 817c1a7fb1
commit ec1b8c1b41

View file

@ -211,7 +211,15 @@ function match({url, tabId}) {
} }
else { else {
const h = hostname(url); const h = hostname(url);
let s = prefs.custom[h] || prefs.custom['*']; const key = Object.keys(prefs.custom).filter(s => {
if (s === h) {
return true;
}
else if (prefs.exactMatch === false) {
return s.endsWith(h) || h.endsWith(s);
}
}).shift();
let s = prefs.custom[key] || prefs.custom['*'];
// if s is an array select a random string // if s is an array select a random string
if (Array.isArray(s)) { if (Array.isArray(s)) {
s = s[Math.floor(Math.random() * s.length)]; s = s[Math.floor(Math.random() * s.length)];