Rewrite API. Add storage
This commit is contained in:
@@ -43,19 +43,12 @@
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="panel ctrl-panel">
|
||||
<button onclick="send_to_icarus()">Run Icarus Verilog</button>
|
||||
<button style="width:100%" onclick="save_code()">Save</button>
|
||||
<button style="width:100%" onclick="send_to_icarus()">Run Icarus Verilog</button>
|
||||
</div>
|
||||
<div class="panel editor" id="editor">`timescale 10ps/10ps
|
||||
|
||||
module test;
|
||||
initial begin
|
||||
$display("Hello world!");
|
||||
$finish();
|
||||
end
|
||||
endmodule
|
||||
</div>
|
||||
<div class="panel editor" id="editor">@CODE@</div>
|
||||
<div class="panel log-panel">
|
||||
<textarea id="log" readonly="readonly">LOG</textarea>
|
||||
<textarea id="log" readonly="readonly"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -74,7 +67,7 @@ endmodule
|
||||
});
|
||||
const log_area = document.getElementById('log');
|
||||
function send_to_icarus() {
|
||||
fetch('%POSTURI%',
|
||||
fetch('%IVERILOGPOSTURI%',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
@@ -86,6 +79,21 @@ endmodule
|
||||
.then((response) => response.text())
|
||||
.then((text) => { log_area.value = text; });
|
||||
};
|
||||
|
||||
function save_code() {
|
||||
fetch('%SAVECODEURI%',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'text/plain',
|
||||
'Content-Type': 'text/plain'
|
||||
},
|
||||
body: editor.getValue()
|
||||
})
|
||||
.then((response) => response.text())
|
||||
.then((text) => { window.location.href = text; });
|
||||
};
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user