Files
mincojs/index.html
2025-10-30 20:14:04 +09:00

116 lines
2.6 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>MincoJS — Minimal Code Playground</title>
<style>
body {
font-family: monospace;
background: #fdfaf7;
color: #333;
margin: 20px;
}
a { color: #06c; text-decoration: none; }
a:hover { text-decoration: underline; }
textarea { width: 100%; height: 150px; font-family: monospace; }
pre {
width: 100%;
height: 200px;
border: 1px solid #aaa;
background: #fff;
overflow-y: auto;
padding: 8px;
white-space: pre-wrap;
}
#error {
border: 1px solid #c33;
background: #fee;
color: #900;
padding: 8px;
white-space: pre-wrap;
min-height: 1.5em;
}
#inputField {
width: 100%;
padding: 4px;
font-family: monospace;
border: 1px solid #aaa;
}
button { margin: 4px; }
.note {
font-size: 0.9em;
color: #666;
margin-top: -6px;
margin-bottom: 8px;
}
footer {
margin-top: 2em;
font-size: 0.9em;
color: #666;
border-top: 1px solid #ccc;
padding-top: 0.5em;
}
</style>
</head>
<body>
<h2>🐾 MincoJS — Minimal Code Playground</h2>
<h3>プログラム入力</h3>
<div class="note">自由に書き換えてOKですにゃprint や input を使って試してみよう)</div>
<textarea id="code">// MincoJS にようこそ!
// print() で出力、input() で入力欄の文字を取得するにゃ。
// 例:
let name = input();
print("こんにちは、" + name + "さん!");
</textarea><br>
<label for="inputField">入力欄:</label>
<input id="inputField" type="text" value="みんこちゃん" placeholder="ここに入力しておくにゃ"><br>
<button onclick="runCode()">▶ 実行</button>
<button onclick="clearOutput()">🧹 クリア</button>
<h3>出力</h3>
<pre id="output"></pre>
<h3>エラー</h3>
<div id="error"></div>
<footer>
🧭 <a href="list.html">他のプログラムたちを見る</a>
</footer>
<script>
const output = document.getElementById('output');
const errorBox = document.getElementById('error');
const inputField = document.getElementById('inputField');
function print(...args) {
output.textContent += args.join(' ') + "\n";
output.scrollTop = output.scrollHeight;
}
function input() {
return inputField.value;
}
function clearOutput() {
output.textContent = '';
errorBox.textContent = '';
}
function runCode() {
const code = document.getElementById('code').value;
try {
errorBox.textContent = '';
new Function('print', 'input', code)(print, input);
} catch (e) {
errorBox.textContent = '❌ ' + e.message;
}
}
</script>
</body>
</html>