From 3a17978a412464fcebe007fcce7c1216f24f550f Mon Sep 17 00:00:00 2001 From: CyC2018 Date: Fri, 6 Nov 2026 06:58:42 +0800 Subject: [PATCH] Update index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 打开文章时,开头附近的第一张配图和正文同时开始下载。 --- website/templates/index.html | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/website/templates/index.html b/website/templates/index.html index f174961f..c0c207fa 100644 --- a/website/templates/index.html +++ b/website/templates/index.html @@ -32,6 +32,17 @@ link.href = href; document.head.appendChild(link); }); + // 文章开头附近的第一张配图同时开始下载(地址由构建写入) + var images = window.CS_NOTES_FIRST_IMAGES = {}/*FIRST_IMAGES*/, image = null; + try { image = images[decodeURIComponent(path)]; } catch (error) {} + if (image) { + var hint = document.createElement('link'); + hint.rel = 'preload'; + hint.as = 'image'; + hint.href = image; + hint.setAttribute('fetchpriority', 'high'); + document.head.appendChild(hint); + } })();