进度bug修复
This commit is contained in:
1 parent
406bf21b2a
commit
5799d5d049
7 files changed
+14
-6
No files matched your search
@@ -25,7 +25,8 @@ function normalizeLocale(raw) {
|
||||
|
||||
function requestedLocale() {
|
||||
try {
|
||||
const fromUrl = new URLSearchParams(location.search).get('lang');
|
||||
const params = new URLSearchParams(location.search);
|
||||
const fromUrl = params.get('lang') || params.get('locale');
|
||||
if (fromUrl) return fromUrl;
|
||||
} catch (error) { /* No browser location. */ }
|
||||
try {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
// 每次改动递增。Eagle 里的 service 插件是启动时加载并常驻的,改完代码必须重新加载插件
|
||||
// 才会生效;状态栏会显示这个版本号,方便确认加载的到底是不是最新代码。
|
||||
const VERSION = 'v66';
|
||||
const VERSION = 'v67';
|
||||
const SHOW_DEV_VERSION = true;
|
||||
|
||||
const path = require('path');
|
||||
|
||||
@@ -83,7 +83,8 @@ function createPopup() {
|
||||
...manifest.main,
|
||||
// 必须关掉 serviceMode,否则 Eagle 会按 show:false 创建这个窗口。
|
||||
serviceMode: false,
|
||||
url: 'progress.html?lang=' + encodeURIComponent(i18n ? i18n.locale : 'zh_CN'),
|
||||
// Eagle 会把 url 交给 pathToFileURL,查询参数必须由 Eagle 追加,否则 ? 会被编码成文件名。
|
||||
url: 'progress.html',
|
||||
width: WINDOW_SIZE.width,
|
||||
height: WINDOW_SIZE.height,
|
||||
show: true,
|
||||
|
||||
@@ -7,8 +7,12 @@ const path = require('node:path');
|
||||
const root = path.join(__dirname, '..');
|
||||
const html = fs.readFileSync(path.join(root, 'progress.html'), 'utf8');
|
||||
const windowSource = fs.readFileSync(path.join(root, 'js', 'progress-window.js'), 'utf8');
|
||||
const i18nSource = fs.readFileSync(path.join(root, 'js', 'i18n.js'), 'utf8');
|
||||
|
||||
assert.match(windowSource, /minimizable: true/);
|
||||
assert.match(windowSource, /url: 'progress\.html',/);
|
||||
assert.doesNotMatch(windowSource, /url: 'progress\.html\?/);
|
||||
assert.match(i18nSource, /params\.get\('lang'\) \|\| params\.get\('locale'\)/);
|
||||
assert.match(html, /addEventListener\('beforeunload'/);
|
||||
assert.match(html, /function requestStop\(\)[\s\S]*writeControl\('pause'\)[\s\S]*resumeEl\.focus\(\)/);
|
||||
assert.match(html, /if \(allowClose \|\| finished\) return;[\s\S]*event\.returnValue = false;[\s\S]*requestStop\(\)/);
|
||||
|
||||
Reference in new issue
Block a user