From 43fd14f0a86fb3383a385deefe5ec6ab4f126ba0 Mon Sep 17 00:00:00 2001 From: Luna D Date: Thu, 6 Jun 2024 20:32:36 -0400 Subject: [PATCH] Convert staffhider to TypeScript --- assets/js/staffhider.js | 17 ----------------- assets/js/staffhider.ts | 13 +++++++++++++ assets/types/booru-object.d.ts | 4 ++++ 3 files changed, 17 insertions(+), 17 deletions(-) delete mode 100644 assets/js/staffhider.js create mode 100644 assets/js/staffhider.ts diff --git a/assets/js/staffhider.js b/assets/js/staffhider.js deleted file mode 100644 index 68b64447..00000000 --- a/assets/js/staffhider.js +++ /dev/null @@ -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 }; diff --git a/assets/js/staffhider.ts b/assets/js/staffhider.ts new file mode 100644 index 00000000..86741d78 --- /dev/null +++ b/assets/js/staffhider.ts @@ -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') { + $$('.js-staff-action').forEach(el => hideEl(el)); + } +} diff --git a/assets/types/booru-object.d.ts b/assets/types/booru-object.d.ts index 22d1aa08..2a5949c0 100644 --- a/assets/types/booru-object.d.ts +++ b/assets/types/booru-object.d.ts @@ -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 {