Wizards Towers IDE Dashboard
WorldRealm · Node.AI · Unified AI Router
Super-Dashboard · Single File
HTML
JavaScript
CSS
Markdown
AI Prompt
Preview Idle
Node.AI node.ai
AI Router offline
Share Log Last entries (in memory only):
No shares yet.
`; const frame = document.getElementById("previewFrame"); frame.srcdoc = html; document.getElementById("previewStatus").textContent = "Updated " + new Date().toLocaleTimeString(); } /* -------------------------------------------------- NODE.AI -------------------------------------------------- */ function sendToNodeAI() { const promptInput = document.getElementById("aiPrompt").value.trim(); const aiText = tabContent.ai || ""; const payload = promptInput || aiText || editor.getValue(); const url = "https://node.ai/?q=" + encodeURIComponent(payload); document.getElementById("nodeFrame").src = url; document.getElementById("nodeStatus").textContent = "Sent " + new Date().toLocaleTimeString(); } /* -------------------------------------------------- AI ROUTER (placeholder iframe) You can point this to your portal_ai_router.php -------------------------------------------------- */ function sendToAIRouter() { const promptInput = document.getElementById("aiPrompt").value.trim(); const payload = promptInput || (tabContent.ai || editor.getValue()); // Example: if you later host portal_ai_router.php, change this URL const url = "about:blank"; const frame = document.getElementById("routerFrame"); frame.srcdoc = "
AI Router placeholder\\n\\nPrompt:\\n" + escapeHtml(payload) + "
"; document.getElementById("routerStatus").textContent = "Simulated " + new Date().toLocaleTimeString(); } /* -------------------------------------------------- SHARE SYSTEM -------------------------------------------------- */ function getShareMessage() { if (!editor) return ""; tabContent[currentTab] = editor.getValue(); if (currentTab === "ai") return tabContent.ai; if (currentTab === "md") return tabContent.md; if (currentTab === "html") return tabContent.html; return editor.getValue(); } function logShare(platform, message) { const timestamp = new Date().toISOString(); shareLog.push({ time: timestamp, platform: platform, message: (message || "").replace(/\\n/g, " ") }); const last = shareLog.slice(-5).map(row => "[" + row.time + "] (" + row.platform + ") " + row.message ).join("\\n"); document.getElementById("logOutput").textContent = last || "No shares yet."; } function shareFacebook() { const msg = getShareMessage(); const url = "https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(msg); window.open(url, "_blank", "width=700,height=500"); logShare("Facebook", msg); } function shareX() { const msg = getShareMessage(); const url = "https://twitter.com/intent/tweet?text=" + encodeURIComponent(msg); window.open(url, "_blank", "width=700,height=500"); logShare("X", msg); } function shareEmail() { const msg = getShareMessage(); const mailto = "mailto:?subject=Shared from Wizards Towers IDE&body=" + encodeURIComponent(msg); window.location.href = mailto; logShare("Email", msg); } function shareNative() { const msg = getShareMessage(); if (navigator.share) { navigator.share({ title: "Wizards Towers", text: msg }).then(() => { logShare("Native", msg); }).catch(() => {}); } else { alert("Native share not supported."); } } /* -------------------------------------------------- CSV LOG -------------------------------------------------- */ function downloadCSV() { if (shareLog.length === 0) { alert("No share entries yet."); return; } let csv = "time,platform,message\\n"; shareLog.forEach(row => { csv += `"${row.time}","${row.platform}","${row.message.replace(/"/g,'""')}"\\n`; }); const blob = new Blob([csv], { type: "text/csv" }); const url = URL.createObjectURL(blob); const a = document.createElement("a"); a.href = url; a.download = "wizards_towers_share_log.csv"; a.click(); URL.revokeObjectURL(url); } /* -------------------------------------------------- LAYOUT DRAG -------------------------------------------------- */ (function initDrag() { const dragBar = document.getElementById("dragBar"); const editorPane = document.getElementById("editorPane"); let dragging = false; dragBar.addEventListener("mousedown", e => { dragging = true; document.body.style.userSelect = "none"; }); window.addEventListener("mousemove", e => { if (!dragging) return; const totalWidth = document.querySelector(".workspace").clientWidth; let newWidth = e.clientX - document.querySelector(".sidebar").clientWidth; const min = 260; const max = totalWidth - 260; if (newWidth < min) newWidth = min; if (newWidth > max) newWidth = max; editorPane.style.width = newWidth + "px"; }); window.addEventListener("mouseup", () => { dragging = false; document.body.style.userSelect = ""; }); })(); function resetLayout() { document.getElementById("editorPane").style.width = "50%"; } /* -------------------------------------------------- THEME TOGGLE (simple) -------------------------------------------------- */ let darkTheme = true; function toggleTheme() { darkTheme = !darkTheme; if (darkTheme) { document.documentElement.style.setProperty('--bg', '#0f172a'); document.documentElement.style.setProperty('--bg-alt', '#111827'); document.documentElement.style.setProperty('--panel', '#020617'); document.documentElement.style.setProperty('--text', '#e5e7eb'); document.documentElement.style.setProperty('--text-soft', '#9ca3af'); if (monaco && editor) monaco.editor.setTheme("vs-dark"); } else { document.documentElement.style.setProperty('--bg', '#f3f4f6'); document.documentElement.style.setProperty('--bg-alt', '#e5e7eb'); document.documentElement.style.setProperty('--panel', '#ffffff'); document.documentElement.style.setProperty('--text', '#111827'); document.documentElement.style.setProperty('--text-soft', '#4b5563'); if (monaco && editor) monaco.editor.setTheme("vs"); } } /* -------------------------------------------------- UTIL -------------------------------------------------- */ function escapeHtml(str) { return (str || "").replace(/[&<>"']/g, function(m) { return ({ '&':'&', '<':'<', '>':'>', '"':'"', "'":''' })[m]; }); }