diff --git a/web/static/js/app.js b/web/static/js/app.js
index 05f2931..fbd5964 100644
--- a/web/static/js/app.js
+++ b/web/static/js/app.js
@@ -166,6 +166,7 @@ document.addEventListener('DOMContentLoaded', function () {
const downloadButton = document.getElementById('download');
const copyLinkButton = document.getElementById('copyLink');
const copyHttpTtsLinkButton = document.getElementById('copyHttpTtsLink');
+ const copyIfreetimeLinkButton = document.getElementById('copyIfreetimeLink'); // 新增元素引用
const audioPlayer = document.getElementById('audioPlayer');
const resultSection = document.getElementById('resultSection');
const charCount = document.getElementById('charCount');
@@ -384,6 +385,32 @@ document.addEventListener('DOMContentLoaded', function () {
window.open(httpTtsLink, '_blank')
});
+ // 复制爱阅记链接按钮点击事件
+ copyIfreetimeLinkButton.addEventListener('click', function () {
+ const text = "{{java.encodeURI(speakText)}}";
+ const voice = voiceSelect.value;
+ const displayName = voiceSelect.options[voiceSelect.selectedIndex].text;
+ const style = styleSelect.value;
+ const rate = "{{speakSpeed*4}}"
+ const pitch = pitchInput.value;
+ const apiKey = apiKeyInput.value.trim();
+
+ // 构建爱阅记链接
+ let ifreetimeLink = `${window.location.origin}${config.basePath}/ifreetime.json?&v=${voice}&r=${rate}&p=${pitch}&n=${displayName}`;
+
+ // 只有当style不为空时才添加
+ if (style) {
+ ifreetimeLink += `&s=${style}`;
+ }
+
+ // 添加API Key参数(如果有)
+ if (apiKey) {
+ ifreetimeLink += `&api_key=${apiKey}`;
+ }
+
+ window.open(ifreetimeLink, '_blank')
+ });
+
// 显示/隐藏API Key区域的按钮事件
if (toggleApiKeyButton) {
toggleApiKeyButton.addEventListener('click', function () {
@@ -681,10 +708,10 @@ function showCustomAlert(message, type = 'info', title = '', duration = 3000) {
iconSvg = '';
break;
case 'warning':
- iconSvg = '';
+ iconSvg = '';
break;
default: // info
- iconSvg = '';
+ iconSvg = '';
}
// 构建通知内容
diff --git a/web/templates/index.html b/web/templates/index.html
index b9a18d1..05ea30f 100644
--- a/web/templates/index.html
+++ b/web/templates/index.html
@@ -1154,6 +1154,16 @@
导入阅读
+
+