镜像自地址
https://github.com/lhly/cloud-drive-renamer.git
已同步 2026-10-20 13:47:47 +08:00
fix(quark): 添加对document.body的null检查并改进脚本加载逻辑
添加防御性检查确保在document_start阶段也能正确处理DOM标记 同时更新版本号至0.1.1
这个提交包含在:
父节点
5830b3436d
当前提交
0ad07b98e4
@ -2,7 +2,7 @@
|
||||
"manifest_version": 3,
|
||||
"default_locale": "zh_CN",
|
||||
"name": "__MSG_extName__",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"description": "__MSG_extDescription__",
|
||||
"permissions": [
|
||||
"storage",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cloud-drive-renamer",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"description": "批量重命名工具,支持夸克网盘(阿里云盘和百度网盘开发中)",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@ -186,8 +186,21 @@ window.__QUARK_PAGE_SCRIPT_READY__ = {
|
||||
|
||||
// === PRIMARY: Set DOM-based flag for cross-world communication ===
|
||||
// This is the reliable method that works across MAIN and ISOLATED worlds
|
||||
// Defensive null check: document.body may be null at document_start
|
||||
if (document.body) {
|
||||
// Fast path: body already exists (common case after DOMContentLoaded)
|
||||
document.body.dataset.quarkPageScriptReady = 'true';
|
||||
document.body.dataset.quarkPageScriptTimestamp = flagTimestamp.toString();
|
||||
} else {
|
||||
// Fallback: defer to DOMContentLoaded when body is not ready yet
|
||||
// This ensures we don't lose the DOM dataset signal even at document_start
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const deferredTimestamp = Date.now();
|
||||
document.body.dataset.quarkPageScriptReady = 'true';
|
||||
document.body.dataset.quarkPageScriptTimestamp = deferredTimestamp.toString();
|
||||
}, { once: true });
|
||||
}
|
||||
|
||||
// Send postMessage event for real-time notification
|
||||
// Note: This is sent immediately regardless of body readiness for lowest latency
|
||||
window.postMessage({ type: 'QUARK_PAGE_SCRIPT_READY' }, '*');
|
||||
|
||||
@ -10,19 +10,19 @@
|
||||
* 1. Edit version in package.json
|
||||
* 2. Run: npm run sync:version (or automatically via prebuild/predev)
|
||||
*
|
||||
* Generated at: 2025-12-17T03:32:33.289Z
|
||||
* Generated at: 2025-12-17T04:47:58.196Z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Application version number (e.g., "0.1.0")
|
||||
*/
|
||||
export const APP_VERSION = '0.1.0' as const;
|
||||
export const APP_VERSION = '0.1.1' as const;
|
||||
|
||||
/**
|
||||
* Application version with 'v' prefix (e.g., "v0.1.0")
|
||||
* Commonly used for display purposes
|
||||
*/
|
||||
export const APP_VERSION_WITH_PREFIX = 'v0.1.0' as const;
|
||||
export const APP_VERSION_WITH_PREFIX = 'v0.1.1' as const;
|
||||
|
||||
/**
|
||||
* Parse version into components
|
||||
@ -30,5 +30,5 @@ export const APP_VERSION_WITH_PREFIX = 'v0.1.0' as const;
|
||||
export const VERSION_PARTS = {
|
||||
major: 0,
|
||||
minor: 1,
|
||||
patch: 0,
|
||||
patch: 1,
|
||||
} as const;
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户