diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 59b6436b..f2d2abe8 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -321,6 +321,9 @@ "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.css b/popup/popup.css index cb9b123c..bb3d4c49 100644 --- a/popup/popup.css +++ b/popup/popup.css @@ -367,6 +367,10 @@ a.configure[target="_blank"] .svg-icon.config { display: block; margin: 0 auto; } +.entry .menu-item.disabled { + opacity: 0.5; + background-color: transparent; +} /* checkbox */ .checkbox-container { diff --git a/popup/popup.js b/popup/popup.js index 5953143f..64b04f68 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -335,7 +335,16 @@ function createStyleElement(style) { entry.classList.toggle('regexp-partial', style.sloppy); $('.exclude-by-domain-checkbox', entry).checked = styleExcluded(style, 'domain'); - $('.exclude-by-url-checkbox', entry).checked = styleExcluded(style, 'url'); + + 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') : ''; return entry; }