-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Website:Spacing and collapsable options #156
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,7 +123,7 @@ def print_headers(content_type: str) -> None: | |
</head> | ||
""" | ||
) | ||
print("<body><pre><plaintext>", end="") | ||
print("<body><pre><plaintext>", end="") # assuming this is the result page, any chance of adding rough syntax highlighting? | ||
print(res.stdout.decode("utf-8", "replace")) | ||
elif "?go" in os.environ.get("REQUEST_URI", ""): | ||
print_headers(content_type="text/html") | ||
|
@@ -133,129 +133,170 @@ def print_headers(content_type: str) -> None: | |
""" | ||
<!DOCTYPE html><html> | ||
<head> | ||
<style> | ||
* { | ||
box-sizing: border-box; | ||
} | ||
html, body, form, .main, .sidebar { | ||
margin: 0; | ||
height: 100%; | ||
} | ||
textarea, .sidebar iframe { | ||
width: 100%; | ||
height: 100%; | ||
border: 1px solid #bbb; | ||
margin: 1px 0; | ||
} | ||
label { | ||
white-space: nowrap; | ||
} | ||
[data-regvars]:not([data-regvars=custom]) [name=regvars] { | ||
display: none; | ||
} | ||
[name=regvars] { | ||
width: 150px; | ||
} | ||
.main, .sidebar { | ||
display: flex; | ||
flex-direction: column; | ||
padding: 10px; | ||
} | ||
.sidebar { | ||
display: none; | ||
} | ||
.has-sidebar form { | ||
display: flex; | ||
flex-direction: row; | ||
} | ||
.has-sidebar .main, .has-sidebar .sidebar { | ||
flex: 1; | ||
} | ||
.has-sidebar .sidebar { | ||
display: flex; | ||
} | ||
.dark-theme { | ||
background-color: #2d2d2d; | ||
color: #c0c0c0; | ||
} | ||
.dark-theme div, | ||
.dark-theme body, | ||
.dark-theme form, | ||
.dark-theme textarea { | ||
background-color: rgba(255, 255, 255, 0.0225); | ||
color: #c0c0c0; | ||
box-shadow: 1px 1px 10px 0px black; | ||
} | ||
</style> | ||
|
||
<style> | ||
* { | ||
box-sizing: border-box; | ||
} | ||
div{ | ||
padding:16px | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tabs -> spaces, and try to match existing style wrt spacing/semicolons:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} | ||
html, body, form, .main, .sidebar { | ||
margin: 0; | ||
height: 100%; | ||
} | ||
textarea, .sidebar iframe { | ||
width: 100%;/*calc(100% - 16px);*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove commented-out code |
||
height: calc(100% - (1em + 16px)); | ||
border: 1px solid #888; | ||
m//argin: 8px ; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just a quickly removed attribute |
||
} | ||
|
||
label { | ||
white-space: nowrap; | ||
} | ||
[data-regvars]:not([data-regvars=custom]) [name=regvars] { | ||
display: none; | ||
} | ||
[name=regvars] { | ||
width: 150px; | ||
} | ||
.main, .sidebar { | ||
display: flex; | ||
flex-direction: column; | ||
padding: 10px; | ||
margin:0px 4px; | ||
} | ||
.sidebar { | ||
display: none; | ||
} | ||
.has-sidebar form { | ||
display: flex; | ||
flex-direction: row; | ||
} | ||
.has-sidebar .main, .has-sidebar .sidebar { | ||
flex: 1; | ||
} | ||
.has-sidebar .sidebar { | ||
display: flex; | ||
} | ||
.dark-theme { | ||
background-color: #000; | ||
color: #ccc; | ||
} | ||
.dark-theme div, | ||
.dark-theme body, | ||
.dark-theme form, | ||
.dark-theme textarea { | ||
background-color: rgba(255, 255, 255, 0.06225); | ||
color: #c0c0c0; | ||
} | ||
.dark-theme div | ||
{ | ||
box-shadow: 1px 1px 10px 0px black; | ||
} | ||
#options | ||
{ | ||
overflow:scroll;box-shadow:none;background-color:inherit;display:flex;flex-wrap: wrap; flex:1; flex-basis: 300px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. line-wrap this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At least on chrome, I couldn't get this div to overflow: the div would always expand to fit all of the contents. I tried googling/playing around with some different properties, but couldn't get anything to work (other than specifying a Does the div ever become scrollable on a different browser? Otherwise There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was tetsing various ideas, I originally had a height but got rid of it. |
||
} | ||
input[type=submit] | ||
{ | ||
color:white; | ||
Background-color:#282; | ||
border:2px #282 outset; | ||
font-weight:bold; | ||
float:right; | ||
} | ||
input[type=submit]:focus { | ||
border:2px #4f4 outset; | ||
} | ||
select | ||
{ | ||
|
||
} | ||
label | ||
{ | ||
flex:1;flex-basis: 250px; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually have no idea how flex works, I just worked from examples in the page, but your second image is far better and the exact effect I was going for. |
||
} | ||
.keyword{color:blue;} | ||
.opperator{color:grey} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unused |
||
</style> | ||
</head> | ||
<body> | ||
<form action="?go" method="post"> | ||
<div class="main"> | ||
<div> | ||
<div style="flex: 15;"> | ||
MIPS assembly: | ||
</div> | ||
<div style="flex: 20;"> | ||
<br> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think Right now |
||
<textarea name="source" spellcheck="false"></textarea> | ||
</div> | ||
<div style="margin-top: 10px;"> | ||
<br> | ||
<div style="flex: 11;"> | ||
Existing C source, preprocessed (optional): | ||
</div> | ||
<div style="flex: 11;"> | ||
<br> | ||
<textarea name="context" spellcheck="false"></textarea> | ||
</div> | ||
<div style="margin-top: 10px;" id="options"> | ||
<br> | ||
<div> | ||
<input type="submit" value="Decompile"> | ||
<input type="submit" name="visualize" value="Visualize"> | ||
<label>Function: <select name="functionselect"></select></label> | ||
</label> | ||
<label>Global declarations: | ||
<select name="globals"> | ||
<option value="used">used</option> | ||
<option value="all">all</option> | ||
<option value="none">none</option> | ||
</select> | ||
</label> | ||
<label>Original Compiler: | ||
<select name="compiler"> | ||
<option value="ido">ido</option> | ||
<option value="gcc">gcc</option> | ||
</select> | ||
</label> | ||
<label>Comment style: | ||
<select name="comment_style"> | ||
<option value="multiline">/* ... */, aligned</option> | ||
<option value="multiline_unaligned">/* ... */, unaligned</option> | ||
<option value="oneline">// ..., aligned</option> | ||
<option value="oneline_unaligned">// ..., unaligned</option> | ||
</select> | ||
</label> | ||
<label>Use single var for: | ||
<select name="regvarsselect"> | ||
<option value="none">none</option> | ||
<option value="saved">saved regs</option> | ||
<option value="all">all regs</option> | ||
<option value="custom">custom</option> | ||
</select> | ||
</label> | ||
<input name="regvars" value=""> | ||
<label><input type="checkbox" name="void">Force void return type</label> | ||
<label><input type="checkbox" name="debug">Debug info</label> | ||
<label><input type="checkbox" name="noandor">Disable &&/||</label> | ||
<label><input type="checkbox" name="nocasts">Hide type casts</label> | ||
<label><input type="checkbox" name="allman">Allman braces</label> | ||
<label><input type="checkbox" name="leftptr">* to the left</label> | ||
<label><input type="checkbox" name="noifs">Use gotos for everything</label> (to use a goto for a single branch, add "# GOTO" to the asm) | ||
<label><input type="checkbox" name="usesidebar">Output sidebar</label> | ||
<label><input type="checkbox" name="dark">Dark mode</label> | ||
<details open=""> | ||
<summary>Options</summary> | ||
<div id="options"> | ||
<label>Function: | ||
<select name="functionselect"> | ||
</select> | ||
</label> | ||
|
||
<label>Global declarations: | ||
<select name="globals"> | ||
<option value="used">used</option> | ||
<option value="all">all</option> | ||
<option value="none">none</option> | ||
</select> | ||
</label> | ||
<label>Original Compiler: | ||
<select name="compiler"> | ||
<option value="ido">ido</option> | ||
<option value="gcc">gcc</option> | ||
</select> | ||
</label> | ||
<label>Comment style: | ||
<select name="comment_style"> | ||
<option value="multiline">/* ... */, aligned</option> | ||
<option value="multiline_unaligned">/* ... */, unaligned</option> | ||
<option value="oneline">// ..., aligned</option> | ||
<option value="oneline_unaligned">// ..., unaligned</option> | ||
</select> | ||
</label> | ||
<label>Use single var for: | ||
<select name="regvarsselect"> | ||
<option value="none">none</option> | ||
<option value="saved">saved regs</option> | ||
<option value="all">all regs</option> | ||
<option value="custom">custom</option> | ||
</select> | ||
</label> | ||
<input name="regvars" value=""> | ||
<br> | ||
<label><input type="checkbox" name="void">Force void return type</label> | ||
<label><input type="checkbox" name="debug">Debug info</label> | ||
<label><input type="checkbox" name="noandor">Disable &&/||</label> | ||
<label><input type="checkbox" name="nocasts">Hide type casts</label> | ||
<label><input type="checkbox" name="allman">Allman braces</label> | ||
<label><input type="checkbox" name="leftptr">* to the left</label> | ||
<label><input type="checkbox" name="noifs">Use gotos for everything</label> | ||
<label><input type="checkbox" name="usesidebar">Output sidebar</label> | ||
<label><input type="checkbox" name="dark">Dark mode</label> | ||
<p>Notes:<br> to use a goto for a single branch, add "# GOTO" to the asm</p> | ||
</div> | ||
</details> | ||
</div> | ||
</div> | ||
<div class="sidebar"> | ||
<div> | ||
Output: | ||
</div> | ||
<div style="flex: 1;"> | ||
<br> | ||
<iframe src="about:blank" name="outputframe"></iframe> | ||
</div> | ||
</div> | ||
<script> | ||
var formEl = document.getElementsByTagName("form")[0] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, and yeah, that sounds like something we should do. Could probably use
pygments