八国语言+eagle图片
This commit is contained in:
1 parent
acc93d5404
commit
3bd3ba7404
46 files changed
+2520
-290
No files matched your search
@@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Spine缩略图</title>
|
||||
<title data-i18n="progress.title">Spine缩略图</title>
|
||||
<style>
|
||||
:root { --bg: #1e1e1e; --panel: #252526; --text: #e6e6e6; --dim: #9d9d9d; --accent: #4fc1ff; --border: #3c3c3c; }
|
||||
html, body { margin: 0; background: var(--bg); color: var(--text);
|
||||
@@ -29,18 +29,29 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>正在生成动态缩略图……</h1>
|
||||
<h1 data-i18n="progress.generating">正在生成动态缩略图……</h1>
|
||||
<div class="bar"><i id="bar"></i></div>
|
||||
<div id="count">等待开始…</div>
|
||||
<div id="count" data-i18n="progress.waiting">等待开始…</div>
|
||||
<div id="name"></div>
|
||||
<div id="confirm">
|
||||
<div id="confirmText">是否确认取消?</div>
|
||||
<div id="confirmText" data-i18n="progress.confirmPrompt">是否确认取消?</div>
|
||||
<div id="confirmButtons">
|
||||
<button id="resume" type="button">继续</button>
|
||||
<button id="cancel" type="button">确认取消</button>
|
||||
<button id="resume" type="button" data-i18n="progress.resume">继续</button>
|
||||
<button id="cancel" type="button" data-i18n="progress.cancel">确认取消</button>
|
||||
</div>
|
||||
</div>
|
||||
<button id="action" type="button">停止</button>
|
||||
<button id="action" type="button" data-i18n="progress.stop">停止</button>
|
||||
<script>
|
||||
(function () {
|
||||
try {
|
||||
const pathname = decodeURIComponent(new URL('.', location.href).pathname).replace(/\\/g, '/');
|
||||
window.SpinePluginRoot = pathname.replace(/^\/([A-Za-z]:)/, '$1');
|
||||
} catch (error) {
|
||||
window.SpinePluginRoot = '';
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<script src="js/i18n.js"></script>
|
||||
<script>
|
||||
// 这个页面是宿主用 Eagle 的 create-plugin-window 打开的插件窗口:
|
||||
// 无标题栏、置顶、挂在 Eagle 主窗口上;进度从临时目录的状态文件轮询。
|
||||
@@ -52,6 +63,7 @@
|
||||
const ALIVE_FILE = path.join(os.tmpdir(), 'spine-thumbnail-progress-alive');
|
||||
const CONTROL_FILE = path.join(os.tmpdir(), 'spine-thumbnail-progress-control.json');
|
||||
const WIDTH = 380;
|
||||
const t = SpineThumbI18n.t;
|
||||
const bar = document.getElementById('bar');
|
||||
const countEl = document.getElementById('count');
|
||||
const nameEl = document.getElementById('name');
|
||||
@@ -117,7 +129,7 @@
|
||||
|
||||
/** 三种状态:生成中显示「停止」,暂停询问时显示「继续 / 取消」,跑完显示「确认」。 */
|
||||
function syncButtons() {
|
||||
actionEl.textContent = finished ? '确认' : '停止';
|
||||
actionEl.textContent = finished ? t('progress.confirm') : t('progress.stop');
|
||||
actionEl.style.display = paused ? 'none' : '';
|
||||
confirmEl.style.display = paused ? 'flex' : 'none';
|
||||
fitHeight();
|
||||
@@ -151,15 +163,18 @@
|
||||
finished = state.finished === true;
|
||||
if (finished) paused = false;
|
||||
doneCount = done;
|
||||
confirmTextEl.textContent = '已生成 ' + doneCount + ' 张缩略图,是否确认取消?';
|
||||
confirmTextEl.textContent = t('progress.generatedConfirm', { done: doneCount });
|
||||
if (finished) {
|
||||
bar.style.width = '100%';
|
||||
countEl.textContent = state.text || '已完成';
|
||||
countEl.textContent = state.text || t('progress.complete');
|
||||
nameEl.textContent = '';
|
||||
} else {
|
||||
bar.style.width = Math.min(100, done / total * 100) + '%';
|
||||
countEl.textContent = '已完成 ' + done + ' / ' + (state.total || 0) +
|
||||
'(' + Math.round(done / total * 100) + '%)';
|
||||
countEl.textContent = t('progress.completed', {
|
||||
done,
|
||||
total: state.total || 0,
|
||||
percent: Math.round(done / total * 100),
|
||||
});
|
||||
nameEl.textContent = state.name || '';
|
||||
}
|
||||
syncButtons();
|
||||
|
||||
Reference in new issue
Block a user