From cc671a9fce53c9609c88d589eec4762a40d955c5 Mon Sep 17 00:00:00 2001 From: qing <1776177662@qq.com> Date: Tue, 4 Aug 2026 23:57:39 +0800 Subject: [PATCH] =?UTF-8?q?feat(dnfs):=20=E5=90=AB=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E7=9A=84=E8=8A=82=E7=82=B9=E6=B8=B2=E6=9F=93?= =?UTF-8?q?=E5=88=B0=E5=BD=93=E5=89=8D=E9=A1=B5=E9=9D=A2=E6=97=B6=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=89=A7=E8=A1=8C=EF=BC=88=E9=9A=94=E7=A6=BBiframe?= =?UTF-8?q?=E6=B2=99=E7=AE=B1=E5=90=AF=E5=8A=A8=E7=89=B9=E6=95=88=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/public/js/dnfs.js | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/static/public/js/dnfs.js b/static/public/js/dnfs.js index e97e303..20d0d4c 100644 --- a/static/public/js/dnfs.js +++ b/static/public/js/dnfs.js @@ -492,7 +492,7 @@ function renderSpLink(container, sp, appendNote) { appendNote(); } -/* 前端代码节点:审计(展开源码,textContent 防注入)+ 运行(在隔离 iframe 沙箱中执行完整 HTML/CSS/JS)。 +/* 前端代码节点:含前端内容的节点在渲染到当前页面时自动执行(隔离 iframe 沙箱)。 * 采用 iframe 沙箱而非注入父页面全局作用域,原因: * - 特效脚本运行在独立 iframe 内,无法访问父页面 DOM/JS,任何报错、死循环、变量覆盖 * 都不会污染父页面,从而保证"运行特效后卡片点击/节点导航依然正常"; @@ -505,9 +505,9 @@ function renderSpJs(container, sp, appendNote) { var audit_btn = document.createElement('button'); audit_btn.className = 'act-btn act-edit'; audit_btn.textContent = '审计源码'; - var run_btn = document.createElement('button'); - run_btn.className = 'act-btn act-move'; - run_btn.textContent = '运行'; + var toggle_btn = document.createElement('button'); + toggle_btn.className = 'act-btn act-move'; + toggle_btn.textContent = '停止特效'; var pre = document.createElement('pre'); pre.className = 'sp-code'; pre.style.display = 'none'; @@ -522,34 +522,37 @@ function renderSpJs(container, sp, appendNote) { pre.style.display = hidden ? 'block' : 'none'; audit_btn.textContent = hidden ? '收起源码' : '审计源码'; }); - run_btn.addEventListener('click', function(e) { - e.stopPropagation(); - /* 已运行:停止并移除特效沙箱 */ - if (frame) { - frame.remove(); - frame = null; - run_btn.textContent = '运行'; - out.style.display = 'none'; - return; - } - /* 创建隔离 iframe 沙箱:完整前端代码(含