Implement YouTube cookie source management and event listeners
This commit is contained in:
@@ -538,9 +538,19 @@ window.addEventListener('DOMContentLoaded', async () => {
|
||||
settingsDialog.hidden = true;
|
||||
}
|
||||
|
||||
await refreshYoutubeCookieSourceOptions();
|
||||
|
||||
whisperCheckbox.checked = localStorage.getItem('useWhisper') === '0' ? false : true;
|
||||
autoTranslateCheckbox.checked = localStorage.getItem('autoTranslate') === '1' ? true : false;
|
||||
discordWebhookInput.value = getDiscordWebhookUrl();
|
||||
applySourceToFields(
|
||||
loadYoutubeCookieSource(),
|
||||
youtubeCookieSourceSelect,
|
||||
youtubeCookieProfileInput,
|
||||
youtubeCookieContainerInput,
|
||||
youtubeCookieKeyringSelect,
|
||||
youtubeCookieFileInput
|
||||
);
|
||||
masterPromptTextarea.value = getMasterPrompt();
|
||||
translationPromptDeTextarea.value = getTranslationPrompt('de');
|
||||
translationPromptJpTextarea.value = getTranslationPrompt('jp');
|
||||
@@ -559,6 +569,40 @@ window.addEventListener('DOMContentLoaded', async () => {
|
||||
localStorage.removeItem('discordWebhookUrl');
|
||||
}
|
||||
});
|
||||
youtubeCookieSourceSelect.addEventListener('change', () => {
|
||||
updateCookieFieldVisibility(
|
||||
youtubeCookieSourceSelect,
|
||||
youtubeCookieProfileInput,
|
||||
youtubeCookieContainerInput,
|
||||
youtubeCookieKeyringSelect,
|
||||
youtubeCookieFileInput
|
||||
);
|
||||
saveSettingsCookieSource();
|
||||
});
|
||||
youtubeCookieProfileInput.addEventListener('input', saveSettingsCookieSource);
|
||||
youtubeCookieContainerInput.addEventListener('input', saveSettingsCookieSource);
|
||||
youtubeCookieKeyringSelect.addEventListener('change', saveSettingsCookieSource);
|
||||
youtubeCookieFileInput.addEventListener('input', saveSettingsCookieSource);
|
||||
clearYoutubeCookieSourceButton.addEventListener('click', () => {
|
||||
saveYoutubeCookieSource(null);
|
||||
applySourceToFields(
|
||||
null,
|
||||
youtubeCookieSourceSelect,
|
||||
youtubeCookieProfileInput,
|
||||
youtubeCookieContainerInput,
|
||||
youtubeCookieKeyringSelect,
|
||||
youtubeCookieFileInput
|
||||
);
|
||||
});
|
||||
cookieSourceSelect.addEventListener('change', () => {
|
||||
updateCookieFieldVisibility(
|
||||
cookieSourceSelect,
|
||||
cookieProfileInput,
|
||||
cookieContainerInput,
|
||||
cookieKeyringSelect,
|
||||
cookieFileInput
|
||||
);
|
||||
});
|
||||
masterPromptTextarea.addEventListener('input', () => {
|
||||
localStorage.setItem('masterPrompt', masterPromptTextarea.value);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user