Fix turbo nav layout flash and stats page not loading.

Wait for page CSS before swapping content, hoist inline styles to head, and boot page scripts immediately when DOM markers exist.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-26 20:55:36 +08:00
parent c79bb2ea4b
commit 6d55a54946
10 changed files with 93 additions and 57 deletions
+10
View File
@@ -14,4 +14,14 @@
global.qihuoEmitPageLoad = function () {
global.dispatchEvent(new Event('qihuo:page-load'));
};
/** Register page boot + run now if the page marker is already in DOM (turbo nav). */
global.qihuoPageBoot = function (fn, selector) {
function run() {
if (selector && !global.document.querySelector(selector)) return;
fn();
}
global.addEventListener('qihuo:page-load', run);
run();
};
})();