Add demo HTML files for dark mode and standard mode

This commit is contained in:
HoshinoKoji 2025-03-04 16:59:33 +08:00
parent bed254509b
commit c5741c2fc1
2 changed files with 37 additions and 1 deletions

36
public/demo-dark.html Normal file
View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="module">
function saveTextAsFile(text, filename) {
const elem = document.createElement('a');
elem.href = 'data:text/json;charset=utf-8,' + encodeURIComponent(text);
elem.download = filename;
elem.click();
}
const data = await fetch('example.json').then((res) => res.json());
data.settings.darkMode = true;
window.addEventListener('message', (event) => {
saveTextAsFile(JSON.stringify(event.data), 'response.json');
});
window.onload = () => {
const iframe = document.getElementById('iframe');
iframe.contentWindow.postMessage(data, window.origin);
};
</script>
<style>
body {
font-family: Inter, 'Helvetica Neue', Helvetica, 'PingFang SC',
'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
}
</style>
</head>
<body>
<iframe
src="index.html"
style="width: 100%; height: 100%; border: none; position: absolute; top: 0; left: 0;"
id="iframe"></iframe>
</body>
</html>

View File

@ -29,7 +29,7 @@
<body> <body>
<iframe <iframe
src="index.html" src="index.html"
style="width: 99vw; height: 95vh; border: none;" style="width: 100%; height: 100%; border: none; position: absolute; top: 0; left: 0;"
id="iframe"></iframe> id="iframe"></iframe>
</body> </body>
</html> </html>