1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
This commit is contained in:
gnattu 2024-10-20 22:59:23 +08:00
parent 5b687f6a7d
commit a1acb57ce1

View file

@ -307,11 +307,7 @@ const UserParentalControl = () => {
}; };
// The following is still hacky and should migrate to pure react implementation for callbacks in the future // The following is still hacky and should migrate to pure react implementation for callbacks in the future
let allowedTagsPopupCallback: (() => void) | null = null; const accessSchedulesPopupCallback = function () {
let blockedTagsPopupCallback: (() => void) | null = null;
let accessSchedulesPopupCallback: (() => void) | null = null;
let formSubmissionCallback: ((e: Event) => void) | null = null;
accessSchedulesPopupCallback = function () {
showSchedulePopup({ showSchedulePopup({
Id: 0, Id: 0,
UserId: '', UserId: '',
@ -321,11 +317,11 @@ const UserParentalControl = () => {
}, -1); }, -1);
}; };
(page.querySelector('#btnAddSchedule') as HTMLButtonElement).addEventListener('click', accessSchedulesPopupCallback); (page.querySelector('#btnAddSchedule') as HTMLButtonElement).addEventListener('click', accessSchedulesPopupCallback);
allowedTagsPopupCallback = showAllowedTagPopup; const allowedTagsPopupCallback = showAllowedTagPopup;
(page.querySelector('#btnAddAllowedTag') as HTMLButtonElement).addEventListener('click', allowedTagsPopupCallback); (page.querySelector('#btnAddAllowedTag') as HTMLButtonElement).addEventListener('click', allowedTagsPopupCallback);
blockedTagsPopupCallback = showBlockedTagPopup; const blockedTagsPopupCallback = showBlockedTagPopup;
(page.querySelector('#btnAddBlockedTag') as HTMLButtonElement).addEventListener('click', blockedTagsPopupCallback); (page.querySelector('#btnAddBlockedTag') as HTMLButtonElement).addEventListener('click', blockedTagsPopupCallback);
formSubmissionCallback = onSubmit; const formSubmissionCallback = onSubmit;
(page.querySelector('.userParentalControlForm') as HTMLFormElement).addEventListener('submit', formSubmissionCallback); (page.querySelector('.userParentalControlForm') as HTMLFormElement).addEventListener('submit', formSubmissionCallback);
return () => { return () => {
@ -333,7 +329,7 @@ const UserParentalControl = () => {
(page.querySelector('#btnAddAllowedTag') as HTMLButtonElement).removeEventListener('click', allowedTagsPopupCallback); (page.querySelector('#btnAddAllowedTag') as HTMLButtonElement).removeEventListener('click', allowedTagsPopupCallback);
(page.querySelector('#btnAddBlockedTag') as HTMLButtonElement).removeEventListener('click', blockedTagsPopupCallback); (page.querySelector('#btnAddBlockedTag') as HTMLButtonElement).removeEventListener('click', blockedTagsPopupCallback);
(page.querySelector('.userParentalControlForm') as HTMLFormElement).removeEventListener('submit', formSubmissionCallback); (page.querySelector('.userParentalControlForm') as HTMLFormElement).removeEventListener('submit', formSubmissionCallback);
} };
}, [setAllowedTags, setBlockedTags, loadData, userId]); }, [setAllowedTags, setBlockedTags, loadData, userId]);
const optionMaxParentalRating = () => { const optionMaxParentalRating = () => {