Implement "except" mode for type-specific controls in settings

This commit is contained in:
Cohee
2024-12-13 20:58:16 +02:00
parent 3167019faf
commit cd0b834291
2 changed files with 17 additions and 9 deletions

View File

@@ -838,7 +838,14 @@ jQuery(function () {
function showTypeSpecificControls(type) {
$('[data-tg-type]').each(function () {
const mode = String($(this).attr('data-tg-type-mode') ?? '').toLowerCase().trim();
const tgTypes = $(this).attr('data-tg-type').split(',').map(x => x.trim());
if (mode === 'except') {
$(this)[tgTypes.includes(type) ? 'hide' : 'show']();
return;
}
for (const tgType of tgTypes) {
if (tgType === type || tgType == 'all') {
$(this).show();