diff --git a/README.md b/README.md index 31fb464..9cd73bf 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ The extension is based on the [Wet Banana extension](https://github.com/jedediah ### 2.15 -- Fix a bug where having an empty blacklist would disable the extension for `file:///` URLs. +- Fix a bug where having an empty blocklist would disable the extension for `file:///` URLs. ### 2.14 @@ -43,7 +43,7 @@ The extension is based on the [Wet Banana extension](https://github.com/jedediah ### 2.11 -- Add a blacklist, allowing users to disable scrolling on certain domains. +- Add a blocklist, allowing users to disable scrolling on certain domains. - Fixed a bug where settings in open multi-frame tabs were not updated. ### 2.10 diff --git a/src/background.js b/src/background.js index 6f6b680..38caf63 100644 --- a/src/background.js +++ b/src/background.js @@ -11,7 +11,7 @@ const defaultOptions = { notext: false, grab_and_drag: false, debug: false, - blacklist: '', + blocklist: '', browser_enabled: true, } @@ -52,6 +52,12 @@ async function getOptionsFromLocalStorage() { function sanitizeOptions(loadedOptions) { const sanitizedOptions = {} + + // Handle migration from blacklist to blocklist + if (loadedOptions.blacklist && !loadedOptions.blocklist) { + loadedOptions.blocklist = loadedOptions.blacklist + } + for (var key in defaultOptions) { if (typeof loadedOptions[key] == 'undefined') { sanitizedOptions[key] = defaultOptions[key] diff --git a/src/content.js b/src/content.js index 6d5c2fb..361b2a9 100644 --- a/src/content.js +++ b/src/content.js @@ -9,7 +9,7 @@ var ScrollbarAnywhere = (function () { options.notext = isTrue(options.notext) options.grab_and_drag = isTrue(options.grab_and_drag) options.debug = isTrue(options.debug) - options.enabled = isEnabled(options.blacklist) + options.enabled = isEnabled(options.blocklist) options.browser_enabled = isTrue(options.browser_enabled) debug('Loaded options: ', options) } @@ -36,17 +36,17 @@ var ScrollbarAnywhere = (function () { return value == true || value == 'true' } - function isEnabled(blacklist) { - if (!blacklist) { + function isEnabled(blocklist) { + if (!blocklist) { return true } - var blacklistedHosts = blacklist.split('\n') + var blocklistedHosts = blocklist.split('\n') var hostname = document.location.hostname - for (var i = blacklistedHosts.length - 1; i >= 0; i--) { - var blacklistedHost = blacklistedHosts[i].trim() + for (var i = blocklistedHosts.length - 1; i >= 0; i--) { + var blocklistedHost = blocklistedHosts[i].trim() if ( - hostname === blacklistedHost || - hostname.endsWith('.' + blacklistedHost) + hostname === blocklistedHost || + hostname.endsWith('.' + blocklistedHost) ) { return false } @@ -664,7 +664,7 @@ var ScrollbarAnywhere = (function () { blockContextMenu = false if (!options.enabled) { - debug('blacklisted domain, ignoring') + debug('blocklisted domain, ignoring') return true } diff --git a/src/offscreen.js b/src/offscreen.js index 5097f07..fde1d0b 100644 --- a/src/offscreen.js +++ b/src/offscreen.js @@ -16,7 +16,8 @@ document.addEventListener('DOMContentLoaded', () => { notext: boolean, grab_and_drag: boolean, debug: boolean, - blacklist: string, + blacklist: string, // Legacy key for backward compatibility + blocklist: string, browser_enabled: boolean, } @@ -35,6 +36,12 @@ document.addEventListener('DOMContentLoaded', () => { } } }) + + // Handle migration from blacklist to blocklist + if (options.blacklist && !options.blocklist) { + options.blocklist = options.blacklist + } + return options } diff --git a/src/options.html b/src/options.html index e86f022..17ac207 100644 --- a/src/options.html +++ b/src/options.html @@ -191,12 +191,12 @@