Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
358 lines (338 loc) · 19.7 KB
/
Copy pathindex.html
File metadata and controls
358 lines (338 loc) · 19.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<!doctype html>
<html lang="zh-Hant" data-scheme="light">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>EPUB 簡繁轉換</title>
<meta name="description" content="EPUB 的簡繁轉換線上工具。支援檔案拖放,且選擇檔案後即刻開始轉換。另外,一切都在瀏覽器中直接進行,數秒內即可完成轉換。">
<meta name="keywords" content="epub,EPUB,chinese,ebook,電子書,簡體,繁體,簡繁轉換,簡轉繁,簡體轉繁體,線上工具,線上轉換,繁體中文,簡體中文,繁簡轉換,繁轉簡,繁體轉簡體,OpenCC">
<meta name="theme-color" content="#ffffff">
<link rel="manifest" href="manifest.webmanifest">
<link rel="icon" href="static/icons/app-icon.svg" type="image/svg+xml">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&family=Noto+Sans+TC:wght@400;500;700&display=swap">
<link rel="stylesheet" href="vendor/tocas/tocas.min.css">
<link rel="stylesheet" href="static/main.css">
<script src="vendor/tocas/tocas.min.js"></script>
<script src="vendor/vue/vue.global.prod.js"></script>
<script type="module" src="static/app.js"></script>
</head>
<body>
<div id="app" v-cloak>
<header class="ts-header is-center-aligned is-huge">
<div class="ts-content is-padded">EPUB 簡繁轉換</div>
</header>
<main class="ts-app-center has-vertically-padded" id="main">
<div class="ts-container">
<details class="ts-accordion has-bottom-spaced" id="settings-details">
<summary>
<span class="ts-icon is-gears-icon is-end-spaced" aria-hidden="true"></span> {{ t("app.settings.title") }}
<span v-for="setting in settingsSummary" :key="setting" class="ts-chip is-small is-start-spaced">{{ setting }}</span>
<span class="ts-wrap is-compact is-middle-aligned summary-switches" @click.stop @keydown.stop>
<span class="ts-wrap is-compact is-middle-aligned fast-mode-summary">
<label class="ts-switch" tabindex="0">
<input type="checkbox" id="fast-mode-switch" v-model="fastMode" :disabled="isConverting" :aria-description="t('app.fastMode.help')">
{{ t("app.fastMode.label") }}
</label>
<span
class="ts-icon is-circle-question-icon"
tabindex="0"
role="button"
:aria-label="t('app.fastMode.help')"
:data-tooltip="t('app.fastMode.help')"
data-trigger="hover focus"
@click.stop.prevent="toggleTooltip"
@keydown.enter.prevent="toggleTooltip"
@keydown.space.prevent="toggleTooltip"
></span>
</span>
<span class="ts-wrap is-compact is-middle-aligned auto-download-summary">
<label class="ts-switch" tabindex="0">
<input type="checkbox" id="auto-download-switch" v-model="autoDownload" :disabled="isConverting" :aria-description="t('app.autoDownload.help')">
{{ t("app.autoDownload.label") }}
</label>
<span
class="ts-icon is-circle-question-icon"
tabindex="0"
role="button"
:aria-label="t('app.autoDownload.help')"
:data-tooltip="t('app.autoDownload.help')"
data-trigger="hover focus"
@click.stop.prevent="toggleTooltip"
@keydown.enter.prevent="toggleTooltip"
@keydown.space.prevent="toggleTooltip"
></span>
</span>
</span>
</summary>
<fieldset class="ts-fieldset">
<div class="ts-grid is-middle-aligned is-stackable mobile:is-stacked">
<div class="column is-4-wide">
<div class="ts-text is-label has-bottom-spaced-small" id="conversion-direction-label">{{ t("app.direction.label") }}</div>
<div class="ts-selection is-fluid" role="radiogroup" aria-labelledby="conversion-direction-label">
<label class="item">
<input type="radio" name="conversion-direction" :value="false" v-model="convertToSimplified" :disabled="isConverting">
<span class="text">{{ t("app.summary.s2t") }}</span>
</label>
<label class="item">
<input type="radio" name="conversion-direction" :value="true" v-model="convertToSimplified" :disabled="isConverting">
<span class="text">{{ t("app.summary.t2s") }}</span>
</label>
</div>
</div>
<div class="column is-8-wide">
<div class="ts-text is-label has-bottom-spaced-small" id="conversion-region-label">
{{ conversionRegionLabel }}
<span
class="ts-icon is-circle-question-icon is-start-spaced"
tabindex="0"
role="button"
:aria-label="conversionRegionHelp"
:data-tooltip="conversionRegionHelp"
data-trigger="hover focus"
@click.stop.prevent="toggleTooltip"
@keydown.enter.prevent="toggleTooltip"
@keydown.space.prevent="toggleTooltip"
></span>
</div>
<div class="ts-selection is-fluid" role="radiogroup" aria-labelledby="conversion-region-label" :aria-description="conversionRegionHelp">
<label class="item">
<input type="radio" name="conversion-region" value="standard" v-model="conversionRegion" :disabled="isConverting">
<span class="text"><span class="ts-icon is-globe-icon is-end-spaced" aria-hidden="true"></span>{{ t("app.summary.region.standard") }}</span>
</label>
<label class="item">
<input type="radio" name="conversion-region" value="tw" v-model="conversionRegion" :disabled="isConverting">
<span class="text"><span class="ts-flag is-taiwan-flag is-end-spaced" aria-hidden="true"></span>{{ t("app.summary.region.tw") }}</span>
</label>
<label class="item">
<input type="radio" name="conversion-region" value="hk" v-model="conversionRegion" :disabled="isConverting">
<span class="text"><span class="ts-flag is-hong-kong-flag is-end-spaced" aria-hidden="true"></span>{{ t("app.summary.region.hk") }}</span>
</label>
</div>
</div>
<div class="column is-4-wide">
<span class="ts-wrap is-compact is-middle-aligned">
<label class="ts-switch" tabindex="0">
<input type="checkbox" id="word-conversion-switch" v-model="useWordConversion" :disabled="!wordConversionSupported || isConverting" :aria-description="wordConversionHelp">
{{ t("app.words.generic") }}
</label>
<span
class="ts-icon is-circle-question-icon"
tabindex="0"
role="button"
:aria-label="wordConversionHelp"
:data-tooltip="wordConversionHelp"
data-trigger="hover focus"
@click.stop.prevent="toggleTooltip"
@keydown.enter.prevent="toggleTooltip"
@keydown.space.prevent="toggleTooltip"
></span>
<template v-if="jiebaSupported">
<label class="ts-switch has-start-spaced-small" tabindex="0">
<input type="checkbox" id="jieba-switch" v-model="useJieba" :disabled="isConverting" :aria-description="jiebaHelp">
{{ t("app.jieba.label") }}
</label>
<span
class="ts-icon is-circle-question-icon"
tabindex="0"
role="button"
:aria-label="jiebaHelp"
:data-tooltip="jiebaHelp"
data-trigger="hover focus"
@click.stop.prevent="toggleTooltip"
@keydown.enter.prevent="toggleTooltip"
@keydown.space.prevent="toggleTooltip"
></span>
</template>
</span>
</div>
<div class="column is-8-wide">
<div class="ts-text is-label has-bottom-spaced-small" id="custom-dictionary-label">
{{ t("app.dictionary.title") }}
<span
class="ts-icon is-circle-question-icon is-start-spaced"
tabindex="0"
role="button"
:aria-label="t('app.dictionary.help')"
:data-tooltip="t('app.dictionary.help')"
data-trigger="hover focus"
@click.stop.prevent="toggleTooltip"
@keydown.enter.prevent="toggleTooltip"
@keydown.space.prevent="toggleTooltip"
></span>
</div>
<button class="ts-button is-secondary is-outlined is-start-icon" type="button" :disabled="isConverting" @click="openCustomDictionaryDialog">
<span class="ts-icon is-book-atlas-icon" aria-hidden="true"></span>
{{ t("app.dictionary.manage") }}
</button>
<span class="ts-text is-description has-start-spaced-small" aria-live="polite">{{ customDictionaryStatus }}</span>
</div>
</div>
</fieldset>
</details>
<section
class="ts-box is-hollowed"
id="dropzone"
:class="{ 'is-dragover': isDragover }"
:data-state="state"
aria-labelledby="file-heading"
@dragenter.prevent="onDragEnter"
@dragover.prevent
@dragleave.prevent="onDragLeave"
@drop.prevent="onDrop"
>
<input ref="fileInput" type="file" id="epub-file" accept=".epub,application/epub+zip" aria-describedby="file-description" multiple hidden @change="onFileChange">
<button v-if="hasFile" class="ts-close" id="reset-button" type="button" :aria-label="closeButtonLabel" @click="closeFilePanel"></button>
<div class="ts-blankslate is-large" :class="{ 'is-interactive': !isConverting }" id="file-panel" @click="openFilePicker">
<span :class="['ts-icon', fileIcon]" id="file-icon" aria-hidden="true"></span>
<div class="header" id="file-heading">{{ fileHeading }}</div>
<div class="description" id="file-description">{{ fileDescription }}</div>
<div v-if="canEditSelection && selectedBooks.length > 1" class="ts-wrap is-compact is-center-aligned selected-books" :aria-label="t('app.file.selectedBooks')" @click.stop>
<span v-for="(book, index) in selectedBooks" :key="book.id" class="ts-chip is-outlined">
<span class="selected-book-name" :title="book.name">{{ book.name }}</span>
<button class="ts-close is-small" type="button" :aria-label="t('app.file.remove', { filename: book.name })" @click.stop="removeSelectedFile(index)"></button>
</span>
</div>
<div v-if="hasFile && !isConverting" class="action ts-wrap is-center-aligned">
<button v-if="!downloads.length" class="ts-button is-start-icon" id="convert-button" type="button" @click="startConversion">
<span class="ts-icon is-wand-magic-sparkles-icon" aria-hidden="true"></span> {{ t("app.action.convert") }}
</button>
<a v-for="download in downloads" :key="download.url" class="ts-button is-secondary is-outlined is-start-icon" :href="download.url" :download="download.filename">
<span class="ts-icon is-download-icon" aria-hidden="true"></span> {{ download.filename }}
</a>
<button v-if="showDownloadAll" class="ts-button is-start-icon" id="download-all-button" type="button" @click="downloadAllSuccessful">
<span class="ts-icon is-download-icon" aria-hidden="true"></span> {{ t("app.action.downloadAll", { count: downloads.length }) }}
</button>
</div>
<div v-if="isConverting" class="action" id="progress-area">
<div class="ts-progress has-top-spaced" :class="[progressClass, { 'is-fast': fastMode }]" id="progress" role="progressbar" aria-valuemin="0" aria-valuemax="100" :aria-valuenow="progressPercent">
<div class="bar" :style="{ '--value': progressPercent }">
<div class="text" id="progress-value">{{ t("app.progress.percent", { percent: progressPercent }) }}</div>
</div>
</div>
<div class="ts-text is-secondary has-top-spaced-small" id="progress-label" aria-live="polite">
<span v-if="fastMode">{{ progressLabel }}</span>
<Transition v-else name="progress-filename" mode="out-in">
<span :key="progressLabel">{{ progressLabel }}</span>
</Transition>
</div>
</div>
</div>
<div class="symbol"><span class="ts-icon is-book-icon" aria-hidden="true"></span></div>
</section>
<div v-if="failures.length" class="ts-box is-negative is-top-indicated has-top-spaced" role="status">
<div class="ts-content">
<div class="ts-badge is-negative">{{ t("app.batch.failuresTitle", { count: failures.length }) }}</div>
<div class="content failure-list">
<div v-for="(failure, index) in failures" :key="`${failure.filename}-${index}`">{{ t("app.batch.failureItem", failure) }}</div>
</div>
</div>
</div>
</div>
</main>
<dialog ref="customDictionaryDialog" class="ts-modal is-large" id="custom-dictionary-dialog">
<div class="content">
<div class="ts-content is-padded">
<div class="ts-grid is-middle-aligned">
<div class="column is-fluid">
<div class="ts-header is-large is-heavy">{{ t("app.dictionary.dialogTitle") }}</div>
</div>
<div class="column">
<button class="ts-close is-end-aligned" type="button" :aria-label="t('app.dictionary.action.close')" @click="closeCustomDictionaryDialog"></button>
</div>
</div>
</div>
<div class="ts-divider"></div>
<div class="ts-content is-padded">
<label class="ts-switch">
<input type="checkbox" id="custom-dictionary-enabled" v-model="dictionaryDraftEnabled">
{{ t("app.dictionary.enabled") }}
</label>
<div class="ts-grid is-bottom-aligned has-vertically-spaced-small">
<div class="column is-fluid">
<label class="ts-text is-label has-bottom-spaced-small" for="saved-dictionary-select">{{ t("app.dictionary.savedLabel") }}</label>
<div class="ts-select is-fluid">
<select id="saved-dictionary-select" v-model="selectedSavedDictionary" @change="loadSavedDictionary">
<option value="">{{ t("app.dictionary.chooseSaved") }}</option>
<option v-for="dictionary in savedDictionaries" :key="dictionary.name" :value="dictionary.name">{{ dictionary.name }}</option>
</select>
</div>
</div>
<div class="column ts-wrap">
<button class="ts-button is-negative is-outlined" type="button" :disabled="!selectedSavedDictionary" @click="deleteSavedDictionary">{{ t("app.dictionary.action.delete") }}</button>
</div>
</div>
<div class="ts-grid is-bottom-aligned has-vertically-spaced-small">
<div class="column is-fluid">
<label class="ts-text is-label" for="custom-dictionary-name">{{ t("app.dictionary.nameLabel") }}</label>
<div class="ts-input is-fluid">
<input id="custom-dictionary-name" type="text" maxlength="100" v-model="dictionaryDraftName" :placeholder="t('app.dictionary.namePlaceholder')">
</div>
</div>
<div class="column">
<button class="ts-button is-secondary" type="button" :disabled="!dictionaryChanged" @click="saveCustomDictionary">{{ t("app.dictionary.action.save") }}</button>
</div>
</div>
<label class="ts-text is-label has-top-spaced has-bottom-spaced-small" for="custom-dictionary-entries">{{ t("app.dictionary.entriesLabel") }}</label>
<div class="ts-notice is-outlined has-bottom-spaced-small" role="note">
<div class="content">{{ t("app.dictionary.formatHelp") }}</div>
</div>
<div class="ts-input is-fluid">
<textarea id="custom-dictionary-entries" rows="12" spellcheck="false" v-model="dictionaryDraftText" :placeholder="t('app.dictionary.entriesPlaceholder')"></textarea>
</div>
</div>
<div class="ts-divider"></div>
<div class="ts-content is-padded">
<input ref="dictionaryImportInput" type="file" accept=".json,application/json" hidden @change="importDictionaries">
<div class="ts-grid is-spaced-between mobile:is-compact">
<div class="column ts-wrap mobile:is-compact">
<button class="ts-button is-secondary is-outlined is-start-icon" type="button" @click="openDictionaryImport">
<span class="ts-icon is-file-import-icon" aria-hidden="true"></span>{{ t("app.dictionary.action.import") }}
</button>
<button class="ts-button is-secondary is-outlined is-start-icon" type="button" :disabled="!savedDictionaries.length" @click="exportDictionaries">
<span class="ts-icon is-file-export-icon" aria-hidden="true"></span>{{ t("app.dictionary.action.export") }}
</button>
</div>
<div class="column ts-wrap mobile:is-compact">
<button class="ts-button" type="button" @click="applyCustomDictionary">{{ t("app.dictionary.action.apply") }}</button>
</div>
</div>
</div>
</div>
</dialog>
<footer class="ts-content is-center-aligned is-tertiary">
<div class="ts-text">EPUB 的簡繁轉換線上工具。支援檔案拖放,且選擇檔案後即刻開始轉換。另外,一切都在瀏覽器中直接進行,數秒內即可完成轉換。</div>
<div class="ts-text is-secondary">© Stone App · <a href="https://github.com/stoneapptech/epub_convert">GitHub</a></div>
</footer>
<div class="theme-control">
<label class="ts-switch" id="theme-control" :aria-label="themeLabel" :title="themeLabel">
<input type="checkbox" id="theme-switch" v-model="darkMode" @change="saveTheme">
<span :class="['ts-icon', darkMode ? 'is-moon-icon' : 'is-sun-icon']" id="theme-icon" aria-hidden="true"></span>
</label>
</div>
<div
ref="snackbarContainer"
class="snackbar-container"
aria-live="assertive"
popover="manual"
@pointerdown.stop
@mousedown.stop
@click.stop
>
<div v-if="snackbarVisible" class="ts-snackbar" id="snackbar">
<div class="content" id="snackbar-content">{{ snackbarMessage }}</div>
<button
class="close"
id="snackbar-close"
type="button"
:aria-label="t('app.snackbar.close')"
@pointerup.stop.prevent="hideSnackbar"
@click.stop.prevent="hideSnackbar"
></button>
</div>
</div>
</div>
</body>
</html>