debug: loadPluginPage 加日志追踪错误来源
This commit is contained in:
@@ -79,6 +79,6 @@
|
|||||||
<script src="./static/js/chart.js?v=0603"></script>
|
<script src="./static/js/chart.js?v=0603"></script>
|
||||||
|
|
||||||
<!-- 🟢 2. 再加载主逻辑 -->
|
<!-- 🟢 2. 再加载主逻辑 -->
|
||||||
<script src="./static/js/app.js?v=0706"></script>
|
<script src="./static/js/app.js?v=0707"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ async function loadPage(pageName) {
|
|||||||
var cleanHtml = html.replace(/<script\b[^>]*>([\s\S]*?)<\/script>/gi, function(m,code){ scripts.push(code.trim()); return ''; });
|
var cleanHtml = html.replace(/<script\b[^>]*>([\s\S]*?)<\/script>/gi, function(m,code){ scripts.push(code.trim()); return ''; });
|
||||||
content.innerHTML = cleanHtml;
|
content.innerHTML = cleanHtml;
|
||||||
|
|
||||||
scripts.forEach(function(code){
|
scripts.forEach(function(code){ console.log("loadPluginPage executing script from:", pluginName, "length:", code.length);
|
||||||
try { var s=document.createElement('script'); s.textContent=code; document.head.appendChild(s); document.head.removeChild(s); }
|
try { var s=document.createElement('script'); s.textContent=code; document.head.appendChild(s); document.head.removeChild(s); }
|
||||||
catch(ex){ console.error('Inline script error:', ex); }
|
catch(ex){ console.error('Inline script error:', ex); }
|
||||||
});
|
});
|
||||||
@@ -187,7 +187,7 @@ async function loadPluginPage(pluginName) {
|
|||||||
content.style.padding = '0';
|
content.style.padding = '0';
|
||||||
content.innerHTML = '<div class="plugin-page-root"><style>'+styles+'</style>'+clean+'</div>';
|
content.innerHTML = '<div class="plugin-page-root"><style>'+styles+'</style>'+clean+'</div>';
|
||||||
|
|
||||||
scripts.forEach(function(code){
|
scripts.forEach(function(code){ console.log("loadPluginPage executing script from:", pluginName, "length:", code.length);
|
||||||
try { var s=document.createElement('script'); s.textContent=code; document.head.appendChild(s); document.head.removeChild(s); }
|
try { var s=document.createElement('script'); s.textContent=code; document.head.appendChild(s); document.head.removeChild(s); }
|
||||||
catch(ex){ console.error('Plugin script error:', ex); }
|
catch(ex){ console.error('Plugin script error:', ex); }
|
||||||
});
|
});
|
||||||
@@ -253,7 +253,7 @@ window.pickPath = function(mode, callback) {
|
|||||||
var clean = html.replace(/<script\b[^>]*>([\s\S]*?)<\/script>/gi, function(m,code){ scripts.push(code.trim()); return ''; });
|
var clean = html.replace(/<script\b[^>]*>([\s\S]*?)<\/script>/gi, function(m,code){ scripts.push(code.trim()); return ''; });
|
||||||
contentArea.innerHTML = clean;
|
contentArea.innerHTML = clean;
|
||||||
// Execute scripts
|
// Execute scripts
|
||||||
scripts.forEach(function(code){
|
scripts.forEach(function(code){ console.log("loadPluginPage executing script from:", pluginName, "length:", code.length);
|
||||||
try { var s=document.createElement('script'); s.textContent=code; document.head.appendChild(s); document.head.removeChild(s); }
|
try { var s=document.createElement('script'); s.textContent=code; document.head.appendChild(s); document.head.removeChild(s); }
|
||||||
catch(ex){}
|
catch(ex){}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user