diff options
-rw-r--r-- | html/display.html | 38 | ||||
-rw-r--r-- | server.js | 4 |
2 files changed, 33 insertions, 9 deletions
diff --git a/html/display.html b/html/display.html index 09ea35a..718a018 100644 --- a/html/display.html +++ b/html/display.html @@ -158,6 +158,7 @@ .scrollbar-point { width: 100%; + max-height: 100%; background-color: #999999; position: absolute; top: 0; @@ -290,6 +291,16 @@ background-color: #c7c7c7; } + textarea{ + resize:none; + background-color: rgba(0,0,0,0); + border:none; + outline: none; + overflow:scroll; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; + } </style> <script> function compare(a, b) { @@ -373,11 +384,12 @@ } } } + let minx = 150; + let miny = 150; function window_create(uid, name, content, options = {}) { let lines = content.split("</br>").length let a = '' - let minx = 150; - let miny = 150; + let size = (options.size != undefined) ? ("width:" + options.size.width + "px;height:" + options.size.height + "px;") : ("width:" + Math.max(document.body.clientWidth * .56, minx) + "px;height:" + Math.max(miny, document.body.clientHeight * .30) + "px;"); a += "<div id='" + uid + "-root' class='window' style=\"" + size + "top:0px;left:0px;position:absolute;\" window-name='" + name + "'>" @@ -405,12 +417,19 @@ a += "<div id='" + uid + "-resize-es' class='resize-es'></div>" document.getElementById("root").innerHTML += a //console.log(document.getElementById(uid + "-content-root").clientHeight / (document.getElementById(uid + "-content-content").clientHeight / document.getElementById(uid + "-content-root").clientHeight)) - document.getElementById(uid + "-content-scrollbar-point").style.height = (document.getElementById(uid + "-content-root").clientHeight / (document.getElementById(uid + "-content-content").clientHeight / document.getElementById(uid + "-content-root").clientHeight)) + "px" - if (document.getElementById(uid + "-content-scrollbar-point").clientHeight > document.getElementById(uid + "-content-root").clientHeight) - document.getElementById(uid + "-content-scrollbar").style.display = 'none' + //console.log(document.getElementById(uid + "-content-scrollbar-point")) + refresh_windows() + } + function refresh_windows(){ let elems = document.getElementsByClassName("window") for (let i = 0; i != elems.length; i++) { + let uid = elems.item(i).id.split("-")[0] + document.getElementById(uid + "-content-scrollbar-point").style.height = (document.getElementById(uid + "-content-root").clientHeight / (document.getElementById(uid + "-content-content").clientHeight / document.getElementById(uid + "-content-root").clientHeight)) + "px" + if (document.getElementById(uid + "-content-scrollbar-point").clientHeight > document.getElementById(uid + "-content-root").clientHeight) + document.getElementById(uid + "-content-scrollbar").style.display = 'none' + else + document.getElementById(uid + "-content-scrollbar").style.display = 'block' //let elem = elems.item(i).children[0] let elec = elems.item(i).children let elem @@ -653,10 +672,15 @@ } + - } - let fs = [{ name: "apps", perms: { r: true }, dir: true, content: [{ name: "notepad", icon: "./src/img/notepad.png", perms: { r: true }, dir: false, content: "window Notepad <input>uwu" }, { name: "cmd", icon: "./src/img/cmd.png", perms: { r: true }, dir: false, content: "window" }] }] + function auto_resize(i){ + + i.style.height = i.value.split("\n").length * 30 + refresh_windows() + } + let fs = [{ name: "apps", perms: { r: true }, dir: true, content: [{ name: "notepad", icon: "./src/img/notepad.png", perms: { r: true }, dir: false, content: "window Notepad <textarea onkeypress=\\'auto_resize(this)\\' style=\\'width:100%;overflow:visible;display:block;\\'>uwu</textarea>" }, { name: "cmd", icon: "./src/img/cmd.png", perms: { r: true }, dir: false, content: "window" }] }] function shortcut(i) { let parsed = i.split("\n") for (let line of parsed) { @@ -4,10 +4,10 @@ const app = express(); const port = 8008; app.get("/tty", (req, res) => { - res.sendFile(__dirname + "./html/tty.html"); + res.sendFile(__dirname + "/html/tty.html"); }); app.get("/display", (req, res) => { - res.sendFile(__dirname + "./html/display.html"); + res.sendFile(__dirname + "/html/display.html"); }); app.use("/src", express.static("src")); app.listen(port, () => { |