mirror of
https://github.com/obra/superpowers.git
synced 2026-04-21 08:59:04 +08:00
refactor: server-side frame wrapping and helper.js consolidation
Move toggleSelect/send/selectedChoice from frame-template.html inline script to helper.js so they're auto-injected. Server now detects bare HTML fragments (no DOCTYPE/html tag) and wraps them in the frame template automatically. Full documents pass through as before. Fix dark mode in sendToClaude confirmation (was using hardcoded colors). Fix test env var bug (BRAINSTORM_SCREEN -> BRAINSTORM_DIR). Add tests for fragment wrapping, full doc passthrough, and helper.js.
This commit is contained in:
@@ -232,28 +232,5 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let selectedChoice = null;
|
||||
|
||||
function toggleSelect(el) {
|
||||
const container = el.closest('.options') || el.closest('.cards');
|
||||
if (container) {
|
||||
container.querySelectorAll('.option, .card').forEach(o => o.classList.remove('selected'));
|
||||
}
|
||||
el.classList.add('selected');
|
||||
selectedChoice = el.dataset.choice;
|
||||
}
|
||||
|
||||
function send() {
|
||||
const feedbackEl = document.getElementById('feedback');
|
||||
const feedback = feedbackEl.value.trim();
|
||||
const payload = {};
|
||||
if (selectedChoice) payload.choice = selectedChoice;
|
||||
if (feedback) payload.feedback = feedback;
|
||||
if (Object.keys(payload).length === 0) return;
|
||||
brainstorm.sendToClaude(payload);
|
||||
feedbackEl.value = '';
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user