201 lines
8.6 KiB
HTML
201 lines
8.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>WaifuBoard Extension Emulator</title>
|
|
<link rel="stylesheet" href="styles/home.css">
|
|
<link rel="stylesheet" href="styles/emulator.css">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<aside class="sidebar">
|
|
<a href="index.html" class="nav-button" title="Image Boards">
|
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<rect x="3" y="3" width="7" height="7"></rect>
|
|
<rect x="14" y="3" width="7" height="7"></rect>
|
|
<rect x="14" y="14" width="7" height="7"></rect>
|
|
<rect x="3" y="14" width="7" height="7"></rect>
|
|
</svg>
|
|
<span>Back To Home</span>
|
|
</a>
|
|
|
|
<button class="nav-button active" title="Emulator">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-code-xml-icon lucide-code-xml"><path d="m18 16 4-4-4-4"/><path d="m6 8-4 4 4 4"/><path d="m14.5 4-5 16"/></svg>
|
|
<span>Emulator</span>
|
|
</button>
|
|
<button class="nav-button" title="Reset" onclick="window.location.reload()">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-trash2-icon lucide-trash-2"><path d="M10 11v6"/><path d="M14 11v6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>
|
|
<span>Reset</span>
|
|
</button>
|
|
</aside>
|
|
|
|
<div class="main-wrapper">
|
|
<header class="top-header">
|
|
<button id="hamburger-btn" class="hamburger">☰</button>
|
|
<h3>Extension Emulator</h3>
|
|
</header>
|
|
|
|
<div class="emulator-container">
|
|
<div class="editor-pane">
|
|
<div class="control-bar" style="background: transparent; border: none; padding: 0;">
|
|
<h4 style="margin:0">Extension Code</h4>
|
|
<span style="font-size: 0.8rem; color: var(--text-tertiary); margin-left: auto;">
|
|
Paste your .js file here
|
|
</span>
|
|
</div>
|
|
<textarea id="code-input" class="code-editor" spellcheck="false"
|
|
placeholder="// Paste your extension class here..."></textarea>
|
|
</div>
|
|
|
|
<div class="preview-pane">
|
|
|
|
<div class="control-bar" id="main-control-bar">
|
|
<button id="mobile-controls-toggle" class="btn-run mobile-only">
|
|
Options
|
|
</button>
|
|
|
|
<div id="desktop-controls" class="control-group-wrapper">
|
|
<div class="control-group">
|
|
<label>Function</label>
|
|
<select id="func-select" class="control-input">
|
|
<option value="fetchSearchResult">fetchSearchResult (Search)</option>
|
|
<option value="fetchInfo">fetchInfo (Image Details)</option>
|
|
<option value="findChapters">findChapters (Manga/Novel)</option>
|
|
<option value="findChapterPages">findChapterPages (Read)</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
<label>Query / ID / URL</label>
|
|
<input type="text" id="arg-input" class="control-input" value=""
|
|
placeholder="Search query or ID">
|
|
</div>
|
|
|
|
<div class="control-group" style="max-width: 80px;">
|
|
<label>Page</label>
|
|
<input type="number" id="page-input" class="control-input" value="1" min="1">
|
|
</div>
|
|
|
|
<button class="btn-run" id="run-btn">Run</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="display: flex; flex-direction: column; flex: 1; overflow: hidden; position: relative;">
|
|
<div class="tabs">
|
|
<button class="tab-btn active" onclick="switchTab('visual')">Visual</button>
|
|
<button class="tab-btn" onclick="switchTab('json')">JSON</button>
|
|
<button class="tab-btn" onclick="switchTab('console')">Console</button>
|
|
</div>
|
|
|
|
<div id="output-visual" class="output-area">
|
|
<div class="loading-state hidden">Loading...</div>
|
|
<div id="visual-container"></div>
|
|
</div>
|
|
<div id="output-json" class="output-area hidden">
|
|
<pre id="json-content"></pre>
|
|
</div>
|
|
<div id="output-console" class="output-area hidden">
|
|
<div id="console-content"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="mobile-controls-overlay"></div>
|
|
<div id="mobile-controls-drawer">
|
|
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:1rem;">
|
|
<h4 style="margin:0; color:var(--text-primary);">Run Options</h4>
|
|
<button id="close-drawer-btn" style="background:none;border:none;font-size:1.8rem;cursor:pointer;color:var(--text-secondary);">
|
|
X
|
|
</button>
|
|
</div>
|
|
|
|
<div class="control-group-wrapper">
|
|
<div class="control-group">
|
|
<label>Function</label>
|
|
<select id="func-select-mobile" class="control-input">
|
|
<option value="fetchSearchResult">fetchSearchResult (Search)</option>
|
|
<option value="fetchInfo">fetchInfo (Image Details)</option>
|
|
<option value="findChapters">findChapters (Manga/Novel)</option>
|
|
<option value="findChapterPages">findChapterPages (Read)</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
<label>Query / ID / URL</label>
|
|
<input type="text" id="arg-input-mobile" class="control-input" placeholder="Search query or ID">
|
|
</div>
|
|
|
|
<div class="control-group">
|
|
<label>Page</label>
|
|
<input type="number" id="page-input-mobile" class="control-input" value="1" min="1">
|
|
</div>
|
|
|
|
<button class="btn-run" id="run-btn-mobile">Run</button>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="../src/emulator/emulator.js"></script>
|
|
<script src="../src/hamburger.js"></script>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
const toggleBtn = document.getElementById('mobile-controls-toggle');
|
|
const drawer = document.getElementById('mobile-controls-drawer');
|
|
const overlay = document.getElementById('mobile-controls-overlay');
|
|
const closeBtn = document.getElementById('close-drawer-btn');
|
|
|
|
const funcSelect = document.getElementById('func-select');
|
|
const argInput = document.getElementById('arg-input');
|
|
const pageInput = document.getElementById('page-input');
|
|
const runBtn = document.getElementById('run-btn');
|
|
|
|
const funcMobile = document.getElementById('func-select-mobile');
|
|
const argMobile = document.getElementById('arg-input-mobile');
|
|
const pageMobile = document.getElementById('page-input-mobile');
|
|
const runMobile = document.getElementById('run-btn-mobile');
|
|
|
|
const syncDesktopToMobile = () => {
|
|
funcMobile.value = funcSelect.value;
|
|
argMobile.value = argInput.value;
|
|
pageMobile.value = pageInput.value;
|
|
};
|
|
|
|
const syncMobileToDesktop = () => {
|
|
funcSelect.value = funcMobile.value;
|
|
argInput.value = argMobile.value;
|
|
pageInput.value = pageMobile.value;
|
|
};
|
|
|
|
toggleBtn?.addEventListener('click', () => {
|
|
syncDesktopToMobile();
|
|
drawer.classList.add('open');
|
|
overlay.classList.add('open');
|
|
});
|
|
|
|
const closeDrawer = () => {
|
|
syncMobileToDesktop();
|
|
drawer.classList.remove('open');
|
|
overlay.classList.remove('open');
|
|
};
|
|
|
|
closeBtn?.addEventListener('click', closeDrawer);
|
|
overlay?.addEventListener('click', closeDrawer);
|
|
|
|
document.addEventListener('keydown', e => {
|
|
if (e.key === 'Escape') closeDrawer();
|
|
});
|
|
|
|
runMobile?.addEventListener('click', () => {
|
|
syncMobileToDesktop();
|
|
closeDrawer();
|
|
runBtn.click();
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |