fixed html elements properties
This commit is contained in:
parent
c6a86f8084
commit
7d8b0ec3cc
2
index.js
2
index.js
|
@ -280,7 +280,7 @@ app.post("/new_obj", (req,res) => {
|
||||||
res.send({out:"bad",err:"name"});
|
res.send({out:"bad",err:"name"});
|
||||||
}
|
}
|
||||||
else if (!include){
|
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"});
|
res.send({out:"good"});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -141,7 +141,7 @@ function get_sid(hostname){
|
||||||
}
|
}
|
||||||
|
|
||||||
function new_obj(name,img,height,width,description,callback){
|
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 ) {
|
.done(function( res ) {
|
||||||
// if(res["out"] == "good"){
|
// if(res["out"] == "good"){
|
||||||
// console.log(res["body"]);
|
// console.log(res["body"]);
|
||||||
|
|
|
@ -39,6 +39,7 @@ function create(clas,x,y,body,id){
|
||||||
}
|
}
|
||||||
// obj.innerHTML = body;
|
// obj.innerHTML = body;
|
||||||
// parent.append(obj);
|
// parent.append(obj);
|
||||||
|
obj.setAttribute("max-width","100px");
|
||||||
root.append(obj);
|
root.append(obj);
|
||||||
set_pos(obj,x,y);
|
set_pos(obj,x,y);
|
||||||
// let obj_doc = document.getElementById(obj);
|
// let obj_doc = document.getElementById(obj);
|
||||||
|
@ -53,7 +54,7 @@ function wall_size_change(type,value){
|
||||||
if(type != null && type == "width") {
|
if(type != null && type == "width") {
|
||||||
if (value == null) scroll = document.getElementById("wall_width").value;
|
if (value == null) scroll = document.getElementById("wall_width").value;
|
||||||
else scroll = 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);
|
// console.log(scroll);
|
||||||
wall.style.width = `${scroll * 200}px`;
|
wall.style.width = `${scroll * 200}px`;
|
||||||
|
@ -62,7 +63,7 @@ function wall_size_change(type,value){
|
||||||
if(type != null && type == "height") {
|
if(type != null && type == "height") {
|
||||||
if (value == null) scroll = document.getElementById("wall_height").value;
|
if (value == null) scroll = document.getElementById("wall_height").value;
|
||||||
else scroll = 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);
|
// console.log(scroll);
|
||||||
wall.style.height = `${scroll * 200}px`;
|
wall.style.height = `${scroll * 200}px`;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<h1>hello admin</h1>
|
<h1>hello admin</h1>
|
||||||
<div class="nobj">
|
<div class="nobj">
|
||||||
<div class="img_preview">
|
<div class="img_preview">
|
||||||
<input type="file" onchange="previewFile()" value="" maxlength="1"><br>
|
<input type="file" onchange="previewFile()" accept="image/*" value="" maxlength="1"><br>
|
||||||
<img src="" height="100" alt="Image preview...">
|
<img src="" height="100" alt="Image preview...">
|
||||||
</div>
|
</div>
|
||||||
<textarea name="" id="nobj_description" cols="30" rows="5" placeholder="object description"></textarea>
|
<textarea name="" id="nobj_description" cols="30" rows="5" placeholder="object description"></textarea>
|
||||||
|
@ -58,7 +58,8 @@
|
||||||
let name = document.getElementById("nobj_name").value;
|
let name = document.getElementById("nobj_name").value;
|
||||||
let description = document.getElementById("nobj_description").value;
|
let description = document.getElementById("nobj_description").value;
|
||||||
var img = document.querySelector('img').src;
|
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"){
|
if(res["out"] == "bad" && res["err"] == "name"){
|
||||||
document.getElementById("obj_resp").innerHTML = "object already exist";
|
document.getElementById("obj_resp").innerHTML = "object already exist";
|
||||||
}
|
}
|
||||||
|
@ -66,6 +67,10 @@
|
||||||
document.getElementById("obj_resp").innerHTML = "object created";
|
document.getElementById("obj_resp").innerHTML = "object created";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
document.getElementById("obj_resp").innerHTML = "image not selected";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// load_obj("asd",(data)=>{
|
// load_obj("asd",(data)=>{
|
||||||
|
|
|
@ -52,13 +52,15 @@
|
||||||
<script>
|
<script>
|
||||||
function new_proj(){
|
function new_proj(){
|
||||||
let name = ask();
|
let name = ask();
|
||||||
goto(`/proj/${name}`);
|
if(name != null && name!= "" && name!=" " && typeof name != "undefined" && name!="undefined"){
|
||||||
|
goto(`/proj/${name}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
load_projs((projs)=>{
|
load_projs((projs)=>{
|
||||||
projs.forEach(proj => {
|
projs.forEach(proj => {
|
||||||
// console.log(proj);
|
// console.log(proj);
|
||||||
let div = document.getElementById("projs_div");
|
let div = document.getElementById("projs_div");
|
||||||
div.innerHTML += `<button id='proj_${proj["name"]}' class='proj' onclick="goto('/proj/${proj["name"]}')"><img height="200" width="300" src='${proj["img"]}' alt='${proj["name"]}'></img> <br>${proj["name"]}</button>`;
|
div.innerHTML += `<button id='proj_${proj["name"]}' class='proj' onclick="goto('/proj/${proj["name"]}')"><img height="200" width="290" src='${proj["img"]}' alt='${proj["name"]}'></img> <br>${proj["name"]}</button>`;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -18,10 +18,6 @@
|
||||||
width: 80%;
|
width: 80%;
|
||||||
transition: background-color 0.3s;
|
transition: background-color 0.3s;
|
||||||
}
|
}
|
||||||
body {
|
|
||||||
height: 100%;
|
|
||||||
overflow-y: visible;
|
|
||||||
}
|
|
||||||
.createzone {
|
.createzone {
|
||||||
background-color: #bfe4ff;
|
background-color: #bfe4ff;
|
||||||
border: dashed 4px transparent;
|
border: dashed 4px transparent;
|
||||||
|
@ -82,6 +78,7 @@
|
||||||
width: 80vw;
|
width: 80vw;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
padding-block: 20px;
|
padding-block: 20px;
|
||||||
|
padding-bottom: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wall{
|
.wall{
|
||||||
|
@ -127,14 +124,14 @@
|
||||||
<label for="wall_height">height </label>
|
<label for="wall_height">height </label>
|
||||||
<div id="wall_height_value">0</div>
|
<div id="wall_height_value">0</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="range" step="0.1" min="0.9" max="4" id="wall_height" value="2" oninput="wall_size_change('height')">
|
<input type="range" step="0.1" min="0" max="4.9" id="wall_height" value="2" oninput="wall_size_change('height')">
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div style="display: flex;width: 150px;justify-content: space-between;">
|
<div style="display: flex;width: 150px;justify-content: space-between;">
|
||||||
<label for="wall_width">width</label>
|
<label for="wall_width">width</label>
|
||||||
<div id="wall_width_value">0</div>
|
<div id="wall_width_value">0</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="range" step="0.1" min="1.9" max="7" id="wall_width" value="4" oninput="wall_size_change('width')">
|
<input type="range" step="0.1" min="0" max="6.9" id="wall_width" value="4" oninput="wall_size_change('width')">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="czones">
|
<div class="czones">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user