diff --git a/background/style-manager.js b/background/style-manager.js index 972a4772..69f52979 100644 --- a/background/style-manager.js +++ b/background/style-manager.js @@ -524,7 +524,7 @@ const styleManager = (() => { } function buildGlob(text) { - return '^' + escapeRegExp(text).replace(/\\?\*/g, m => m.length > 1 ? m : '.*') + '$'; + return '^' + escapeRegExp(text).replace(/\\\\\\\*|\\\*/g, m => m.length > 2 ? m : '.*') + '$'; } function getDomain(url) { diff --git a/popup/popup.js b/popup/popup.js index b22b1219..21185275 100644 --- a/popup/popup.js +++ b/popup/popup.js @@ -312,8 +312,8 @@ function createStyleElement(style) { $('.menu-button', entry).onclick = handleEvent.toggleMenu; - $('.exclude-by-domain-checkbox').onchange = e => handleEvent.toggleExclude(e, 'domain'); - $('.exclude-by-url-checkbox').onchange = e => handleEvent.toggleExclude(e, 'url'); + $('.exclude-by-domain-checkbox', entry).onchange = e => handleEvent.toggleExclude(e, 'domain'); + $('.exclude-by-url-checkbox', entry).onchange = e => handleEvent.toggleExclude(e, 'url'); } style = Object.assign(entry.styleMeta, style); @@ -380,10 +380,10 @@ Object.assign(handleEvent, { toggleExclude(event, type) { const entry = handleEvent.getClickedStyleElement(event); - if ($(`.exclude-by-${type}-checkbox`, entry).checked) { - API.removeExclusion(entry.styleMeta.id, getExcludeRule(type)); - } else { + if (event.target.checked) { API.addExclusion(entry.styleMeta.id, getExcludeRule(type)); + } else { + API.removeExclusion(entry.styleMeta.id, getExcludeRule(type)); } },