Change page design. Make page mobile friendly

This commit is contained in:
Nikolay Puzanov 2022-12-02 14:33:31 +03:00
parent b87a7e0c97
commit ec02787747

View File

@ -2,54 +2,108 @@
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Verilog Playground</title>
<style type="text/css" media="screen">
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap');
.container {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: 5px;
* {
box-sizing: border-box;
background: white;
font-family: 'JetBrains Mono', monospace;
margin: 0;
padding: 0;
}
body {
padding: 3px;
font-size: 14px;
}
.panel {
float: left;
position: relative;
height: 100%;
#buttons {
color: white;
background-color: #2d3d40;
width: 100%;
height: 38px;
padding: 4px;
border: 1px solid #008899;
box-sizing: border-box;
font-size: inherit;
}
.ctrl-panel { width: 10%; }
.editor { width: 45%; }
.log-panel { width: 45%; }
#logdiv, #editor, #buttons {
border-width: 1px;
border-style: solid;
border-color: #505050;
}
button {
color: black;
background-color: #dbdbdb;
margin-left: 1px;
margin-right: 1px;
height: 100%;
}
button span.text { padding: 4px; }
#text {
font-family: 'JetBrains Mono', monospace;
font-size: inherit;
}
#editor {
height: 75vh;
width: 100%;
}
#logdiv {
height: 100%;
width: 100%;
}
#logdiv {
position: relative;
overflow: scroll;
}
@media (orientation: landscape) {
body {
display: flex;
flex-flow: column;
height: 100vh;
}
#text { flex-grow: 1; }
#editor {
float: left;
width: 50%;
height: 100%;
}
#logdiv {
float: left;
width: 50%;
height: 100%;
}
#log {
width: 100%;
position: absolute;
height: 100%;
border: 0px;
font-size: inherit;
}
}
</style>
</head>
<body>
<div class="container">
<div class="panel ctrl-panel">
<button style="width:100%" onclick="save_code()">Save (ctrl+s)</button>
<button style="width:100%" onclick="send_to_icarus()">Run Icarus Verilog</button>
<div id="buttons">
<button onclick="save_code()"><span class="text">Save (ctrl-s)</span></button>
Sim:
<button onclick="send_to_icarus()"><span class="text">Icarus</span></button>
<!-- button><span class="text">Verilator</span></button -->
</div>
<div class="panel editor" id="editor">@CODE@</div>
<div class="panel log-panel">
<textarea id="log" readonly="readonly"></textarea>
<div id="text">
<div id="editor">@CODE@</div>
<div id="logdiv">
<pre id="log"></pre>
</div>
</div>
@ -68,7 +122,7 @@
});
const log_area = document.getElementById('log');
function send_to_icarus() {
log_area.value = "Please wait...";
log_area.innerHTML = "Please wait...";
fetch('%IVERILOGPOSTURI%',
{
method: 'POST',
@ -79,7 +133,7 @@
body: editor.getValue()
})
.then((response) => response.text())
.then((text) => { log_area.value = text; });
.then((text) => { log_area.innerHTML = text; });
};
function save_code() {