From 52c6248e2b002b4329f91a8488a521e025612ab8 Mon Sep 17 00:00:00 2001 From: qing <1776177662@qq.com> Date: Wed, 12 Aug 2026 20:45:48 +0800 Subject: [PATCH] =?UTF-8?q?feat(dnfs):=20=5F=5F=20=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E4=B8=8D=E6=B8=B2=E6=9F=93=E5=8D=A1=E7=89=87?= =?UTF-8?q?=E4=BD=86=E6=89=A7=E8=A1=8C=E7=89=B9=E6=95=88=E2=80=94=E2=80=94?= =?UTF-8?q?style/theme=20=E6=B3=A8=E5=85=A5=20CSS=EF=BC=8Cjs=20=E5=85=A8?= =?UTF-8?q?=E5=B1=8F=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fsys/public/js/dnfs.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/fsys/public/js/dnfs.js b/fsys/public/js/dnfs.js index 8157cdf..05bdb88 100644 --- a/fsys/public/js/dnfs.js +++ b/fsys/public/js/dnfs.js @@ -1042,12 +1042,34 @@ function load_notes(main_node) { inheritThemeStyle(); }; +/* 对 __ 隐藏节点应用特效(注入 CSS / 运行 js),卡片不渲染 */ +function applyHiddenNodeEffects(item) { + var sp = parseSp(item.content); + if (!sp) return; + var noteId = (item.id != null) ? 'hid-' + String(item.id) : null; + if (sp._sp === 'style' || sp._sp === 'theme') { + injectSpCss(sp, noteId); + } else if (sp._sp === 'js' && !sp_effects_disabled) { + /* 仅全屏模式(非 in-node):无卡片容器,in-node 无法合理放置,忽略 */ + if (//.test(sp.code || '')) return; + var frame = document.createElement('iframe'); + frame.className = 'sp-effect-frame'; + frame.setAttribute('sandbox', 'allow-scripts'); + frame.srcdoc = sp.code; + frame.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;border:0;pointer-events:none;z-index:9999;'; + document.body.appendChild(frame); + } +} + /* 把卡片列表渲染到 recommend_list(从 load_notes/搜索过滤复用) */ function renderCards(list) { recommend_list.replaceChildren(); for (let i in list) { let item = list[i] - if (item.title && typeof item.title === 'string' && item.title.indexOf('__') === 0) continue; + if (item.title && typeof item.title === 'string' && item.title.indexOf('__') === 0) { + applyHiddenNodeEffects(item); + continue; + } console.log(item) let card = document.createElement('div'); card.className = "card";