diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 87a5a533..c8368fad 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -321,9 +321,6 @@ "excludeStyleByUrlLabel": { "message": "Exclude the current URL" }, - "excludeStyleByUrlRedundant": { - "message": "The current URL is the domain page" - }, "exportLabel": { "message": "Export", "description": "Label for the button to export a style ('edit' page) or all styles ('manage' page)" diff --git a/popup/popup.js b/popup/popup.js index 64b04f68..43d1e228 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -335,16 +335,7 @@ function createStyleElement(style) { entry.classList.toggle('regexp-partial', style.sloppy); $('.exclude-by-domain-checkbox', entry).checked = styleExcluded(style, 'domain'); - - const excludeByUrlCheckbox = $('.exclude-by-url-checkbox', entry); - const isRedundant = getExcludeRule('domain') === getExcludeRule('url'); - excludeByUrlCheckbox.checked = !isRedundant && styleExcluded(style, 'url'); - excludeByUrlCheckbox.disabled = isRedundant; - - const excludeByUrlLabel = $('.exclude-by-url', entry); - excludeByUrlLabel.classList.toggle('disabled', isRedundant); - excludeByUrlLabel.title = isRedundant ? - chrome.i18n.getMessage('excludeStyleByUrlRedundant') : ''; + $('.exclude-by-url-checkbox', entry).checked = styleExcluded(style, 'url'); return entry; } @@ -358,10 +349,16 @@ function styleExcluded({exclusions}, type) { } function getExcludeRule(type) { + const u = new URL(tabURL); if (type === 'domain') { - return new URL(tabURL).origin + '/*'; + return u.origin + '/*'; } - return tabURL + '*'; + // current page + return escapeGlob(u.origin + u.pathname); +} + +function escapeGlob(text) { + return text.replace(/\*/g, '\\*'); } Object.assign(handleEvent, {