Merge pull request #278 from philomena-dev/ts-staffhider

Convert staffhider to TypeScript
This commit is contained in:
liamwhite 2024-06-08 23:05:36 -04:00 committed by GitHub
commit 2dfacd6eac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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 {