Skip to content

Commit

Permalink
Candy to easy toggle new lines during development.
Browse files Browse the repository at this point in the history
  • Loading branch information
deleterium committed Mar 8, 2024
1 parent 02b199d commit 8cdc5ef
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion debug.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,18 @@
}
}

function toggleNewLines () {
const sourceCode = document.getElementById('sourcecode').value;
if (sourceCode.includes('\\n')) {
document.getElementById('sourcecode').value = sourceCode.replace(/\\n/g, '\n')
return
}
document.getElementById('sourcecode').value = sourceCode.replace(/\n/g, '\\n')
}

window.onload = () => {
document.getElementById("compile").addEventListener('click', compileCode);
document.getElementById("toggleNL").addEventListener('click', toggleNewLines);
startUpTest();
}
</script>
Expand Down Expand Up @@ -93,7 +103,9 @@
<main>
<div style="width: 100%;">
<div style="width: 50vw; float: left;">
<textarea id="sourcecode" spellcheck="false"></textarea><br><button id="compile" accesskey="c">Compile</button>
<textarea id="sourcecode" spellcheck="false"></textarea><br>
<button id="compile" accesskey="c"><u>C</u>ompile</button>
<button id="toggleNL" accesskey="t"><u>T</u>oggle NewLine</button>
</div>
<div style="margin-left: 53vw;">
<pre id="status"></pre>
Expand Down

0 comments on commit 8cdc5ef

Please sign in to comment.