' + (words.length ? 'No words match.' : 'No words added yet.') + '
';
document.getElementById('listRange').textContent = rows.length ? (listStart + 1) + '–' + (listStart + shown.length) + ' of ' + rows.length : '';
@@ -114,8 +118,9 @@
addForm.addEventListener('click', function (e) { var b = e.target.closest('button[data-list]'); if (b) addList = b.dataset.list; });
addForm.addEventListener('submit', function (e) {
e.preventDefault();
- var word = addWord.value.trim();
+ var word = addWord.value.trim().replace(/\s+/g, ' ');
if (!word) return;
+ if (addList === 'allowed' && isPhrase(word)) { toast('Phrases can only be blocked: normal chat checks each word on its own, so allow the words instead', 'warning'); return; }
confirmAdd(word, addList === 'allowed').then(function (done) { if (done) addWord.value = ''; });
});
@@ -129,7 +134,7 @@
var parts = [d.inAllowFile ? 'in chatplus_en_us.txt' : 'not in chatplus_en_us.txt'];
if (d.inBlockFile) parts.push('in blocklist.dcf');
parts.push(d.dashboard ? (d.dashboard === 'blocked' ? 'on the Blocked list' : 'on the Allowed list') : 'on neither staff list');
- return '' + esc(d.word) + ' now: ' + esc(parts.join(', ')) + '.';
+ return '' + esc(d.word) + '' + phraseBadge(d.word) + ' now: ' + esc(parts.join(', ')) + '.';
}
function openConfirm(options) {
@@ -186,7 +191,8 @@
function confirmAdd(word, allowed) {
var p = openConfirm({
title: (allowed ? 'Allow "' : 'Block "') + word + '"?',
- text: allowed ? 'Players may use it in normal chat. Running worlds apply it at once.' : 'It is stopped in all chat, even where a word file allows it. Running worlds apply it at once.',
+ text: allowed ? 'Players may use it in normal chat. Running worlds apply it at once.'
+ : (isPhrase(word) ? 'The phrase is stopped in all chat when its words come in a row. Running worlds apply it at once.' : 'It is stopped in all chat, even where a word file allows it. Running worlds apply it at once.'),
tone: allowed ? 'success' : 'danger',
button: allowed ? 'Allow' : 'Block',
run: function () { return api.action('/api/chat_filter/words', { word: word, allowed: allowed }).then(function (d) { toast(d.message, 'success'); }); }
@@ -228,8 +234,11 @@
? esc(d.allowTotal) + ' words normal chat may use (from the client); ' + esc(d.onDashboard) + ' are on a staff list too, which wins.'
: 'could not be read. Set client_location.') + '' +
'
' + esc(d.blockFile) + ': ' + (d.blockFileFound
- ? esc(d.blockTotal) + ' words best friends\' free chat may not use. Stored as hashes, so they can\'t be listed; test a word to see if it is one.'
- : 'not found next to the servers, so best friends\' free chat stops everything.') + '
';
+ ? esc(d.blockTotal) + ' words' + (d.blockMaxWords > 1 ? ' and phrases (up to ' + esc(d.blockMaxWords) + ' words)' : '') + ' best friends\' free chat may not use. Stored as hashes, so they can\'t be listed; test a word or phrase to see if it is one.'
+ : d.blockFileOld
+ ? 'in the old format (its hashes depended on the platform), so the servers can\'t read it and best friends\' free chat stops everything.'
+ : 'not found next to the servers (' + esc(d.blockFileStatus) + '), so best friends\' free chat stops everything.') +
+ ' To change it, put the words in ' + esc(d.blockText) + ' next to the servers (one word or phrase per line) and start the servers again; they build ' + esc(d.blockFile) + ' from it.';
document.getElementById('fileWords').innerHTML = d.words.map(function (w) {
var cls = w.dashboard === 'blocked' ? 'text-bg-danger' : w.dashboard === 'allowed' ? 'text-bg-success' : 'text-bg-secondary';
return '';
diff --git a/dDashboardServer/templates/chat_filter.jinja2 b/dDashboardServer/templates/chat_filter.jinja2
index c281b27ea..7caae932d 100644
--- a/dDashboardServer/templates/chat_filter.jinja2
+++ b/dDashboardServer/templates/chat_filter.jinja2
@@ -54,12 +54,12 @@
-
Blocked
Stopped in all chat, even if a word file allows it.
-
Allowed
Usable in normal chat, like the words in chatplus_en_us.txt.
+
Blocked
Stopped in all chat, even if a word file allows it. A phrase (several words) is stopped when its words come in a row, whatever the spaces and punctuation between them.
+
Allowed
Usable in normal chat, like the words in chatplus_en_us.txt. Single words only: normal chat checks each word on its own, as the client does.