Fix module script scope: wire buttons via JS instead of HTML onclick
<script type="module"> doesn't expose functions to onclick attributes. Replaced all onclick="fn()" with document.getElementById().onclick = fn so buttons work from module scope. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -110,11 +110,11 @@ const WEB_HTML: &str = r##"<!DOCTYPE html>
|
|||||||
<div class="sub">end-to-end encrypted messenger</div>
|
<div class="sub">end-to-end encrypted messenger</div>
|
||||||
|
|
||||||
<div id="gen-section">
|
<div id="gen-section">
|
||||||
<button class="btn" onclick="doGenerate()">Generate Identity</button>
|
<button class="btn" id="btn-generate">Generate Identity</button>
|
||||||
<button class="btn btn-alt" onclick="document.getElementById('recover-area').style.display='block'">Recover</button>
|
<button class="btn btn-alt" id="btn-show-recover">Recover</button>
|
||||||
<div id="recover-area">
|
<div id="recover-area">
|
||||||
<textarea id="recover-input" placeholder="Paste your hex seed (64 chars)..." rows="2"></textarea>
|
<textarea id="recover-input" placeholder="Paste your hex seed (64 chars)..." rows="2"></textarea>
|
||||||
<button class="btn" onclick="doRecover()">Recover Identity</button>
|
<button class="btn" id="btn-recover">Recover Identity</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ const WEB_HTML: &str = r##"<!DOCTYPE html>
|
|||||||
<div class="seed-display" id="my-seed"></div>
|
<div class="seed-display" id="my-seed"></div>
|
||||||
<div class="warn">SAVE YOUR SEED — only way to recover your identity</div>
|
<div class="warn">SAVE YOUR SEED — only way to recover your identity</div>
|
||||||
<br>
|
<br>
|
||||||
<button class="btn" onclick="enterChat()">Enter Chat</button>
|
<button class="btn" id="btn-enter">Enter Chat</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ const WEB_HTML: &str = r##"<!DOCTYPE html>
|
|||||||
<div id="messages"></div>
|
<div id="messages"></div>
|
||||||
<div id="bottom">
|
<div id="bottom">
|
||||||
<textarea id="msg-input" placeholder="Message... (Enter to send)" rows="1"></textarea>
|
<textarea id="msg-input" placeholder="Message... (Enter to send)" rows="1"></textarea>
|
||||||
<button id="send-btn" onclick="doSend()">▶</button>
|
<button id="send-btn">▶</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -639,6 +639,13 @@ $input.addEventListener('input', function() {
|
|||||||
this.style.height = Math.min(this.scrollHeight, 120) + 'px';
|
this.style.height = Math.min(this.scrollHeight, 120) + 'px';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Wire up buttons (module scope can't use onclick in HTML)
|
||||||
|
document.getElementById('btn-generate').onclick = () => doGenerate();
|
||||||
|
document.getElementById('btn-show-recover').onclick = () => document.getElementById('recover-area').style.display = 'block';
|
||||||
|
document.getElementById('btn-recover').onclick = () => doRecover();
|
||||||
|
document.getElementById('btn-enter').onclick = () => enterChat();
|
||||||
|
document.getElementById('send-btn').onclick = () => doSend();
|
||||||
|
|
||||||
// Initialize WASM and auto-load
|
// Initialize WASM and auto-load
|
||||||
(async function() {
|
(async function() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user