From b9c609f23dc3a95b9e6e03330c3ada7895b69158 Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Wed, 9 Mar 2016 07:43:55 +0100 Subject: [PATCH] Clarify the blacklist option - Improve wording in the Add-ons Manager. Explicitly say that the list is space separated, since several users had problems with that. - Add default example blacklist patterns. It's much easier to adapt an example than to write something from scratch (or copy-paste). The default patterns are for example.com and example.org which are reserved for documentation purposes, so it doesn't matter that those get blacklisted by default. See #704. --- documentation/api.md | 2 +- extension/lib/defaults.coffee | 2 +- extension/lib/migrations.coffee | 13 +++++++++++++ extension/lib/parse-prefs.coffee | 2 +- extension/lib/vim.coffee | 2 +- extension/locale/de/vimfx.properties | 4 ++-- extension/locale/en-US/vimfx.properties | 4 ++-- extension/locale/es/vimfx.properties | 4 ++-- extension/locale/fr/vimfx.properties | 4 ++-- extension/locale/id/vimfx.properties | 4 ++-- extension/locale/it/vimfx.properties | 4 ++-- extension/locale/ja/vimfx.properties | 4 ++-- extension/locale/nl/vimfx.properties | 4 ++-- extension/locale/pt-BR/vimfx.properties | 4 ++-- extension/locale/ru/vimfx.properties | 4 ++-- extension/locale/sv-SE/vimfx.properties | 4 ++-- extension/locale/zh-CN/vimfx.properties | 4 ++-- extension/locale/zh-TW/vimfx.properties | 4 ++-- extension/test/test-api.coffee | 10 +++++----- 19 files changed, 48 insertions(+), 35 deletions(-) diff --git a/documentation/api.md b/documentation/api.md index 08d5655..f908fbe 100644 --- a/documentation/api.md +++ b/documentation/api.md @@ -679,7 +679,7 @@ question; they are _parsed_ (`parse(vimfx.get(pref))`): - Space-separated prefs are parsed into arrays of strings. -- `black_list` and `{prev,next}_patterns` are parsed into arrays of regular +- `blacklist` and `{prev,next}_patterns` are parsed into arrays of regular expressions. (See [parse-prefs.coffee] for all details.) diff --git a/extension/lib/defaults.coffee b/extension/lib/defaults.coffee index 9bd30f9..80aecd5 100644 --- a/extension/lib/defaults.coffee +++ b/extension/lib/defaults.coffee @@ -132,7 +132,7 @@ options = 'hint_chars': 'fjdkslaghrueiwovncm' 'prev_patterns': 'prev previous ‹ « ◀ ← << < back newer' 'next_patterns': 'next › » ▶ → >> > more older' - 'black_list': '' + 'blacklist': '*example.com* http://example.org/editor/*' 'prevent_autofocus': false 'ignore_keyboard_layout': false 'timeout': 2000 diff --git a/extension/lib/migrations.coffee b/extension/lib/migrations.coffee index 55fb169..05f452e 100644 --- a/extension/lib/migrations.coffee +++ b/extension/lib/migrations.coffee @@ -150,4 +150,17 @@ migrations[4] = -> return unless prefs.has(pref) prefs.set('scroll.last_position_mark', prefs.get(pref)) +# The reasons for this migration are: +# +# - Make sure that people who have edited the pref and then blanked it out get +# the new default. +# - Try to help users who thought that the list was comma separated. +# - Rename to `blacklist`. +migrations[5] = -> + pref = 'black_list' + return unless prefs.has(pref) + oldValue = prefs.get(pref).trim() + unless oldValue == '' + prefs.set('blacklist', oldValue.replace(/,(?:\s+|(?=\*))/g, ' ')) + module.exports = migrations diff --git a/extension/lib/parse-prefs.coffee b/extension/lib/parse-prefs.coffee index ac649c9..513a967 100644 --- a/extension/lib/parse-prefs.coffee +++ b/extension/lib/parse-prefs.coffee @@ -80,7 +80,7 @@ parsers = { prev_patterns: parsePatterns next_patterns: parsePatterns - black_list: (value) -> + blacklist: (value) -> result = parseSpaceDelimitedString(value) result.parsed = result.parsed.map((pattern) -> return ///^#{utils.regexEscape(pattern).replace(/\\\*/g, '.*')}$///i diff --git a/extension/lib/vim.coffee b/extension/lib/vim.coffee index 85c86db..dbc2b17 100644 --- a/extension/lib/vim.coffee +++ b/extension/lib/vim.coffee @@ -89,7 +89,7 @@ class Vim scrollableElements: new ScrollableElements(@window) } - _isBlacklisted: (url) -> @options.black_list.some((regex) -> regex.test(url)) + _isBlacklisted: (url) -> @options.blacklist.some((regex) -> regex.test(url)) isUIEvent: (event) -> return not @_state.frameCanReceiveEvents or diff --git a/extension/locale/de/vimfx.properties b/extension/locale/de/vimfx.properties index 23f06eb..5a2b999 100644 --- a/extension/locale/de/vimfx.properties +++ b/extension/locale/de/vimfx.properties @@ -132,8 +132,8 @@ notification.reload_config_file.failure=Error reloading config file; check the b pref.hint_chars.title=Zeichen für Hinweise pref.hint_chars.desc= -pref.black_list.title=Schwarze Liste -pref.black_list.desc=URLs, bei denen VimFx automatisch in den Ignoriermodus gehen soll. Als Platzhalter kann * verwendet werden. Beispiele: *example.com* http://example.org/editor/* +pref.blacklist.title=Schwarze Liste +pref.blacklist.desc=List of URLs where VimFx should automatically enter Ignore mode. Use spaces as delimiter and * as a wildcard. pref.prev_patterns.title="Vorheriger" Link Muster pref.prev_patterns.desc= diff --git a/extension/locale/en-US/vimfx.properties b/extension/locale/en-US/vimfx.properties index 39bdc7e..afee387 100644 --- a/extension/locale/en-US/vimfx.properties +++ b/extension/locale/en-US/vimfx.properties @@ -132,8 +132,8 @@ notification.reload_config_file.failure=Error reloading config file; check the b pref.hint_chars.title=Hint chars pref.hint_chars.desc= -pref.black_list.title=Blacklist -pref.black_list.desc=URLs where VimFx should automatically enter Ignore mode. You may use * as a wildcard. Example: *example.com* http://example.org/editor/*. +pref.blacklist.title=Blacklist +pref.blacklist.desc=List of URLs where VimFx should automatically enter Ignore mode. Use spaces as delimiter and * as a wildcard. pref.prev_patterns.title=“Previous” link patterns pref.prev_patterns.desc= diff --git a/extension/locale/es/vimfx.properties b/extension/locale/es/vimfx.properties index e454d04..23e4562 100644 --- a/extension/locale/es/vimfx.properties +++ b/extension/locale/es/vimfx.properties @@ -132,8 +132,8 @@ notification.reload_config_file.failure=Error reloading config file; check the b pref.hint_chars.title=Caracteres de indicación pref.hint_chars.desc= -pref.black_list.title=Lista negra -pref.black_list.desc=URLs donde VimFx debe entrar automáticamente en modo Ignorar. Puede usar * como comodín. Ejemplo: *ejemplo.com* http://ejemplo.org/editor/*. +pref.blacklist.title=Lista negra +pref.blacklist.desc=List of URLs where VimFx should automatically enter Ignore mode. Use spaces as delimiter and * as a wildcard. pref.prev_patterns.title=Patrones de enlaces tipo “Anterior" pref.prev_patterns.desc= diff --git a/extension/locale/fr/vimfx.properties b/extension/locale/fr/vimfx.properties index 8bb52da..0930648 100644 --- a/extension/locale/fr/vimfx.properties +++ b/extension/locale/fr/vimfx.properties @@ -132,8 +132,8 @@ notification.reload_config_file.failure=Error reloading config file; check the b pref.hint_chars.title=Marqueurs de liens pref.hint_chars.desc= -pref.black_list.title=Liste noire -pref.black_list.desc=URLs pour lesquelles VimFx devrait automatiquement entrer en mode « Ignorer ». Vous pouvez utiliser « * » comme un joker. Exemple: *example.com* http://example.org/editor/*. +pref.blacklist.title=Liste noire +pref.blacklist.desc=List of URLs where VimFx should automatically enter Ignore mode. Use spaces as delimiter and * as a wildcard. pref.prev_patterns.title=“Previous” link patterns pref.prev_patterns.desc= diff --git a/extension/locale/id/vimfx.properties b/extension/locale/id/vimfx.properties index e295a8e..cfebe46 100644 --- a/extension/locale/id/vimfx.properties +++ b/extension/locale/id/vimfx.properties @@ -132,8 +132,8 @@ notification.reload_config_file.failure=Error reloading config file; check the b pref.hint_chars.title=Karakter Petunjuk pref.hint_chars.desc= -pref.black_list.title=Daftar Hitam -pref.black_list.desc=URL dimana VimFx harus masuk mode Abai secara otomatis. Anda dapat memakai * sebagai wildcard. Contoh: *example.com* http://example.org/editor/*. +pref.blacklist.title=Daftar Hitam +pref.blacklist.desc=List of URLs where VimFx should automatically enter Ignore mode. Use spaces as delimiter and * as a wildcard. pref.prev_patterns.title=“Previous” link patterns pref.prev_patterns.desc= diff --git a/extension/locale/it/vimfx.properties b/extension/locale/it/vimfx.properties index ed4fef4..3e9e9ab 100644 --- a/extension/locale/it/vimfx.properties +++ b/extension/locale/it/vimfx.properties @@ -132,8 +132,8 @@ notification.reload_config_file.failure=Error reloading config file; check the b pref.hint_chars.title=Caratteri di suggerimento pref.hint_chars.desc= -pref.black_list.title=Lista nera -pref.black_list.desc=Indirizzi per cui VimFx deve disattivarsi automaticamente (modalità Ignore). Puoi usare *come carattere jolly. Esempio: *esempio.com* http://esempio.org/editor/*. +pref.blacklist.title=Lista nera +pref.blacklist.desc=List of URLs where VimFx should automatically enter Ignore mode. Use spaces as delimiter and * as a wildcard. pref.prev_patterns.title=“Previous” link patterns pref.prev_patterns.desc= diff --git a/extension/locale/ja/vimfx.properties b/extension/locale/ja/vimfx.properties index 7cc012a..c419312 100644 --- a/extension/locale/ja/vimfx.properties +++ b/extension/locale/ja/vimfx.properties @@ -132,8 +132,8 @@ notification.reload_config_file.failure=設定ファイルの再読込みに失 pref.hint_chars.title=ヒント機能で使用する文字 pref.hint_chars.desc= -pref.black_list.title=ブラックリスト -pref.black_list.desc=このURLに合致すると、VimFXは自動的に無効モードになります。 *がワイルドカードとして使えます。 例: *example.com* http://example.org/editor/*. +pref.blacklist.title=ブラックリスト +pref.blacklist.desc=List of URLs where VimFx should automatically enter Ignore mode. Use spaces as delimiter and * as a wildcard. pref.prev_patterns.title=「前へ」リンクのパターン pref.prev_patterns.desc= diff --git a/extension/locale/nl/vimfx.properties b/extension/locale/nl/vimfx.properties index edccbe5..8dda279 100644 --- a/extension/locale/nl/vimfx.properties +++ b/extension/locale/nl/vimfx.properties @@ -132,8 +132,8 @@ notification.reload_config_file.failure=Error reloading config file; check the b pref.hint_chars.title=Gebruikte karakters pref.hint_chars.desc= -pref.black_list.title=Zwarte lijst -pref.black_list.desc=URL's waar VimFx automatisch in negeermodus moet gaan. De * kan gebruikt worden als wildcard. Voorbeeld: *example.com* http://example.org/editor/*. +pref.blacklist.title=Zwarte lijst +pref.blacklist.desc=List of URLs where VimFx should automatically enter Ignore mode. Use spaces as delimiter and * as a wildcard. pref.prev_patterns.title=“Previous” link patterns pref.prev_patterns.desc= diff --git a/extension/locale/pt-BR/vimfx.properties b/extension/locale/pt-BR/vimfx.properties index 79dc593..4da0c45 100644 --- a/extension/locale/pt-BR/vimfx.properties +++ b/extension/locale/pt-BR/vimfx.properties @@ -132,8 +132,8 @@ notification.reload_config_file.failure=Error reloading config file; check the b pref.hint_chars.title=Caracteres de Sugestão pref.hint_chars.desc= -pref.black_list.title=Lista Negra -pref.black_list.desc=URLs onde o VimFX deve entrar automaticamente no modo de Inserção. Você pode usar * como coringa. Exemplo: *example.com* http://example.org/editor/*. +pref.blacklist.title=Lista Negra +pref.blacklist.desc=List of URLs where VimFx should automatically enter Ignore mode. Use spaces as delimiter and * as a wildcard. pref.prev_patterns.title=“Previous” link patterns pref.prev_patterns.desc= diff --git a/extension/locale/ru/vimfx.properties b/extension/locale/ru/vimfx.properties index e2fcbd6..f687a72 100644 --- a/extension/locale/ru/vimfx.properties +++ b/extension/locale/ru/vimfx.properties @@ -132,8 +132,8 @@ notification.reload_config_file.failure=Error reloading config file; check the b pref.hint_chars.title=Символы на маркерах pref.hint_chars.desc= -pref.black_list.title=Стоп список -pref.black_list.desc=Список URL, где VimFx автоматически входит в режим игнорирования. Можно использовать * в качестве символа-джокера. Например: *example.com* http://example.org/editor/*. +pref.blacklist.title=Стоп список +pref.blacklist.desc=List of URLs where VimFx should automatically enter Ignore mode. Use spaces as delimiter and * as a wildcard. pref.prev_patterns.title=“Previous” link patterns pref.prev_patterns.desc= diff --git a/extension/locale/sv-SE/vimfx.properties b/extension/locale/sv-SE/vimfx.properties index dc528e6..69b6154 100644 --- a/extension/locale/sv-SE/vimfx.properties +++ b/extension/locale/sv-SE/vimfx.properties @@ -132,8 +132,8 @@ notification.reload_config_file.failure=Fel vid omladdning av config-fil; kolla pref.hint_chars.title=Etikettstecken pref.hint_chars.desc= -pref.black_list.title=Svartlista -pref.black_list.desc=URL:er där VimFx automatiskt ska gå in i Inmatningsläge. Du kan använda * som wildcard. Exempel: *example.com* http://example.org/editor/*. +pref.blacklist.title=Svartlista +pref.blacklist.desc=Lista med URL:er där VimFx automatiskt ska gå in i Ignoreringsläge. Använd mellanslag som avgränsare och * som wildcard. pref.prev_patterns.title=Mönster för ”Föregående”-länkar pref.prev_patterns.desc= diff --git a/extension/locale/zh-CN/vimfx.properties b/extension/locale/zh-CN/vimfx.properties index 9e72a8f..42df970 100644 --- a/extension/locale/zh-CN/vimfx.properties +++ b/extension/locale/zh-CN/vimfx.properties @@ -132,8 +132,8 @@ notification.reload_config_file.failure=Error reloading config file; check the b pref.hint_chars.title=提示符 pref.hint_chars.desc= -pref.black_list.title=黑名单 -pref.black_list.desc=当访问输入框中的 URL 时,VimFx 自动进入忽略模式。你可以使用 * 作为通配符。例如:*example.com* http://example.org/editor/* 。 +pref.blacklist.title=黑名单 +pref.blacklist.desc=List of URLs where VimFx should automatically enter Ignore mode. Use spaces as delimiter and * as a wildcard. pref.prev_patterns.title=匹配“上一页”链接 pref.prev_patterns.desc= diff --git a/extension/locale/zh-TW/vimfx.properties b/extension/locale/zh-TW/vimfx.properties index d23dd1d..ed8950a 100644 --- a/extension/locale/zh-TW/vimfx.properties +++ b/extension/locale/zh-TW/vimfx.properties @@ -132,8 +132,8 @@ notification.reload_config_file.failure=Error reloading config file; check the b pref.hint_chars.title=提示字元(Hint Chars) pref.hint_chars.desc=進入 Hints 模式時,用哪些符號進行標記。 -pref.black_list.title=黑名單 -pref.black_list.desc=VimFx 在哪些 URLs 中應該自動進入忽略模式。以 * 作為萬用字元,如: *example.com* http://example.org/editor/*. +pref.blacklist.title=黑名單 +pref.blacklist.desc=List of URLs where VimFx should automatically enter Ignore mode. Use spaces as delimiter and * as a wildcard. pref.prev_patterns.title=“Previous” link patterns pref.prev_patterns.desc= diff --git a/extension/test/test-api.coffee b/extension/test/test-api.coffee index 4d5cb49..e1dd6ec 100644 --- a/extension/test/test-api.coffee +++ b/extension/test/test-api.coffee @@ -44,7 +44,7 @@ exports['test vimfx.get and vimfx.set'] = (assert, $vimfx, teardown) -> vimfx = createConfigAPI($vimfx) resetHintChars = prefs.tmp('hint_chars', 'abcd') - resetBlacklist = prefs.tmp('black_list', null) + resetBlacklist = prefs.tmp('blacklist', null) originalOptions = Object.assign({}, $vimfx.options) teardown(-> resetHintChars?() @@ -53,20 +53,20 @@ exports['test vimfx.get and vimfx.set'] = (assert, $vimfx, teardown) -> ) assert.equal(vimfx.get('hint_chars'), 'abcd') - assert.ok(not prefs.has('black_list')) + assert.ok(not prefs.has('blacklist')) vimfx.set('hint_chars', 'xyz') assert.equal(vimfx.get('hint_chars'), 'xyz') - vimfx.set('black_list', 'test') - assert.equal(vimfx.get('black_list'), 'test') + vimfx.set('blacklist', 'test') + assert.equal(vimfx.get('blacklist'), 'test') vimfx.set('translations', {KeyQ: ['ö', 'Ö']}) assert.deepEqual(vimfx.get('translations'), {KeyQ: ['ö', 'Ö']}) $vimfx.emit('shutdown') assert.equal(vimfx.get('hint_chars'), 'abcd') - assert.ok(not prefs.has('black_list')) + assert.ok(not prefs.has('blacklist')) assert.deepEqual(vimfx.get('translations'), {}) exports['test vimfx.getDefault'] = (assert, $vimfx, teardown) -> -- 2.39.3