404, obj layer, cache, ask,
This commit is contained in:
parent
17b2569334
commit
69403052c5
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
/node_modules
|
||||
/mysql
|
||||
docker-compose.yaml
|
||||
docker-compose.yaml
|
||||
/public/img/object
|
63
index.js
63
index.js
|
@ -29,40 +29,25 @@ const app = express();
|
|||
// const { name } = require('ejs');
|
||||
|
||||
const maxRequestBodySize = '20mb';
|
||||
let cache_options = {
|
||||
maxAge: "4d",
|
||||
etag: false
|
||||
}
|
||||
app.set('view engine', 'ejs');
|
||||
app.use(express.urlencoded({
|
||||
extended: false,
|
||||
limit: maxRequestBodySize
|
||||
}));
|
||||
app.use(express.static('public'));
|
||||
app.use(express.static('public',cache_options));
|
||||
app.use(cookieParser());
|
||||
|
||||
|
||||
|
||||
/// user
|
||||
app.get('/', (req, res) => {
|
||||
let inp = req.body;
|
||||
let cook = req.cookies;
|
||||
func.sid(cook,res,(include)=>{
|
||||
if(include){
|
||||
res.redirect('main');
|
||||
}
|
||||
else{
|
||||
res.redirect('login');
|
||||
}
|
||||
},false)
|
||||
});
|
||||
app.get("/login" , (req,res) =>{
|
||||
res.render('login');
|
||||
})
|
||||
app.get("/main", (req,res) =>{try{
|
||||
let inp = req.body;
|
||||
let cook = req.cookies;
|
||||
func.sid(cook,res,()=>{
|
||||
res.render('main');
|
||||
})
|
||||
} catch (error) {func.log("router getting user information by uuid error - "+error);}
|
||||
});
|
||||
|
||||
app.post('/back_login', (req, res) => {try {
|
||||
let inp = req.body;
|
||||
let cook = req.cookies;
|
||||
|
@ -360,6 +345,39 @@ app.post("/admin/users/find", (req,res) => {try{
|
|||
})
|
||||
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
let inp = req.body;
|
||||
let cook = req.cookies;
|
||||
func.sid(cook,res,(include)=>{
|
||||
if(include){
|
||||
res.redirect('main');
|
||||
}
|
||||
else{
|
||||
res.redirect('login');
|
||||
}
|
||||
},false)
|
||||
});
|
||||
app.get("/main", (req,res) =>{try{
|
||||
let inp = req.body;let cook = req.cookies;
|
||||
func.sid(cook,res,()=>{
|
||||
res.render('main');
|
||||
})
|
||||
} catch (error) {func.log("router getting user information by uuid error - "+error);}
|
||||
});
|
||||
app.get("/help", (req,res) =>{try{
|
||||
let inp = req.body;let cook = req.cookies;
|
||||
func.sid(cook,res,()=>{
|
||||
res.render('help');
|
||||
})
|
||||
} catch (error) {func.log("router getting user information by uuid error - "+error);}
|
||||
});
|
||||
app.get("/temp", (req,res) =>{try{
|
||||
let inp = req.body;let cook = req.cookies;
|
||||
func.sid(cook,res,()=>{
|
||||
res.render('templates');
|
||||
})
|
||||
} catch (error) {func.log("router getting user information by uuid error - "+error);}
|
||||
});
|
||||
app.get("/htc/:hex",(req,res) =>{
|
||||
res.send(CssFilterConverter.hexToFilter(`#${req.params["hex"]}`));
|
||||
})
|
||||
|
@ -368,6 +386,7 @@ app.post("/color",(req,res) =>{
|
|||
func.img_recolor(res,inp["img"],inp["hex"]);
|
||||
})
|
||||
app.all('*', (req, res) => {
|
||||
res.status(404).send('<h1>404! Page not</h1> <br> <a href="/">go to main page</a>');
|
||||
res.status(404)
|
||||
res.render("static/404");
|
||||
});
|
||||
app.listen(process.env.PORT || 8080, () => func.log("server for puzzle started UwU"));
|
|
@ -10,7 +10,7 @@ module.exports.loads = (inp,cook,res)=>{
|
|||
let gin
|
||||
if (typeof inp["gid"] == 'undefined' || inp["gid"] == null) gin = "1 OR 1=1"
|
||||
else gin = inp["gid"]
|
||||
db.ggv("objects","`name`,`id`,`height`,`width`,`cost`,`gid`,`colors`,`pid`","gid",`${gin}`,(odata)=>{
|
||||
db.ggv("objects","`name`,`id`,`height`,`width`,`cost`,`gid`,`colors`,`pid`,`img`","gid",`${gin}`,(odata)=>{
|
||||
// func.log(odata);
|
||||
res.send({out:"good",body:odata});
|
||||
})
|
||||
|
|
33
project.js
33
project.js
|
@ -85,30 +85,29 @@ module.exports.del = (inp,cook,res)=>{
|
|||
module.exports.save = (inp,cook,res)=>{
|
||||
try {
|
||||
db.gv("users","uuid",`'${cook["uuid"]}'`, (udata)=>{ udata = udata[0]
|
||||
db.gv("projects","uid",udata["id"],(pdata)=>{
|
||||
db.ggv("projects","`id`,`uid`","name",`'${inp["name"]}'`,(pdata)=>{pdata = pdata[0]
|
||||
var date = moment().format('YYYY-MM-DD');
|
||||
var time = moment().format('hh:mm:ss');
|
||||
let projin = null;
|
||||
// func.log(pdata);
|
||||
pdata.forEach(projt => {
|
||||
if(projt["name"] == inp["name"] && projt["uid"] == udata["id"]){
|
||||
projin = projt;
|
||||
return;
|
||||
}
|
||||
})
|
||||
if(projin == null){
|
||||
if(pdata == null){
|
||||
// func.log("proj not in");
|
||||
// func.log(pname,udata["id"],proj);
|
||||
func.log(`good boy ${udata["uuid"]} created project ${inp["name"]} from ${cook["sid"]}`);
|
||||
db.nr("projects","`uid`,`name`,`body`,`img`,creation_date",`'${udata["id"]}','${inp["name"]}','${inp["proj"]}','${inp["img"]}','${date+"T"+time}'`);
|
||||
res.send({out:"good"});
|
||||
} else if (projin != null){
|
||||
db.sv("projects","body",inp["proj"],"id",projin["id"],()=>{});
|
||||
db.sv("projects","last_change_date",`${date+"T"+time}`,"id",projin["id"],()=>{});
|
||||
if(inp["img"] != "") db.sv("projects","img",inp["img"],"id",projin["id"],()=>{});
|
||||
func.log(`good boy ${udata["uuid"]} saved project ${projin["name"]} from ${cook["sid"]}`);
|
||||
// func.log("proj in");
|
||||
res.send({out:"good"});
|
||||
} else if (pdata != null && pdata["uid"] == udata["id"]){
|
||||
if(inp["proj"] != JSON.stringify({height:"2",width:"4"})){
|
||||
db.gv("projects","id",pdata["id"],(projin)=>{projin = projin[0]
|
||||
db.sv("projects","body",inp["proj"],"id",projin["id"],()=>{});
|
||||
db.sv("projects","last_change_date",`${date+"T"+time}`,"id",projin["id"],()=>{});
|
||||
if(inp["img"] != "") db.sv("projects","img",inp["img"],"id",projin["id"],()=>{});
|
||||
func.log(`good boy ${udata["uuid"]} saved project ${projin["name"]} from ${cook["sid"]}`);
|
||||
// func.log("proj in");
|
||||
res.send({out:"good"});
|
||||
})
|
||||
}
|
||||
else{
|
||||
res.send({out:"bad",err:"proj"});
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
BIN
public/img/icon/down.png
Normal file
BIN
public/img/icon/down.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
public/img/icon/up.png
Normal file
BIN
public/img/icon/up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
|
@ -82,11 +82,12 @@ function logout(redirect = true) {
|
|||
}});
|
||||
}
|
||||
|
||||
function ask(text,def = "") {
|
||||
let name = prompt(text,def);
|
||||
if(name != "" && name != " "){
|
||||
return name;
|
||||
}
|
||||
function ask(text,params={def:"",func}) {
|
||||
msg(text,{type:"enter",def:params.def,res:(out)=>{
|
||||
if(out != false){
|
||||
params.func(out);
|
||||
}
|
||||
}})
|
||||
}
|
||||
|
||||
|
||||
|
@ -315,4 +316,59 @@ async function removeImageBackground(image) {
|
|||
})
|
||||
.catch(console.error);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function img_cache(callback){
|
||||
function preloadImages(array,callback) {
|
||||
// let wait_msg = msg("кеширование картинок",{type:"wait"})
|
||||
if (!preloadImages.list) {
|
||||
preloadImages.list = [];
|
||||
}
|
||||
var list = preloadImages.list;
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
console.log(array[i],is_cached(array[i]));
|
||||
if(!is_cached(array[i])){
|
||||
var img = new Image();
|
||||
img.onload = function() {
|
||||
var index = list.indexOf(this);
|
||||
if (index !== -1) {
|
||||
list.splice(index, 1);
|
||||
}
|
||||
// if(i==array.length-1){
|
||||
// msg_del(wait_msg.id);
|
||||
// }
|
||||
}
|
||||
list.push(img);
|
||||
img.src = array[i];
|
||||
if(i==array.length-1){
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$.post( "/get_objs")
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
// console.log(res["body"]);
|
||||
let sources = [];
|
||||
res["body"].forEach(element => {
|
||||
sources.push(element["img"]);
|
||||
if(element == res["body"].at(-1)){
|
||||
// console.log(sources);
|
||||
preloadImages(sources,()=>{
|
||||
// console.log("cached");
|
||||
callback();
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function is_cached(img_url){
|
||||
var imgEle = document.createElement("img");
|
||||
imgEle.src = img_url;
|
||||
return imgEle.complete || (imgEle.width+imgEle.height) > 0;
|
||||
}
|
||||
}
|
|
@ -2,7 +2,6 @@ window.dragMoveListener = dragMoveListener;
|
|||
let root = document.getElementById("drags");
|
||||
let objs = { height:"2",width:"4",color:"#FFFFFF"};
|
||||
let objs_store = {};
|
||||
let objs_imgs = {};
|
||||
let proj_from = "cloud";
|
||||
let cur_obj;
|
||||
let objs_back = [];
|
||||
|
@ -10,7 +9,7 @@ let objs_forw = [];
|
|||
let proj_state = "loading";
|
||||
let cm_mod = 2;
|
||||
|
||||
function create(clas,x,y,color = null,id,size){
|
||||
function create(clas,x,y,color = null,id,size,layer = 0){
|
||||
let main_clas = clas.split(" ")[0];
|
||||
// if (body == null || body == "") body = "[]";
|
||||
let obj = document.createElement("img");
|
||||
|
@ -39,15 +38,7 @@ function create(clas,x,y,color = null,id,size){
|
|||
// }
|
||||
}
|
||||
else if (db_data != null){
|
||||
if (objs_imgs[main_clas] == null){
|
||||
load_obj(main_clas,"`img`",(odata)=>{
|
||||
objs_imgs[main_clas] = odata["img"];
|
||||
make(odata["img"]);
|
||||
})
|
||||
}
|
||||
else{
|
||||
make(objs_imgs[main_clas])
|
||||
}
|
||||
make(objs_store[main_clas]["img"])
|
||||
}
|
||||
function make(img){
|
||||
// console.log(db_data);
|
||||
|
@ -55,7 +46,7 @@ function create(clas,x,y,color = null,id,size){
|
|||
obj.title = `${db_data["name"].replaceAll("$"," ").split("~g")[0]}\nцена:${db_data["cost"]}\nширина:${db_data["width"]}см высота:${db_data["height"]}см`;
|
||||
obj.setAttribute("cost",db_data["cost"])
|
||||
obj.setAttribute("colors",Boolean(db_data["colors"]))
|
||||
obj.setAttribute("img",img)
|
||||
obj.setAttribute("data-img",img)
|
||||
obj.setAttribute("gid",db_data["gid"])
|
||||
obj.setAttribute("pid",db_data["pid"])
|
||||
obj.setAttribute("color",color)
|
||||
|
@ -70,7 +61,18 @@ function create(clas,x,y,color = null,id,size){
|
|||
}
|
||||
calc_total();
|
||||
})
|
||||
obj.setAttribute("onclick",`obj_click("${id}")`);
|
||||
obj.setAttribute("decoding","async");
|
||||
obj.setAttribute("loading","lazy");
|
||||
if(id != "none"){obj.setAttribute("onclick",`obj_click("${id}")`);}
|
||||
// console.log(main_clas);
|
||||
if(main_clas.split("~p~").at(-1) == "Бизиборды"){
|
||||
obj.setAttribute("layer",99999);
|
||||
obj.style.zIndex = 99999;
|
||||
}
|
||||
else{
|
||||
obj.setAttribute("layer",layer);
|
||||
obj.style.zIndex = layer;
|
||||
}
|
||||
root.append(obj);
|
||||
set_pos(obj,x,y);
|
||||
}
|
||||
|
@ -78,6 +80,10 @@ function create(clas,x,y,color = null,id,size){
|
|||
function obj_click(id){
|
||||
if (cur_obj != id){
|
||||
let obj = document.getElementById(id);
|
||||
|
||||
let cur_layer = obj.style.zIndex;
|
||||
document.getElementById("layer_inp").value = cur_layer;
|
||||
|
||||
cur_obj = id;
|
||||
if (obj.getAttribute("colors") == "true"){
|
||||
clear_palette();
|
||||
|
@ -91,20 +97,22 @@ function obj_click(id){
|
|||
else{
|
||||
document.getElementById("obj_color_div").style.display = "none";
|
||||
}
|
||||
obj_selection();
|
||||
// console.log(obj.);
|
||||
}
|
||||
// function obj_selection(){
|
||||
// let drags = document.getElementsByClassName("drag");
|
||||
// Object.values(drags).forEach(element => {
|
||||
// console.log(element.id,cur_obj);
|
||||
// if (element.id != cur_obj){
|
||||
// element.style.border = "0px";
|
||||
// }
|
||||
// else{
|
||||
// element.style.border = "1px black solid";
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
function obj_selection(){
|
||||
let drags = document.getElementsByClassName("drag");
|
||||
Object.values(drags).forEach(element => {
|
||||
// console.log(element.id,cur_obj);
|
||||
if (element.id != cur_obj){
|
||||
element.style.border = "0px";
|
||||
}
|
||||
else{
|
||||
element.style.border = "2px black solid";
|
||||
element.style.borderRadius = "0.2vw";
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function resize_drags(){
|
||||
|
@ -191,7 +199,7 @@ function load(objss){
|
|||
// console.log(keys,value["x"],value["y"],value["body"]);
|
||||
// let count = Object.keys(objs[keys]).length;
|
||||
// console.log(count);
|
||||
create(keys+" drag",value["x"],value["y"],value["color"],key,true);
|
||||
create(keys+" drag",value["x"],value["y"],value["color"],key,true,value["layer"]);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -205,7 +213,6 @@ function load(objss){
|
|||
document.getElementById("wall").style.backgroundColor = values;
|
||||
}
|
||||
if (keys == Object.keys(objs).at(-1)){
|
||||
loaded();
|
||||
proj_state = "loaded";
|
||||
}
|
||||
});
|
||||
|
@ -234,7 +241,7 @@ function load_proj_cloud(){
|
|||
// document.getElementById("top_panel_center").innerText = `${proj_name} (облако)`;
|
||||
}
|
||||
else if(res["out"] == "bad proj"){
|
||||
console.log("bad");
|
||||
// console.log("bad");
|
||||
save(()=>{
|
||||
goto("/proj/load/"+proj_name);
|
||||
},false);
|
||||
|
@ -284,13 +291,13 @@ function save(callback,with_pic = true){
|
|||
|
||||
function load_objs(callback,group){
|
||||
// let select = document.getElementById("group_select");
|
||||
console.log(group);
|
||||
// console.log(group);
|
||||
$.post( "/get_objs",{gid:group})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
// console.log(res["body"]);
|
||||
res["body"].forEach(element => {
|
||||
objs_store[`${element["name"]}`] = {height:element["height"],width:element["width"],id:element["id"],name:element["name"],cost:element["cost"],colors:element["colors"],gid:element["gid"],pid:element["pid"]}
|
||||
objs_store[`${element["name"]}`] = {img:element["img"],height:element["height"],width:element["width"],id:element["id"],name:element["name"],cost:element["cost"],colors:element["colors"],gid:element["gid"],pid:element["pid"]}
|
||||
});
|
||||
callback(res["body"]);
|
||||
}
|
||||
|
@ -320,7 +327,7 @@ function load_obj(name,key,callback){
|
|||
|
||||
function dragMoveListener (event) {
|
||||
var drag = event.target
|
||||
obj_click(drag.id)
|
||||
if(drag.id != "none"){obj_click(drag.id)}
|
||||
var x = (parseFloat(drag.getAttribute('data-x')) || 0) + event.dx
|
||||
var y = (parseFloat(drag.getAttribute('data-y')) || 0) + event.dy
|
||||
set_pos(drag,x,y);
|
||||
|
@ -381,7 +388,7 @@ interact('.dropzone').dropzone({
|
|||
ondrop: function (event) {var drag = event.relatedTarget
|
||||
|
||||
if (proj_state == "loaded"){objs_back.push(JSON.parse(JSON.stringify(objs)));}
|
||||
objs[drag.classList[0]][drag.id] = {y:drag.getAttribute('data-y'),x:drag.getAttribute('data-x'),body:drag.innerHTML,color:drag.getAttribute("color")};
|
||||
objs[drag.classList[0]][drag.id] = {y:drag.getAttribute('data-y'),x:drag.getAttribute('data-x'),body:drag.innerHTML,color:drag.getAttribute("color"),layer:drag.getAttribute('layer')};
|
||||
drag.classList.add('in_zone');drag.classList.remove('can-drop');
|
||||
// console.log(objs["KeyBoard~g~не$основное"]["KeyBoard~g~не$основное_1"]);
|
||||
|
||||
|
@ -408,7 +415,7 @@ interact('.createzone').dropzone({
|
|||
})
|
||||
let x = zone.getBoundingClientRect().left - document.getElementById("drags").getBoundingClientRect().left;
|
||||
let y = zone.getBoundingClientRect().top - document.getElementById("drags").getBoundingClientRect().top;
|
||||
create(`${zone.classList[0]} spawn drag`,x,y,null,`none`);
|
||||
create(`${zone.classList[0]} spawn drag`,x,y,null,`none`,false,0);
|
||||
if (proj_state == "loaded"){objs_back.push(JSON.parse(JSON.stringify(objs)));}
|
||||
drag.classList.remove('spawn');
|
||||
}
|
||||
|
@ -429,7 +436,7 @@ function drag_start() {
|
|||
Object.entries(zones).forEach(([key, zone]) => {
|
||||
let x = zone.getBoundingClientRect().left - document.getElementById("drags").getBoundingClientRect().left;
|
||||
let y = zone.getBoundingClientRect().top - document.getElementById("drags").getBoundingClientRect().top;
|
||||
create(`${zone.classList[0]} spawn drag`,x,y,null,`none`);
|
||||
create(`${zone.classList[0]} spawn drag`,x,y,null,`none`,false,0);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -49,15 +49,16 @@
|
|||
}
|
||||
function del_color(){
|
||||
let color_id = document.getElementById(cur_color).getAttribute("color_id")
|
||||
let wait_msg = msg("удаление цвета",{type:"wait"})
|
||||
$.post( "/admin/colors/delete", {id:color_id})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
msg_del(wait_msg.id);
|
||||
msg("цвет удалён");
|
||||
obj_colors_load();
|
||||
console.log(res["body"]);
|
||||
}
|
||||
});
|
||||
msg("Удалить этот цвет?",{type:"ask",res:(out)=>{if(out){
|
||||
$.post( "/admin/colors/delete", {id:color_id})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
msg("цвет удалён");
|
||||
obj_colors_load();
|
||||
console.log(res["body"]);
|
||||
}
|
||||
});
|
||||
}}})
|
||||
|
||||
}
|
||||
</script>
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
<h1>Изменение объектов</h1>
|
||||
<div>
|
||||
<div id="objs_in_group" style="max-height: 20vh;height: 20vh;"></div>
|
||||
<div id="objs_in_group"></div>
|
||||
</div>
|
||||
<div style="display: flex;justify-content: space-between;float: right;">
|
||||
<div id="find_obj_btns">
|
||||
|
@ -86,7 +86,7 @@
|
|||
function obj_del(id){
|
||||
// let select = document.getElementById("group_select");
|
||||
let menu = document.getElementById(`object_${id}`);
|
||||
if (confirm(`вы точно хотите удалить ${menu.getAttribute("name").split("~")[0]}?`)){
|
||||
msg(`вы точно хотите удалить ${menu.getAttribute("name").split("~")[0]}?`,{type:"ask",res:(out)=>{if(res){
|
||||
let wait_msg = msg("удаление товара",{type:"wait"});
|
||||
$.post( "/admin/objects/delete", { id:id,})
|
||||
.done(function( res ) {
|
||||
|
@ -96,7 +96,7 @@
|
|||
edit_get_objs();
|
||||
}
|
||||
});
|
||||
}
|
||||
}}})
|
||||
}
|
||||
|
||||
function save_edited_obj(id){
|
||||
|
@ -194,16 +194,16 @@
|
|||
});
|
||||
}
|
||||
else{
|
||||
let name = ask("название");
|
||||
if(name != "")[
|
||||
$.post( "/admin/objects/find", { name:name.replaceAll(" ","$")})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
// console.log(res["body"]);
|
||||
callback(res["body"])
|
||||
}
|
||||
})
|
||||
]
|
||||
ask("название",{func:(name)=>{
|
||||
$.post( "/admin/objects/find", { name:name.replaceAll(" ","$")})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
// console.log(res["body"]);
|
||||
callback(res["body"])
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,57 +86,59 @@
|
|||
let name = document.getElementById("group_drop-"+pid).innerText;
|
||||
msg(`вы уверены вы хотите удалить раздел ${name}`,{type:"ask",res:(out)=>{
|
||||
if(out == true){
|
||||
$.post( "/admin/parts/delete", {pid:pid})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
// console.log(res["body"]);
|
||||
// load_groups();
|
||||
edit_get_objs();
|
||||
hide_menus();
|
||||
setTimeout(()=>{
|
||||
parts_load();
|
||||
msg(`раздел ${name} удалён`)
|
||||
},500)
|
||||
}
|
||||
});
|
||||
}
|
||||
$.post( "/admin/parts/delete", {pid:pid})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
// console.log(res["body"]);
|
||||
// load_groups();
|
||||
edit_get_objs();
|
||||
hide_menus();
|
||||
setTimeout(()=>{
|
||||
parts_load();
|
||||
msg(`раздел ${name} удалён`)
|
||||
},500)
|
||||
}
|
||||
});
|
||||
}
|
||||
}})
|
||||
}
|
||||
function create_new_group(pid) {
|
||||
let group_name = ask("название группы");
|
||||
if(group_name != null && group_name != ""){
|
||||
$.post( "/admin/groups/new", { name:group_name.replaceAll(" ","$"),pid:pid})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
// console.log(res["body"]);
|
||||
// load_groups();
|
||||
edit_get_objs();
|
||||
hide_menus();
|
||||
setTimeout(()=>{
|
||||
parts_load();
|
||||
msg(`группа ${group_name.replaceAll(" ","$")} создана`)
|
||||
},500)
|
||||
}
|
||||
});
|
||||
}
|
||||
ask("название группы",{func:(group_name)=>{
|
||||
if(group_name != null && group_name != ""){
|
||||
$.post( "/admin/groups/new", { name:group_name.replaceAll(" ","$"),pid:pid})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
// console.log(res["body"]);
|
||||
// load_groups();
|
||||
edit_get_objs();
|
||||
hide_menus();
|
||||
setTimeout(()=>{
|
||||
parts_load();
|
||||
msg(`группа ${group_name.replaceAll(" ","$")} создана`)
|
||||
},500)
|
||||
}
|
||||
});
|
||||
}
|
||||
}});
|
||||
}
|
||||
|
||||
function create_new_part() {
|
||||
let part_name = ask("название раздела");
|
||||
if(part_name != null && part_name != ""){
|
||||
$.post( "/admin/parts/new", { name:part_name.replaceAll(" ","$")})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
// console.log(res["body"]);
|
||||
// load_groups();
|
||||
hide_menus();
|
||||
setTimeout(()=>{
|
||||
parts_load();
|
||||
msg(`раздел ${part_name.replaceAll(" ","$")} создан`)
|
||||
},500)
|
||||
ask("название раздела",{func:(part_name)=>{
|
||||
if(part_name != null && part_name != ""){
|
||||
$.post( "/admin/parts/new", { name:part_name.replaceAll(" ","$")})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
// console.log(res["body"]);
|
||||
// load_groups();
|
||||
hide_menus();
|
||||
setTimeout(()=>{
|
||||
parts_load();
|
||||
msg(`раздел ${part_name.replaceAll(" ","$")} создан`)
|
||||
},500)
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}})
|
||||
}
|
||||
|
||||
function parts_load(){
|
||||
|
|
|
@ -115,22 +115,23 @@
|
|||
});
|
||||
}
|
||||
else{
|
||||
let login = ask("имя");
|
||||
if (login != ""){
|
||||
form = 0;
|
||||
$.post( "/admin/users/find",{login:login,from:from,load_interval:load_interval})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
res["body"].forEach(user => {
|
||||
make_user(user,res);
|
||||
});
|
||||
}
|
||||
else if(res["out"] == "bad"){
|
||||
msg("нет пользователя с таким иминем")
|
||||
load_users_data(users_from);
|
||||
}
|
||||
});
|
||||
}
|
||||
ask("имя",{func:(out)=>{
|
||||
if(out != null && out != "" && out != " "){
|
||||
from = 0;
|
||||
$.post( "/admin/users/find",{login:out,from:from,load_interval:load_interval})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
res["body"].forEach(user => {
|
||||
make_user(user,res);
|
||||
});
|
||||
}
|
||||
else if(res["out"] == "bad"){
|
||||
msg("нет пользователя с таким иминем")
|
||||
load_users_data(users_from);
|
||||
}
|
||||
});
|
||||
}
|
||||
}})
|
||||
}
|
||||
|
||||
function make_user(user,res){
|
||||
|
@ -205,16 +206,21 @@
|
|||
let pass= document.getElementById(`pass_${id}`).innerText;
|
||||
let value = null;
|
||||
if (key == 'login' || key == "pass") {
|
||||
value = ask(`изменение ${key} пользователя ${login}`,document.getElementById(`${key}_${id}`).innerText);
|
||||
ask(`изменение ${key} пользователя ${login}`,{def:document.getElementById(`${key}_${id}`).innerText,func:(out)=>{
|
||||
if(out != null && out != "" && out != " "){
|
||||
make(out);
|
||||
}
|
||||
}});
|
||||
}
|
||||
else if (key == "admin"){
|
||||
value = admin;
|
||||
make(value)
|
||||
}
|
||||
else if (key == "rights"){
|
||||
value = args[0]["rights"];
|
||||
make(value)
|
||||
}
|
||||
|
||||
if(value != null){
|
||||
function make(value){
|
||||
$.post( "/admin/users/edit",{key:key,value:value,id:id,login:login})
|
||||
.done(function( res ) {
|
||||
// console.log("serv reg");
|
||||
|
@ -261,14 +267,15 @@
|
|||
}
|
||||
function user_del(id){
|
||||
let login = document.getElementById(`login_${id}`).innerText;
|
||||
if(confirm(`вы точно хотите удалить пользователя ${login}?`) == true){
|
||||
$.post( "/admin/users/delete",{login:login,id:id})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
load_users_data(users_from);
|
||||
}
|
||||
});
|
||||
}
|
||||
msg(`вы точно хотите удалить пользователя ${login}?`,{type:"ask",res:(out)=>{if(out){
|
||||
$.post( "/admin/users/delete",{login:login,id:id})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
load_users_data(users_from);
|
||||
}
|
||||
});
|
||||
}
|
||||
}})
|
||||
}
|
||||
|
||||
let user_edit_menu = document.createElement("div");user_edit_menu.id = "user_edit_menu"; user_edit_menu.classList.add("cmenu");
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
<div id="top_panel_left" class="tpanel"></div>
|
||||
<div id="top_panel_center" class="tpanel">
|
||||
<button id="page_btn_main" onclick="goto('/main')">Мои проекты</button>
|
||||
<button id="page_btn_tamp" onclick="goto('/tamp')">Шаблоны</button>
|
||||
<button id="page_btn_tamp" onclick="goto('/temp')">Шаблоны</button>
|
||||
<button id="page_btn_gallery" onclick="goto('/gallery')">Галерея</button>
|
||||
<button id="page_btn_faq" onclick="goto('/faq')">FAQ</button>
|
||||
<button id="page_btn_help" onclick="goto('/help')">Связаться с поддержкой</button>
|
||||
|
@ -162,6 +162,7 @@
|
|||
|
||||
let menu = document.getElementById("top_panel_center");
|
||||
if (res["admin"] == true){
|
||||
if (typeof admin != "undefined"){Object.values(admin).forEach(afunc => {afunc()});}
|
||||
menu.innerHTML += `<button id="page_btn_admin" onclick='goto("/admin")'>Админ. панель</button><br>`;
|
||||
switch (document.URL.split("/").at(-1)) {
|
||||
case ("admin"):document.getElementById("page_btn_admin").style.border = "1px solid black";break;
|
||||
|
|
16
views/help.ejs
Normal file
16
views/help.ejs
Normal file
|
@ -0,0 +1,16 @@
|
|||
<%- include('./static/start.ejs',{name:'help',async: true}) %>
|
||||
<%- include('./header.ejs') %>
|
||||
|
||||
|
||||
<section class="main">
|
||||
<div>
|
||||
<h1>Морской Сергей Юрьевич - руководитель проекта:</h1>
|
||||
<div style="display: flex;"><h1 style="margin-right: 1vw;">Kонтакты:</h1><img style="margin: auto 0px;cursor: pointer;" onclick="goto('https://tlgg.ru/@teleanonym')" src="/img/telegram.svg"></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<%- include('./static/end.ejs',{soc:true}) %>
|
||||
<script>
|
||||
setTimeout(()=>{loaded()},500);
|
||||
</script>
|
|
@ -30,7 +30,7 @@
|
|||
cursor: pointer;
|
||||
}
|
||||
#load_help{
|
||||
width: 12vw;
|
||||
/* width: 12vw; */
|
||||
justify-content: space-between;
|
||||
position:absolute;
|
||||
top:50%;
|
||||
|
@ -47,7 +47,14 @@
|
|||
|
||||
<div id="load_div">
|
||||
<img id="load_logo" src="/img/Умничка лого с обводкой-02 1.png" onclick="goto('/')" alt="">
|
||||
<div id="load_help"><a href="">reload</a><br><a href="/main">go to main page</a></div>
|
||||
<div id="load_help">
|
||||
<div>Страница Долго загружается?</div>
|
||||
<div>Вы можете</div>
|
||||
<br>
|
||||
<div><a href="">Перезагрузить</a><br><a href="/main">На главную страницу</a></div>
|
||||
<br>
|
||||
<div>Но лучьше подождать</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
@ -100,5 +107,5 @@
|
|||
if(page_state != "loaded"){
|
||||
document.getElementById("load_help").style.display = "block";
|
||||
}
|
||||
},7000)
|
||||
},5000)
|
||||
</script>
|
|
@ -141,9 +141,10 @@
|
|||
// logo.style.transform = 'translate(-40vw,-20vh)';
|
||||
// logo.style.position = "absolute"
|
||||
function log(){
|
||||
const login = CryptoJS.AES.encrypt(document.getElementById('login').value,$.cookie("sid")).toString();
|
||||
const pass = CryptoJS.AES.encrypt(document.getElementById('pass').value,$.cookie("sid")).toString();
|
||||
const sid = $.cookie("sid");
|
||||
console.log(sid);
|
||||
const login = CryptoJS.AES.encrypt(document.getElementById('login').value,sid).toString();
|
||||
const pass = CryptoJS.AES.encrypt(document.getElementById('pass').value,sid).toString();
|
||||
if(login!=""&&pass!=""){
|
||||
$.post( "/back_login", { login:login,pass:pass,sid:sid })
|
||||
.done(function( res ) {
|
||||
|
|
|
@ -61,24 +61,25 @@
|
|||
});
|
||||
}
|
||||
function new_proj(objs = null){
|
||||
let name = ask("please enter project name");
|
||||
objs = (objs == null)? { height:"2",width:"4"}:objs;
|
||||
if(name != null && name!= "" && name!=" " && typeof name != "undefined" && name!="undefined"){
|
||||
$.post( "/save_proj", {proj:JSON.stringify(objs),name:name,img:"/img/proj_placeholder.webp"})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
// console.log(scr)
|
||||
// console.log("good");
|
||||
// if(callback) callback(res);
|
||||
goto(`/proj/load/${name}`);
|
||||
}
|
||||
})
|
||||
}
|
||||
let name = ask("Введите название проекта ",{func:(name)=>{
|
||||
objs = (objs == null)? { height:"2",width:"4"}:objs;
|
||||
if(name != null && name!= "" && name!=" " && typeof name != "undefined" && name!="undefined"){
|
||||
$.post( "/save_proj", {proj:JSON.stringify(objs),name:name,img:"/img/proj_placeholder.webp"})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
goto(`/proj/load/${name}`);
|
||||
}
|
||||
else if(res["out"] == "bad" && res["err"] == "proj"){
|
||||
msg("Проект уже существует")
|
||||
}
|
||||
})
|
||||
}
|
||||
}});
|
||||
}
|
||||
load_projs((projs)=>{
|
||||
console.log(projs);
|
||||
if(projs.length == 0){
|
||||
setTimeout(loaded(),1000)
|
||||
setTimeout(()=>{loaded()},500);
|
||||
}
|
||||
else{
|
||||
projs.forEach(proj => {
|
||||
|
@ -99,7 +100,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</button>`;
|
||||
setTimeout(loaded(),1000)
|
||||
setTimeout(()=>{loaded()},500);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -112,37 +113,52 @@
|
|||
}
|
||||
|
||||
function del_proj(proj_name){
|
||||
let del = confirm(`удалить проект ${proj_name}?`);
|
||||
if(del == true){
|
||||
$.post( "/proj/delete",{name:proj_name})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
goto("/main")
|
||||
}
|
||||
})
|
||||
}
|
||||
msg(`удалить проект ${proj_name}?`,{type:"ask",res:(out)=>{
|
||||
if(out){
|
||||
$.post( "/proj/delete",{name:proj_name})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
goto("/main")
|
||||
}
|
||||
})
|
||||
}
|
||||
}})
|
||||
}
|
||||
|
||||
function copy_proj(proj){
|
||||
$.post( "/load_proj",{name:proj})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
new_proj(JSON.parse(res["body"]))
|
||||
let name = ask("Введите название копии проекта ",{func:(name)=>{
|
||||
if(name != null && name!= "" && name!=" " && typeof name != "undefined" && name!="undefined"){
|
||||
$.post( "/save_proj", {proj:res["body"],name:name,img:"/img/proj_placeholder.webp"})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
goto(`/proj/load/${name}`);
|
||||
}
|
||||
else if(res["out"] == "bad" && res["err"] == "proj"){
|
||||
msg("Проект уже существует")
|
||||
}
|
||||
})
|
||||
}
|
||||
}});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function rename_proj(name){
|
||||
let cur_proj = document.getElementById(`proj_${name}`);
|
||||
let new_name = ask(`новое имя для проекта ${name}`);
|
||||
if(new_name != null){
|
||||
$.post( "/proj/rename",{name:new_name,id:cur_proj.getAttribute("proj_id")})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
goto("/main");
|
||||
}
|
||||
})
|
||||
}
|
||||
ask(`новое имя для проекта ${name}`,{func:(new_name)=>{
|
||||
if(new_name != null){
|
||||
$.post( "/proj/rename",{name:new_name,id:cur_proj.getAttribute("proj_id")})
|
||||
.done(function( res ) {
|
||||
if(res["out"] == "good"){
|
||||
goto("/main");
|
||||
}
|
||||
})
|
||||
}
|
||||
}});
|
||||
}
|
||||
</script>
|
||||
<%- include('./static/end.ejs',{soc:true}) %>
|
|
@ -17,6 +17,7 @@
|
|||
width: auto;
|
||||
height: auto;
|
||||
min-width: 100px;
|
||||
position:relative;
|
||||
max-width: 200px;
|
||||
background-color: rgba(255, 255, 255, 0.9);
|
||||
border: 0.2vw rgba(0, 0, 0, 0.2) solid;
|
||||
|
@ -42,7 +43,7 @@
|
|||
|
||||
<script>
|
||||
let msg_int = 0;
|
||||
function msg(text,params = {type:null,time:null,res:null}){
|
||||
function msg(text,params = {type:null,time:null,res:null,def:null}){
|
||||
params.time = (params.time == null)? 8:params.time;
|
||||
params.type = (params.type == null)? "msg":params.type;
|
||||
msg_int++;
|
||||
|
@ -64,6 +65,9 @@
|
|||
case "ask":
|
||||
msg_div.style.borderColor = "rgba(0, 255, 0, 0.5)";
|
||||
break;
|
||||
case "enter":
|
||||
msg_div.style.borderColor = "rgba(0, 255, 0, 0.5)";
|
||||
break;
|
||||
case "warning":
|
||||
msg_div.style.borderColor = "rgba(255, 0, 0, 0.5)";
|
||||
break;
|
||||
|
@ -81,8 +85,8 @@
|
|||
let no = document.createElement("button");
|
||||
let q_div = document.createElement("div");
|
||||
q_div.style = "display:flex;justify-content: space-between;z-index:20000";
|
||||
yes.innerText = "да";
|
||||
no.innerText = "нет";
|
||||
yes.innerText = "Да";
|
||||
no.innerText = "Нет";
|
||||
yes.classList.add("yes-ans")
|
||||
no.classList.add("no-ans")
|
||||
yes.id = `${msg_div.id}-yes`;
|
||||
|
@ -113,6 +117,60 @@
|
|||
observer.observe(msg_div, {attributes: true });
|
||||
|
||||
|
||||
function fin(){
|
||||
observer.disconnect();
|
||||
document.getElementById("message_div").style.pointerEvents = "none";
|
||||
if (document.getElementById(msg_div.id) != null){
|
||||
msg_div.style.transform = "translateX(120%)";
|
||||
setTimeout(() => {
|
||||
msg_root.removeChild(msg_div);
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(params.type == "enter"){
|
||||
let yes = document.createElement("button");
|
||||
let no = document.createElement("button");
|
||||
let text = document.createElement("input");
|
||||
let q_div = document.createElement("div");
|
||||
text.value = (typeof params.def != "undefined")? params.def:"";
|
||||
text.style.width = "90%";
|
||||
text.style.marginBlock = "0.5vw";
|
||||
text.style.border = "1px gray solid";
|
||||
text.style.borderRadius = "0.5vw";
|
||||
q_div.style = "display:flex;justify-content: space-between;z-index:20000";
|
||||
yes.innerText = "Ок";
|
||||
no.innerText = "Отменить";
|
||||
yes.classList.add("yes-ans")
|
||||
no.classList.add("no-ans")
|
||||
yes.id = `${msg_div.id}-yes`;
|
||||
no.id = `${msg_div.id}-no`;
|
||||
q_div.append(yes)
|
||||
q_div.append(no)
|
||||
msg_div.append(text)
|
||||
msg_div.append(q_div)
|
||||
msg_div.setAttribute("ans","null")
|
||||
yes.setAttribute("onclick",`document.getElementById('${msg_div.id}').setAttribute("ans","true")`)
|
||||
no.setAttribute("onclick",`document.getElementById('${msg_div.id}').setAttribute("ans","false")`)
|
||||
document.getElementById("message_div").style.pointerEvents = "all";
|
||||
// document.getElementById("message_div").setAttribute("onclick",`document.getElementById('${msg_div.id}').setAttribute("ans","false")`)
|
||||
|
||||
var observer = new MutationObserver(function(mutations) {
|
||||
mutations.forEach(function(mutation) {
|
||||
if (mutation.type = "attributes" && mutation.target.getAttribute("ans") != "null") {
|
||||
console.log(mutation);
|
||||
if(mutation.target.getAttribute("ans") == "true"){
|
||||
params.res(text.value);fin();
|
||||
}
|
||||
else if (mutation.target.getAttribute("ans") == "false"){
|
||||
params.res(false);fin();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
observer.observe(msg_div, {attributes: true });
|
||||
|
||||
|
||||
function fin(){
|
||||
observer.disconnect();
|
||||
document.getElementById("message_div").style.pointerEvents = "none";
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
background-position: bottom 0px left 0px;
|
||||
border: 2px solid black;
|
||||
/* overflow: visible; */
|
||||
z-index: 2;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.createzone {
|
||||
|
@ -209,11 +209,33 @@
|
|||
width: 2vw;
|
||||
}
|
||||
</style>
|
||||
<div style="display: flex;justify-content: space-between; width: 20vw;">
|
||||
<div style="display: flex;justify-content: space-between; width: 35vw;">
|
||||
<div class="btn_icon"><img src="/img/icon/copy.png" alt="copy"></div>
|
||||
<div class="btn_icon" onclick="go_back()"><img src="/img/icon/back.png" alt="back"></div>
|
||||
<div class="btn_icon" onclick="go_forw()"><img src="/img/icon/forw.png" alt="forw"></div>
|
||||
<div class="btn_icon" onclick="obj_del()"><img src="/img/icon/del.png" alt="del"></div>
|
||||
<div class="layer_changer">
|
||||
<div class="btn_icon layer_btn" onclick="obj_change_layer('up')"><img src="/img/icon/up.png" alt="up"></div>
|
||||
<input id="layer_inp" type="number" oninput="obj_change_layer('inp')">
|
||||
<div class="btn_icon layer_btn" onclick="obj_change_layer('down')"><img src="/img/icon/down.png" alt="down"></div>
|
||||
</div>
|
||||
<style>
|
||||
#layer_inp{
|
||||
width: 2vw;
|
||||
appearance: textfield;
|
||||
text-align: center;
|
||||
border: 0px;
|
||||
}
|
||||
.layer_btn{
|
||||
border: 0px;
|
||||
}
|
||||
.layer_changer{
|
||||
display: flex;
|
||||
background-color: white;
|
||||
border: 1px gray solid;
|
||||
border-radius: 0.5vw;
|
||||
}
|
||||
</style>
|
||||
</div>
|
||||
<div style="display: flex;justify-content: space-between; width: 15vw;">
|
||||
<div><input type="checkbox" id="grid_checkbox" checked="true" onchange='grid_view(JSON.parse(event.target.checked));'><label for="grid_checkbox">Показывать сетку</label></div>
|
||||
|
@ -267,10 +289,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="czones"></div>
|
||||
<button onclick="capture()">cap</button>
|
||||
<script src="/lib/inter.js"></script>
|
||||
<script>
|
||||
let proj_name = "<%= proj_name %>";
|
||||
document.getElementById("layer_inp").value = 0;
|
||||
img_cache(()=>{
|
||||
loaded();
|
||||
})
|
||||
|
||||
|
||||
if ( $.cookie("grid") != null){
|
||||
document.getElementById("grid_checkbox").checked = JSON.parse($.cookie("grid"));
|
||||
|
@ -310,6 +336,10 @@
|
|||
let width = (parseInt(document.getElementById("wall").style.width))
|
||||
document.getElementById("drags").append(document.getElementById("wall"));
|
||||
document.getElementById("drags").style.height = document.getElementById("wall").style.height;
|
||||
document.getElementById("cost_list").style.left = "";
|
||||
Object.values(document.getElementsByClassName("spawn")).forEach((spawn)=>{
|
||||
spawn.src = "";
|
||||
})
|
||||
if(cost == true){
|
||||
width += 252;
|
||||
document.getElementById("drags").append(document.getElementById("cost_div"));
|
||||
|
@ -333,6 +363,7 @@
|
|||
src = canvas.toDataURL();
|
||||
// console.log(src);
|
||||
callback(src)
|
||||
drag_start();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -406,8 +437,36 @@
|
|||
}
|
||||
}
|
||||
|
||||
function obj_change_layer(type) {
|
||||
let obj = document.getElementById(cur_obj);
|
||||
if(obj != null){
|
||||
let cur_layer = obj.style.zIndex;
|
||||
if (type == "up" && cur_layer < 99999){
|
||||
objs[obj.classList[0]][obj.getAttribute("id")].layer = parseInt(cur_layer) + 1;
|
||||
obj.style.zIndex = parseInt(cur_layer) + 1;
|
||||
document.getElementById("layer_inp").value = parseInt(cur_layer) + 1;
|
||||
} else if (type == "down" && cur_layer > 0){
|
||||
objs[obj.classList[0]][obj.getAttribute("id")].layer = parseInt(cur_layer) - 1;
|
||||
obj.style.zIndex = parseInt(cur_layer) - 1;
|
||||
document.getElementById("layer_inp").value = parseInt(cur_layer) - 1;
|
||||
}
|
||||
else if ((type == "inp")){
|
||||
let inp_val = parseInt(document.getElementById("layer_inp").value);
|
||||
if(inp_val >= 0 && inp_val < 99999){
|
||||
objs[obj.classList[0]][obj.getAttribute("id")].layer = inp_val;
|
||||
obj.style.zIndex = inp_val;
|
||||
}
|
||||
else{
|
||||
document.getElementById("layer_inp").value = cur_layer;
|
||||
}
|
||||
}
|
||||
}
|
||||
// console.log(objs[obj.classList[0]][obj.getAttribute("id")]);
|
||||
}
|
||||
|
||||
function obj_del(){
|
||||
if (proj_state == "loaded"){objs_back.push(JSON.parse(JSON.stringify(objs)));}
|
||||
document.getElementById("layer_inp").value = 0;
|
||||
|
||||
try{
|
||||
let drag = document.getElementById(cur_obj);
|
||||
|
@ -578,17 +637,6 @@
|
|||
drag_start()
|
||||
}
|
||||
|
||||
// function del_proj(){
|
||||
// let del = confirm(`удалить проект ${proj_name}?`);
|
||||
// if(del == true){
|
||||
// $.post( "/proj/delete",{name:proj_name})
|
||||
// .done(function( res ) {
|
||||
// if(res["out"] == "good"){
|
||||
// goto("/main")
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
|
||||
// console.log(proj_name);
|
||||
// let menu = document.getElementById("project_menu");
|
||||
|
|
25
views/static/404.ejs
Normal file
25
views/static/404.ejs
Normal file
|
@ -0,0 +1,25 @@
|
|||
<%- include('../static/start.ejs',{name:'404',async: true}) %>
|
||||
<%- include('../header.ejs') %>
|
||||
|
||||
<style>
|
||||
a{
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
color: blue;
|
||||
}
|
||||
</style>
|
||||
|
||||
<section class="main" >
|
||||
<div style="margin: auto;width: 40vw;text-align: center;">
|
||||
<h1>Ой!!!</h1>
|
||||
<h2>На сайте не нашлась такая страница</h2>
|
||||
<h1>Можете <a onclick="goto('/main')">Вернутся на главную страницу</a> или <a onclick="goto('/help')">сообщить в поддержку</a></h1>
|
||||
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<%- include('../static/end.ejs',{soc:true}) %>
|
||||
<script>
|
||||
setTimeout(()=>{loaded()},500);
|
||||
</script>
|
|
@ -11,6 +11,10 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title> <%= name %> </title>
|
||||
<script>
|
||||
admin = {};
|
||||
admin["global"] = () =>{
|
||||
globalThis._admin_ = true;
|
||||
}
|
||||
oncontextmenu = (e) => {
|
||||
e.preventDefault()
|
||||
}
|
||||
|
@ -21,6 +25,7 @@
|
|||
check_sid(true);
|
||||
// console.log("check");
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>
|
||||
:root{
|
||||
|
|
65
views/templates.ejs
Normal file
65
views/templates.ejs
Normal file
|
@ -0,0 +1,65 @@
|
|||
<%- include('./static/start.ejs',{name:'templates',async: true}) %>
|
||||
<%- include('./header.ejs') %>
|
||||
|
||||
<style>
|
||||
.t_img{
|
||||
/* pointer-events: none; */
|
||||
height: 200px;
|
||||
border-radius: 10px;
|
||||
width: 290px;
|
||||
box-shadow: 0px 4px 4px 0px #00000040;
|
||||
cursor: pointer;
|
||||
}
|
||||
.temp, .new_temp{
|
||||
border: 0px;
|
||||
background-color: transparent;
|
||||
}
|
||||
.p_left{
|
||||
display: block;
|
||||
}
|
||||
.p_left div{
|
||||
font-size: calc(var(--main-font-size)/2);
|
||||
}
|
||||
.p_right{
|
||||
display: flex;
|
||||
margin-top:15px;
|
||||
justify-content: space-between;
|
||||
width: 130px;
|
||||
}
|
||||
.p_props{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.p_props img{
|
||||
cursor: pointer;
|
||||
}
|
||||
.main h1{
|
||||
/* font-size: --main-font-size; */
|
||||
font-weight: 100;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
<!-- <script src="/lib/interact.min.js"></script> -->
|
||||
|
||||
<section class="main">
|
||||
<div id="temp_div">
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- <script src="/lib/inter.js"></script> -->
|
||||
|
||||
|
||||
|
||||
<%- include('./static/end.ejs',{soc:true}) %>
|
||||
<script>
|
||||
setTimeout(()=>{loaded()},500);
|
||||
admin["temp"] = ()=>{
|
||||
|
||||
document.getElementById("temp_div").innerHTML += `
|
||||
<button onclick="new_temp()" class="new_temp"><img class="t_img" src="/img/new_proj.png" alt=""><h1>Новый проект</h1></button>
|
||||
`
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user