diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 594de71715..67776a9e05 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -420,6 +420,12 @@ "excludeStyleByUrlLabel": { "message": "Exclude the current URL" }, + "includeStyleByDomainLabel": { + "message": "Include the current domain" + }, + "includeStyleByUrlLabel": { + "message": "Include the current URL" + }, "exportLabel": { "message": "Export", "description": "Label for the button to export a style (editor) or all styles (style manager)" diff --git a/src/background/style-manager/matcher.js b/src/background/style-manager/matcher.js index 1bb9a42bba..ddabde1cdb 100644 --- a/src/background/style-manager/matcher.js +++ b/src/background/style-manager/matcher.js @@ -46,9 +46,6 @@ function urlMatchExclusion(e) { export function urlMatchStyle(query, style) { let ovr; - if ((ovr = style.exclusions) && ovr.some(urlMatchExclusion, query)) { - return 'excluded'; - } if (!style.enabled) { return 'disabled'; } @@ -58,6 +55,9 @@ export function urlMatchStyle(query, style) { if ((ovr = style.inclusions) && ovr.some(urlMatchExclusion, query)) { return 'included'; } + if ((ovr = style.exclusions) && ovr.some(urlMatchExclusion, query)) { + return 'excluded'; + } return true; } diff --git a/src/popup.html b/src/popup.html index 143b477164..7eebc0241e 100644 --- a/src/popup.html +++ b/src/popup.html @@ -117,6 +117,8 @@
+ +
diff --git a/src/popup/events.js b/src/popup/events.js index c78685691b..f2caaee643 100644 --- a/src/popup/events.js +++ b/src/popup/events.js @@ -7,6 +7,7 @@ import * as hotkeys from './hotkeys'; const menu = $id('menu'); const menuExclusions = []; +const menuInclusions = []; export function configure(event, entry) { if (!this.target) { @@ -142,6 +143,16 @@ function menuInit() { API.styles.toggleOverride(menu.styleId, rule, false, input.checked); }; } + for (const el of $$('[data-include]')) { + const input = el.$('input'); + const rule = u.origin + + (el.dataset.include === 'domain' ? '/*' : u.pathname.replace(/\*/g, '\\*')); + menuInclusions.push({el, input, rule}); + input.onchange = () => { + el.classList.toggle('enabled', input.checked); + API.styles.toggleOverride(menu.styleId, rule, true, input.checked); + }; + } } function menuHide() {