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