From d2a7f99aa6e89043c905ab46ce783a91eff80fd9 Mon Sep 17 00:00:00 2001 From: amy Date: Fri, 10 Feb 2023 13:40:16 -0600 Subject: minesweeper :empty: --- html/display.html | 87 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 31 deletions(-) (limited to 'html') diff --git a/html/display.html b/html/display.html index a24255e..28d1871 100644 --- a/html/display.html +++ b/html/display.html @@ -345,6 +345,12 @@ } let bar_items_left = [] function load_bar() { + document.getElementById("bar-menu").onclick = ((ev) => { + if (document.getElementById("bar-menu-root").style.display == "block") + document.getElementById("bar-menu-root").style.display = "none" + else + document.getElementById("bar-menu-root").style.display = "block" + }) let items = document.getElementById("bar-menu-root").children for (let item = 0; item != items.length; item++) { //console.log(items.item(item)) @@ -380,9 +386,21 @@ for (let l of dd[ite].content.split("\n")) { if (l.split(" ")[0] == "meta") { - if (l.split(" ")[1] == "icon") { - icon = `` + let tem = l.split(" ") + tem.splice(0, 1); + tem = tem.join(" ") + //console.log(tem) + tem = tem.split(",") + //console.log(tem) + for (let tw of tem) { + if (tw.trim().split(" ")[0] == "icon") { + icon = `` + } } + /*if (l.split(" ")[1] == "icon") { + icon = `` + }*/ + } } ins += icon @@ -480,8 +498,8 @@ function window_create(uid, name, content, options = {}) { let lines = content.split("
").length let a = '' - 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;"); - let pos = (options.pos != undefined) ? ("left:" + options.pos.left + "px;top:" + options.pos.top + "px;") : ("left:0px;top:0px;"); + let size = (options.width != undefined && options.height != undefined) ? ("width:" + options.width + "px;height:" + options.height + "px;") : ("width:" + Math.max(document.body.clientWidth * .56, minx) + "px;height:" + Math.max(miny, document.body.clientHeight * .30) + "px;"); + let pos = (options.left != undefined && options.top != undefined) ? ("left:" + options.left + "px;top:" + options.top + "px;") : ("left:0px;top:0px;"); a += "
" //console.log(document.getElementById(uid).attributes["window-name"].value) a += "
" + name + "
" @@ -490,21 +508,27 @@
` - a += "
" - a += "
" - a += "
" - a += "
" + if (options.resize != false && options.resize != "false") { + a += "
" + a += "
" + a += "
" + a += "
" + } a += "
" a += "
" + a += "
" + content + "
" - a += "
" - a += "
" + if (options.scroll != false && options.scroll != "false") { + a += "
" + a += "
" + } a += "
" - - a += "
" - a += "
" - a += "
" - a += "
" + if (options.resize != false && options.resize != "false") { + a += "
" + a += "
" + a += "
" + a += "
" + } 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)) @@ -516,18 +540,21 @@ 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 { - if (document.getElementById(uid + "-content-scrollbar").style.display == 'none') { - document.getElementById(uid + "-content-scrollbar").style.display = 'block' - if (document.getElementById(uid + "-content-scrollbar-point").clientHeight >= document.getElementById(uid + "-content-root").clientHeight) { - document.getElementById(uid + "-content-scrollbar").style.display = 'none' + try { + 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 { + if (document.getElementById(uid + "-content-scrollbar").style.display == 'none') { + document.getElementById(uid + "-content-scrollbar").style.display = 'block' + if (document.getElementById(uid + "-content-scrollbar-point").clientHeight >= document.getElementById(uid + "-content-root").clientHeight) { + document.getElementById(uid + "-content-scrollbar").style.display = 'none' + } } } - } + } catch (e) { } //let elem = elems.item(i).children[0] let elec = elems.item(i).children let elem @@ -833,14 +860,12 @@ } } document.getElementById("bar-menu-root").style.display = "none" - document.getElementById("bar-menu").onclick = ((ev) => { - if (document.getElementById("bar-menu-root").style.display == "block") - document.getElementById("bar-menu-root").style.display = "none" - else - document.getElementById("bar-menu-root").style.display = "block" - }) + load_bar() } + + + async function main() { fs = await req('src/fs.json') document.getElementById("bar-menu").onclick = ((ev) => { -- cgit v1.2.3