Convert staffhider to TypeScript

This commit is contained in:
Luna D 2024-06-06 20:32:36 -04:00 committed by Liam
parent d8fd98ea27
commit 43fd14f0a8
3 changed files with 17 additions and 17 deletions

View file

@ -1,17 +0,0 @@
/**
* StaffHider
*
* Hide staff elements if enabled in the settings.
*/
import { $$ } from './utils/dom';
function hideStaffTools() {
if (window.booru.hideStaffTools === 'true') {
$$('.js-staff-action').forEach(el => {
el.classList.add('hidden');
});
}
}
export { hideStaffTools };

13
assets/js/staffhider.ts Normal file
View file

@ -0,0 +1,13 @@
/**
* StaffHider
*
* Hide staff elements if enabled in the settings.
*/
import { $$, hideEl } from './utils/dom';
export function hideStaffTools() {
if (window.booru.hideStaffTools === 'true') {
$$<HTMLElement>('.js-staff-action').forEach(el => hideEl(el));
}
}

View file

@ -65,6 +65,10 @@ interface BooruObject {
spoileredFilter: AstMatcher;
tagsVersion: number;
interactions: Interaction[];
/**
* Indicates whether sensitive staff-only info should be hidden or not.
*/
hideStaffTools: string;
}
declare global {