feat: refactor event handling and clean up TTS request parameters
This commit is contained in:
@@ -509,7 +509,6 @@ func (h *TTSHandler) HandleReader(context *gin.Context) {
|
|||||||
func (h *TTSHandler) HandleIFreeTime(context *gin.Context) {
|
func (h *TTSHandler) HandleIFreeTime(context *gin.Context) {
|
||||||
// 从URL参数获取
|
// 从URL参数获取
|
||||||
req := models.TTSRequest{
|
req := models.TTSRequest{
|
||||||
Text: context.Query("t"),
|
|
||||||
Voice: context.Query("v"),
|
Voice: context.Query("v"),
|
||||||
Rate: context.Query("r"),
|
Rate: context.Query("r"),
|
||||||
Pitch: context.Query("p"),
|
Pitch: context.Query("p"),
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 添加风格选择变化事件
|
// 添加风格选择变化事件
|
||||||
styleSelect.addEventListener('change', function() {
|
styleSelect.addEventListener('change', function () {
|
||||||
// 保存风格选择
|
// 保存风格选择
|
||||||
localStorage.setItem('ttsStyle', this.value);
|
localStorage.setItem('ttsStyle', this.value);
|
||||||
});
|
});
|
||||||
@@ -387,11 +387,10 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
|
|
||||||
// 复制爱阅记链接按钮点击事件
|
// 复制爱阅记链接按钮点击事件
|
||||||
copyIfreetimeLinkButton.addEventListener('click', function () {
|
copyIfreetimeLinkButton.addEventListener('click', function () {
|
||||||
const text = "{{java.encodeURI(speakText)}}";
|
|
||||||
const voice = voiceSelect.value;
|
const voice = voiceSelect.value;
|
||||||
const displayName = voiceSelect.options[voiceSelect.selectedIndex].text;
|
const displayName = voiceSelect.options[voiceSelect.selectedIndex].text;
|
||||||
const style = styleSelect.value;
|
const style = styleSelect.value;
|
||||||
const rate = "{{speakSpeed*4}}"
|
const rate = rateInput.value
|
||||||
const pitch = pitchInput.value;
|
const pitch = pitchInput.value;
|
||||||
const apiKey = apiKeyInput.value.trim();
|
const apiKey = apiKeyInput.value.trim();
|
||||||
|
|
||||||
@@ -679,6 +678,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
}, 300);
|
}, 300);
|
||||||
}, duration);
|
}, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加自定义alert函数到全局范围
|
// 添加自定义alert函数到全局范围
|
||||||
window.showCustomAlert = showCustomAlert;
|
window.showCustomAlert = showCustomAlert;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user