From 7d8b0ec3cc0331ebf8b0db753cb3abffdb7ca791 Mon Sep 17 00:00:00 2001 From: N0rdye Date: Sat, 1 Jul 2023 02:14:24 +0500 Subject: [PATCH] fixed html elements properties --- index.js | 2 +- public/lib/fn.js | 2 +- public/lib/inter.js | 5 +++-- views/admin.ejs | 9 +++++++-- views/main.ejs | 6 ++++-- views/project.ejs | 9 +++------ 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/index.js b/index.js index 59a91e7..4ce07e2 100644 --- a/index.js +++ b/index.js @@ -280,7 +280,7 @@ app.post("/new_obj", (req,res) => { res.send({out:"bad",err:"name"}); } else if (!include){ - db.nr("objects","`name`,`img`,`height`,`width`,`description`",`'${inp["name"]}','${inp["img"]}','1','1','desc'`); + db.nr("objects","`name`,`img`,`height`,`width`,`description`",`'${inp["name"]}','${inp["img"]}','1','1','${inp["desc"]}'`); res.send({out:"good"}); } }) diff --git a/public/lib/fn.js b/public/lib/fn.js index 65ffa30..4dfc5b2 100644 --- a/public/lib/fn.js +++ b/public/lib/fn.js @@ -141,7 +141,7 @@ function get_sid(hostname){ } function new_obj(name,img,height,width,description,callback){ - $.post( "/new_obj", { name:name,img:img }) + $.post( "/new_obj", { name:name,img:img,desc:description }) .done(function( res ) { // if(res["out"] == "good"){ // console.log(res["body"]); diff --git a/public/lib/inter.js b/public/lib/inter.js index 6f58af9..2695320 100644 --- a/public/lib/inter.js +++ b/public/lib/inter.js @@ -39,6 +39,7 @@ function create(clas,x,y,body,id){ } // obj.innerHTML = body; // parent.append(obj); + obj.setAttribute("max-width","100px"); root.append(obj); set_pos(obj,x,y); // let obj_doc = document.getElementById(obj); @@ -53,7 +54,7 @@ function wall_size_change(type,value){ if(type != null && type == "width") { if (value == null) scroll = document.getElementById("wall_width").value; else scroll = value; - document.getElementById("wall_width_value").innerHTML = scroll; + document.getElementById("wall_width_value").innerHTML = (Math.ceil((parseFloat(scroll)+0.1)*10)/ 10); // console.log(scroll); wall.style.width = `${scroll * 200}px`; @@ -62,7 +63,7 @@ function wall_size_change(type,value){ if(type != null && type == "height") { if (value == null) scroll = document.getElementById("wall_height").value; else scroll = value; - document.getElementById("wall_height_value").innerHTML = scroll; + document.getElementById("wall_height_value").innerHTML = (Math.ceil((parseFloat(scroll)+0.1)*10)/ 10); // console.log(scroll); wall.style.height = `${scroll * 200}px`; diff --git a/views/admin.ejs b/views/admin.ejs index 5f67cb6..9d461ff 100644 --- a/views/admin.ejs +++ b/views/admin.ejs @@ -13,7 +13,7 @@

hello admin

-
+
Image preview...
@@ -58,7 +58,8 @@ let name = document.getElementById("nobj_name").value; let description = document.getElementById("nobj_description").value; var img = document.querySelector('img').src; - new_obj(name,img,0,0,description,(res)=>{ + if (img != "http://n0rsrv2:3002/admin"){ + new_obj(name,img,0,0,description,(res)=>{ if(res["out"] == "bad" && res["err"] == "name"){ document.getElementById("obj_resp").innerHTML = "object already exist"; } @@ -66,6 +67,10 @@ document.getElementById("obj_resp").innerHTML = "object created"; } }); + } + else{ + document.getElementById("obj_resp").innerHTML = "image not selected"; + } } // load_obj("asd",(data)=>{ diff --git a/views/main.ejs b/views/main.ejs index 2454cab..0e253d6 100644 --- a/views/main.ejs +++ b/views/main.ejs @@ -52,13 +52,15 @@ diff --git a/views/project.ejs b/views/project.ejs index 8dcb645..575a72e 100644 --- a/views/project.ejs +++ b/views/project.ejs @@ -18,10 +18,6 @@ width: 80%; transition: background-color 0.3s; } - body { - height: 100%; - overflow-y: visible; - } .createzone { background-color: #bfe4ff; border: dashed 4px transparent; @@ -82,6 +78,7 @@ width: 80vw; margin: auto; padding-block: 20px; + padding-bottom: 0px; } .wall{ @@ -127,14 +124,14 @@
0
- +
0
- +