diff --git a/favicon.ico b/favicon.ico index 243dd4e..e59f109 100644 Binary files a/favicon.ico and b/favicon.ico differ diff --git a/images/favicon.ico b/images/favicon.ico new file mode 100644 index 0000000..243dd4e Binary files /dev/null and b/images/favicon.ico differ diff --git a/index.html b/index.html index 83692d7..82c939e 100644 --- a/index.html +++ b/index.html @@ -4,6 +4,7 @@ 智能提词器 + @@ -243,12 +244,5 @@ - - - - - - - \ No newline at end of file diff --git a/js/audio.js b/js/audio.js index b077bd8..37802d9 100644 --- a/js/audio.js +++ b/js/audio.js @@ -1,5 +1,5 @@ // 音频控制器 -class AudioController { +export class AudioController { constructor() { this.mediaRecorder = null; this.audioChunks = []; diff --git a/js/defaultText.js b/js/defaultText.js new file mode 100644 index 0000000..4ab8ca1 --- /dev/null +++ b/js/defaultText.js @@ -0,0 +1,12 @@ +// 默认文本内容模块 +export const defaultText = `我是一个提词器的示例文本。 +你可以直接编辑我,或者粘贴内容。 +也可以点击左侧功能区的文件夹图标,上传文件。 +需要是"*.txt"的文本文档格式。 +本项目支持翻转(水平、垂直) +在开始使用之前,请注意设置以下内容: +字体,字体大小,滚动速度 +项目已开源到Github,地址为 +https://github.com/Song2770/ez4prompt +如果你觉得好用,不妨为我的项目点一颗Star。 +如果你遇到了问题,欢迎留言。`; \ No newline at end of file diff --git a/js/flip.js b/js/flip.js index d9acb9b..d8d4989 100644 --- a/js/flip.js +++ b/js/flip.js @@ -1,5 +1,5 @@ // 翻转控制器 -class FlipController { +export class FlipController { constructor() { this.init(); } diff --git a/js/main.js b/js/main.js index e547964..bdffccc 100644 --- a/js/main.js +++ b/js/main.js @@ -1,3 +1,13 @@ +// 导入所有控制器模块 +import { ThemeController } from './theme.js'; +import { ScrollController } from './scroll.js'; +import { TextController } from './text.js'; +import { AudioController } from './audio.js'; +import { SettingsController } from './settings.js'; +import { WatermarkController } from './watermark.js'; +import { FlipController } from './flip.js'; +import { defaultText } from './defaultText.js'; + // 主应用程序入口 class TeleprompterApp { constructor() { @@ -13,6 +23,15 @@ class TeleprompterApp { } init() { + // 先初始化各个模块 + window.themeController = new ThemeController(); + window.scrollController = new ScrollController(); + window.textController = new TextController(); + window.audioController = new AudioController(); + window.settingsController = new SettingsController(); + window.watermarkController = new WatermarkController(); + window.flipController = new FlipController(); + this.setupEventListeners(); this.loadDefaultText(); this.updateTimeDisplay(); @@ -21,15 +40,6 @@ class TeleprompterApp { // 每秒更新时间显示 setInterval(() => this.updateTimeDisplay(), 1000); - - // 初始化各个模块 - window.themeController = new ThemeController(); - window.scrollController = new ScrollController(); - window.textController = new TextController(); - window.audioController = new AudioController(); - window.settingsController = new SettingsController(); - window.watermarkController = new WatermarkController(); - window.flipController = new FlipController(); } getDefaultSettings() { @@ -417,16 +427,12 @@ class TeleprompterApp { } loadDefaultText() { - fetch('example.txt') - .then(response => response.text()) - .then(text => { - window.textController.setText(text); - this.updateScrollbar(); - }) - .catch(error => { - console.error('加载默认文本失败:', error); - window.textController.setText('请导入文本文件或直接编辑此处内容。'); - }); + try { + window.textController.setText('我是一个提词器的示例文本。\n你可以直接编辑我,或者粘贴内容。\n可以点击左侧功能区的文件夹图标,上传文件。需要是"*.txt"的文本文档格式。\n本项目支持翻转(水平、垂直)\n在开始使用之前,请注意设置以下内容:字体,字体大小,滚动速度\n项目已开源到Github,地址为https://github.com/Song2770/ez4prompt\n如果你觉得好用,不妨为我的项目点一颗Star。\n如果你遇到了问题,欢迎留言。'); + this.updateScrollbar(); + } catch (error) { + console.error('加载默认文本失败:', error); + } } updateTimeDisplay() { diff --git a/js/scroll.js b/js/scroll.js index 1a92719..1536c9d 100644 --- a/js/scroll.js +++ b/js/scroll.js @@ -1,5 +1,5 @@ // 滚动控制器 -class ScrollController { +export class ScrollController { constructor() { this.isAutoScrolling = false; this.scrollSpeed = 30; diff --git a/js/settings.js b/js/settings.js index 79b7f9a..209abfc 100644 --- a/js/settings.js +++ b/js/settings.js @@ -1,5 +1,5 @@ // 设置控制器 -class SettingsController { +export class SettingsController { constructor() { this.init(); } diff --git a/js/text.js b/js/text.js index 3ee4295..dec7c8c 100644 --- a/js/text.js +++ b/js/text.js @@ -1,5 +1,5 @@ // 文本控制器 -class TextController { +export class TextController { constructor() { this.init(); } diff --git a/js/theme.js b/js/theme.js index e190a0d..b5204ad 100644 --- a/js/theme.js +++ b/js/theme.js @@ -1,5 +1,5 @@ // 主题控制器 -class ThemeController { +export class ThemeController { constructor() { this.currentTheme = 'dark'; this.init(); diff --git a/js/watermark.js b/js/watermark.js index ef8471c..db8d49f 100644 --- a/js/watermark.js +++ b/js/watermark.js @@ -1,5 +1,5 @@ // 水印控制器 -class WatermarkController { +export class WatermarkController { constructor() { this.init(); } diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..243dd4e Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/images/chevron-left.svg b/public/images/chevron-left.svg new file mode 100644 index 0000000..87bbf66 --- /dev/null +++ b/public/images/chevron-left.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/images/chevron-right.svg b/public/images/chevron-right.svg new file mode 100644 index 0000000..d003757 --- /dev/null +++ b/public/images/chevron-right.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/images/flip.svg b/public/images/flip.svg new file mode 100644 index 0000000..4131540 --- /dev/null +++ b/public/images/flip.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/font.svg b/public/images/font.svg new file mode 100644 index 0000000..dc11984 --- /dev/null +++ b/public/images/font.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/images/fullscreen.svg b/public/images/fullscreen.svg new file mode 100644 index 0000000..91b61d0 --- /dev/null +++ b/public/images/fullscreen.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/images/import.svg b/public/images/import.svg new file mode 100644 index 0000000..689c64d --- /dev/null +++ b/public/images/import.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/images/language.svg b/public/images/language.svg new file mode 100644 index 0000000..bcbd3b7 --- /dev/null +++ b/public/images/language.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/images/lock.svg b/public/images/lock.svg new file mode 100644 index 0000000..8ee3c20 --- /dev/null +++ b/public/images/lock.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/images/logo.svg b/public/images/logo.svg new file mode 100644 index 0000000..7e79f61 --- /dev/null +++ b/public/images/logo.svg @@ -0,0 +1,20 @@ + + + + + + + + + diff --git a/public/images/moon.svg b/public/images/moon.svg new file mode 100644 index 0000000..92de57e --- /dev/null +++ b/public/images/moon.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/images/pause.svg b/public/images/pause.svg new file mode 100644 index 0000000..058a27a --- /dev/null +++ b/public/images/pause.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/images/play.svg b/public/images/play.svg new file mode 100644 index 0000000..dfa0f41 --- /dev/null +++ b/public/images/play.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/images/record.svg b/public/images/record.svg new file mode 100644 index 0000000..6070079 --- /dev/null +++ b/public/images/record.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/images/scroll.svg b/public/images/scroll.svg new file mode 100644 index 0000000..37bc4b2 --- /dev/null +++ b/public/images/scroll.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/images/sun.svg b/public/images/sun.svg new file mode 100644 index 0000000..4c57d69 --- /dev/null +++ b/public/images/sun.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/images/theme.svg b/public/images/theme.svg new file mode 100644 index 0000000..3bea856 --- /dev/null +++ b/public/images/theme.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/images/unlock.svg b/public/images/unlock.svg new file mode 100644 index 0000000..172a81c --- /dev/null +++ b/public/images/unlock.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/public/images/watermark.svg b/public/images/watermark.svg new file mode 100644 index 0000000..9cd4a93 --- /dev/null +++ b/public/images/watermark.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 147380a..73841ed 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -7,4 +7,19 @@ export default defineConfig({ optimizeDeps: { exclude: ['lucide-react'], }, + build: { + assetsInlineLimit: 0, // 禁用资源内联,确保SVG文件作为独立文件 + rollupOptions: { + output: { + assetFileNames: (assetInfo) => { + // 保持SVG文件的原始路径结构 + if (assetInfo.name && assetInfo.name.endsWith('.svg')) { + return 'images/[name][extname]'; + } + return 'assets/[name]-[hash][extname]'; + } + } + } + }, + assetsInclude: ['**/*.svg'] });