modified: index.js

modified:   object.js
	modified:   project.js
	new file:   public/img/background/photo_2023-06-06_08-53-47 1.png
	new file:   public/img/icon/copy.svg
	new file:   public/img/icon/download.svg
	new file:   public/img/icon/edit.svg
	new file:   public/img/icon/save.svg
	new file:   public/img/icon/trash.svg
	new file:   public/img/new_proj.png
	new file:   public/img/ok.svg
	new file:   public/img/telegram.svg
	new file:   public/img/vk.svg
	new file:   public/img/youtube.svg
	new file:   "public/img/\320\243\320\274\320\275\320\270\321\207\320\272\320\260 \320\273\320\276\320\263\320\276 \321\201 \320\276\320\261\320\262\320\276\320\264\320\272\320\276\320\271-02 1.png"
	modified:   public/lib/fn.js
	modified:   public/lib/inter.js
	modified:   user.js
	modified:   views/admin.ejs
	modified:   views/header.ejs
	new file:   views/load.ejs
	modified:   views/login.ejs
	modified:   views/main.ejs
	new file:   views/old/project.ejs
	modified:   views/project.ejs
	modified:   views/static/end.ejs
	modified:   views/static/start.ejs
This commit is contained in:
n0rdye 2023-08-01 20:20:43 +05:00
parent f57fec5cde
commit 5133931122
27 changed files with 881 additions and 179 deletions

View File

@ -201,6 +201,9 @@ app.get("/admin", (req,res) =>{
func.log("router admin page error - "+error);
}
});
app.get("/home", (req,res) =>{
res.render('home');
});
// app.get("/admin/edit/:edit" , (req,res) =>{
// try {
// let inp = req.body;

View File

@ -4,7 +4,10 @@ const vars = require('./vars');
module.exports.loads = (inp,cook,res)=>{
try {
db.ggv("objects","`name`,`id`,`height`,`width`,`description`,`cost`,`gid`","gid",`${inp["gid"]}`,(odata)=>{
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`,`description`,`cost`,`gid`","gid",`${gin}`,(odata)=>{
// func.log(odata);
res.send({out:"good",body:odata});
})

View File

@ -1,5 +1,6 @@
const db = require('./db');
const func = require('./func');
const moment = require("moment");
const vars = require('./vars');
module.exports.load = (inp,cook,res)=>{
@ -70,8 +71,10 @@ module.exports.save = (inp,cook,res)=>{
if(projin == null){
// func.log("proj not in");
// func.log(pname,udata["id"],proj);
var date = moment().format('YYYY-MM-DD');
var time = moment().format('hh:mm:ss');
func.log(`good boy ${udata["uuid"]} created project ${inp["name"]} from ${cook["sid"]}`);
db.nr("projects","`uid`,`name`,`body`,`img`",`'${udata["id"]}','${inp["name"]}','${inp["proj"]}','${inp["img"]}'`);
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"],()=>{});

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

4
public/img/icon/copy.svg Normal file
View File

@ -0,0 +1,4 @@
<svg width="21" height="21" viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.5 4.5V12.5C16.5 14.7091 14.7091 16.5 12.5 16.5H4.5C2.29086 16.5 0.5 14.7091 0.5 12.5V4.5C0.5 2.29086 2.29086 0.5 4.5 0.5H12.5C14.7091 0.5 16.5 2.29086 16.5 4.5ZM2 4.5V12.5C2 13.163 2.26339 13.7989 2.73223 14.2678C3.20107 14.7366 3.83696 15 4.5 15H12.5C13.8807 15 15 13.8807 15 12.5V4.5C15 3.11929 13.8807 2 12.5 2H4.5C3.11929 2 2 3.11929 2 4.5Z" fill="#505050"/>
<path d="M19.5 6.75C19.088 6.75539 18.7554 7.08804 18.75 7.5V15.5C18.7445 17.2926 17.2926 18.7445 15.5 18.75H7.5C7.08579 18.75 6.75 19.0858 6.75 19.5C6.75 19.9142 7.08579 20.25 7.5 20.25H15.5C18.1234 20.25 20.25 18.1234 20.25 15.5V7.5C20.2446 7.08804 19.912 6.75539 19.5 6.75Z" fill="#505050"/>
</svg>

After

Width:  |  Height:  |  Size: 814 B

View File

@ -0,0 +1,4 @@
<svg width="14" height="18" viewBox="0 0 14 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M11.5793 1.5H1.57934C1.16513 1.5 0.82934 1.16421 0.82934 0.75C0.82934 0.335786 1.16513 0 1.57934 0H11.5793C11.9936 0 12.3293 0.335786 12.3293 0.75C12.3293 1.16421 11.9936 1.5 11.5793 1.5Z" fill="#505050"/>
<path d="M12.4093 10.2564C12.6089 10.2564 12.8001 10.3371 12.9393 10.48C13.2318 10.7728 13.2318 11.2472 12.9393 11.54L7.10934 17.36C6.81652 17.6525 6.34216 17.6525 6.04934 17.36L0.21934 11.54C-0.0731134 11.2472 -0.0731134 10.7728 0.21934 10.48C0.358628 10.3371 0.549753 10.2564 0.74934 10.2564C0.948928 10.2564 1.14005 10.3371 1.27934 10.48L5.82934 15.02V3.8C5.82934 3.38579 6.16513 3.05 6.57934 3.05C6.99355 3.05 7.32934 3.38579 7.32934 3.8V15.02L11.8793 10.48C12.0186 10.3371 12.2098 10.2564 12.4093 10.2564Z" fill="#505050"/>
</svg>

After

Width:  |  Height:  |  Size: 847 B

4
public/img/icon/edit.svg Normal file
View File

@ -0,0 +1,4 @@
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.1736 13.0336L19.9336 18.3136C19.9884 18.7201 19.8648 19.1305 19.5946 19.4391C19.3243 19.7477 18.9338 19.9244 18.5236 19.9236H18.3136L13.0336 19.1636C12.3179 19.0649 11.6541 18.7348 11.1436 18.2236L1.40356 8.47356C-0.491301 6.51167 -0.464202 3.39314 1.46447 1.46447C3.39314 -0.464202 6.51167 -0.491301 8.47356 1.40356L18.2336 11.1436C18.7448 11.6541 19.0749 12.3179 19.1736 13.0336ZM12.2536 17.1636C12.5301 17.4292 12.8773 17.6097 13.2536 17.6836L18.4636 18.3736L17.7336 13.2036C17.6597 12.8273 17.4792 12.4801 17.2136 12.2036L7.46356 2.46356C6.80662 1.78913 5.90506 1.40874 4.96356 1.40874C4.02206 1.40874 3.1205 1.78913 2.46356 2.46356C1.80464 3.11864 1.43414 4.00942 1.43414 4.93856C1.43414 5.8677 1.80464 6.75848 2.46356 7.41356L12.2536 17.1636Z" fill="#505050"/>
<path d="M5.43356 4.37356C5.13805 4.0982 4.67755 4.10633 4.39194 4.39194C4.10633 4.67755 4.0982 5.13805 4.37356 5.43356L8.58356 9.64356C8.87638 9.93601 9.35074 9.93601 9.64356 9.64356C9.93602 9.35074 9.93602 8.87638 9.64356 8.58356L5.43356 4.37356Z" fill="#505050"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

9
public/img/icon/save.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,7 @@
<svg width="16" height="20" viewBox="0 0 16 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14.79 5C14.3537 5 14 5.35369 14 5.79V14.63C14 16.4912 12.4912 18 10.63 18H4.95C3.0888 18 1.58 16.4912 1.58 14.63V5.79C1.58 5.35369 1.22631 5 0.79 5C0.353695 5 1.30029e-08 5.35369 0 5.79V14.63C0.0274201 17.3719 2.25799 19.5801 5 19.58H10.68C13.4025 19.5529 15.6029 17.3525 15.63 14.63V5.79C15.6304 5.57152 15.5404 5.36262 15.3812 5.21294C15.2221 5.06326 15.008 4.98617 14.79 5Z" fill="#505050"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.79 3.58H0.79C0.353695 3.58 0 3.22631 0 2.79C0 2.35369 0.353695 2 0.79 2H3.44L4.62 0.72C5.07107 0.261411 5.68675 0.00217586 6.33 1.83491e-10H9.25C9.88387 -7.84652e-06 10.4918 0.25179 10.94 0.7L12.14 2H14.79C15.2263 2 15.58 2.35369 15.58 2.79C15.58 3.22631 15.2263 3.58 14.79 3.58ZM9.25 1.58H6.33C6.13008 1.58007 5.93744 1.65499 5.79 1.79L5.6 1.99H9.98L9.79 1.79C9.64364 1.65326 9.45029 1.57807 9.25 1.58Z" fill="#505050"/>
<path d="M4.04 6.79V9.79C4.04 10.2042 4.37579 10.54 4.79 10.54C5.20421 10.54 5.54 10.2042 5.54 9.79V6.79C5.54 6.37579 5.20421 6.04 4.79 6.04C4.37579 6.04 4.04 6.37579 4.04 6.79Z" fill="#505050"/>
<path d="M7.04 6.79V14.79C7.04 15.2042 7.37579 15.54 7.79 15.54C8.20421 15.54 8.54 15.2042 8.54 14.79V6.79C8.54 6.37579 8.20421 6.04 7.79 6.04C7.37579 6.04 7.04 6.37579 7.04 6.79Z" fill="#505050"/>
<path d="M10.04 6.79V9.79C10.04 10.2042 10.3758 10.54 10.79 10.54C11.2042 10.54 11.54 10.2042 11.54 9.79V6.79C11.54 6.37579 11.2042 6.04 10.79 6.04C10.3758 6.04 10.04 6.37579 10.04 6.79Z" fill="#505050"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
public/img/new_proj.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

5
public/img/ok.svg Normal file
View File

@ -0,0 +1,5 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 16C0 7.16344 7.16344 0 16 0C24.8366 0 32 7.16344 32 16C32 24.8366 24.8366 32 16 32C7.16344 32 0 24.8366 0 16Z" fill="#FF8800"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.8763 11.4703C20.8763 14.1395 18.7003 16.3155 16.0309 16.3155C13.3327 16.3155 11.1567 14.1395 11.1567 11.4703C11.1567 8.80101 13.3327 6.625 16.0309 6.625C18.7003 6.625 20.8763 8.80101 20.8763 11.4703ZM18.0329 11.4703C18.0329 10.3677 17.1335 9.46832 16.0309 9.46832C14.8995 9.46832 14 10.3677 14.0291 11.4703C14.0291 12.5728 14.9285 13.4721 16.0309 13.4721C17.1335 13.4721 18.0329 12.5728 18.0329 11.4703Z" fill="white"/>
<path d="M20.7892 19.1299C19.9188 19.6811 18.9613 20.0583 17.9749 20.2904L20.7312 22.9596C21.2824 23.5109 21.2824 24.4103 20.7312 24.9616C20.18 25.5128 19.2805 25.5128 18.7293 24.9616L16.06 22.2923L13.3908 24.9616C13.1007 25.2227 12.7525 25.3677 12.3753 25.3677C11.9982 25.3677 11.65 25.2517 11.3599 24.9616C10.8086 24.4103 10.8086 23.5109 11.3599 22.9596L14.0581 20.2613C13.0716 20.0292 12.1142 19.6521 11.2438 19.1008C10.5765 18.6947 10.3734 17.8243 10.7506 17.1569C11.1858 16.4896 12.0562 16.3156 12.7235 16.7217C14.6964 17.9693 17.2785 17.9693 19.2515 16.7217C19.9188 16.2865 20.8183 16.4896 21.2244 17.1569C21.6596 17.8243 21.4565 18.7236 20.7892 19.1299Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

4
public/img/telegram.svg Normal file
View File

@ -0,0 +1,4 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 16C0 24.8366 7.16344 32 16 32C24.8366 32 32 24.8366 32 16C32 7.16344 24.8366 0 16 0C7.16344 0 0 7.16344 0 16Z" fill="#0088CC"/>
<path d="M8.09992 15.7083C12.3949 13.8371 15.2589 12.6034 16.6919 12.0074C20.7834 10.3056 21.6335 10.01 22.1877 10.0001C22.3095 9.99805 22.582 10.0283 22.7586 10.1715C22.9076 10.2924 22.9486 10.4558 22.9683 10.5705C22.9879 10.6851 23.0123 10.9464 22.9929 11.1505C22.7712 13.4801 21.8118 19.1335 21.3237 21.7427C21.1172 22.8468 20.7105 23.217 20.3168 23.2532C19.4613 23.3319 18.8116 22.6878 17.9829 22.1446C16.6862 21.2946 15.9537 20.7654 14.695 19.936C13.2404 18.9774 14.1834 18.4506 15.0124 17.5896C15.2293 17.3643 18.999 13.9355 19.0719 13.6244C19.0811 13.5855 19.0895 13.4405 19.0034 13.3639C18.9172 13.2874 18.7901 13.3136 18.6983 13.3344C18.5683 13.3639 16.4968 14.7331 12.4839 17.4419C11.8959 17.8457 11.3633 18.0424 10.8862 18.0321C10.3601 18.0207 9.34822 17.7346 8.59598 17.4901C7.67333 17.1902 6.94002 17.0316 7.00388 16.5223C7.03714 16.257 7.40248 15.9856 8.09992 15.7083Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

4
public/img/vk.svg Normal file
View File

@ -0,0 +1,4 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M32 16C32 7.16344 24.8366 0 16 0C7.16344 0 0 7.16344 0 16C0 24.8366 7.16344 32 16 32C24.8366 32 32 24.8366 32 16Z" fill="#0077FF"/>
<path d="M17.0833 21.4083C11.3833 21.4083 8.13333 17.5083 8 11.0083H10.8667C10.9583 15.775 13.0583 17.7916 14.725 18.2083V11.0083H17.4167V15.1166C19.0583 14.9416 20.7917 13.0666 21.375 11H24.0583C23.8395 12.0698 23.4025 13.083 22.7745 13.9762C22.1464 14.8695 21.341 15.6237 20.4083 16.1916C21.4491 16.7097 22.3682 17.4424 23.1051 18.3416C23.842 19.2408 24.3799 20.286 24.6833 21.4083H21.725C21.0917 19.4333 19.5083 17.9 17.4167 17.6916V21.4083H17.0917H17.0833Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 721 B

4
public/img/youtube.svg Normal file
View File

@ -0,0 +1,4 @@
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 16C0 24.8366 7.16344 32 16 32C24.8366 32 32 24.8366 32 16C32 7.16344 24.8366 0 16 0C7.16344 0 0 7.16344 0 16Z" fill="#FF0000"/>
<path d="M23.6 12.1C23.4 11.4 22.9 10.9 22.2 10.7C21 10.4 15.9 10.4 15.9 10.4C15.9 10.4 10.9 10.4 9.60001 10.7C8.90001 10.9 8.4 11.4 8.2 12.1C8 13.4 8 16 8 16C8 16 8 18.6 8.3 19.9C8.5 20.6 9 21.1 9.7 21.3C10.9 21.6 16 21.6 16 21.6C16 21.6 21 21.6 22.3 21.3C23 21.1 23.5 20.6 23.7 19.9C24 18.6 24 16 24 16C24 16 24 13.4 23.6 12.1ZM14.4 18.4V13.6L18.6 16L14.4 18.4Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -10,6 +10,12 @@ function get_from_uuid(callback){
});
}
function set_pos(obj,x,y){
obj.style.transform = 'translate(' + x + 'px, ' + y + 'px)';
obj.setAttribute('data-x', x)
obj.setAttribute('data-y', y)
}
function log_by_sid() {
// const uuid = $.cookie("uuid");
// const sid = $.cookie("sid");
@ -18,17 +24,17 @@ function log_by_sid() {
// get_sid(location.hostname);
get_sid();
}
// else if ($.cookie('sid') != null && $.cookie('uuid') != null){
// $.post( "/sid_log")
// .done(function( res ) {
else if ($.cookie('sid') != null && $.cookie('uuid') != null){
$.post( "/sid_log")
.done(function( res ) {
// console.log("ping");
// if(res["out"] == "good"){
// goto(res["url"]);
// }
// else if (res["out"] == "bad"){
// clear_ck(false);
// }
// })}
if(res["out"] == "good"){
goto(res["url"]);
}
else if (res["out"] == "bad"){
clear_ck(false);
}
})}
}
function clear_ck(redirect = true){
@ -115,7 +121,10 @@ function load_groups(callback){
// redirect
function goto(url) {
loading();
setTimeout(()=>{
location.href = url;
},1000)
}
function postForm(path, params, method) {

View File

@ -65,24 +65,24 @@ function resize_drags(){
drag_start();
}
function wall_size_change(type,value){
function wall_size_change(type,value = null){
let wall = document.getElementsByClassName("wall")[0];
let scroll;
if(type != null && type == "width") {
if (value == null) scroll = document.getElementById("wall_width").value;
else scroll = value;
if (value == null) scroll = parseFloat(document.getElementById("wall_width").value);
else if (value != null) scroll = value;
// document.getElementById("wall_width_value").innerHTML = (Math.ceil((parseFloat(scroll)+0.1)*10)/ 10);
document.getElementById("wall_width_value").innerHTML = `${scroll}м`;
// document.getElementById("wall_width_value").innerHTML = `${scroll}м`;
// console.log(scroll);
wall.style.width = `${scroll * 200}px`;
objs["width"] = scroll;
}
if(type != null && type == "height") {
if (value == null) scroll = document.getElementById("wall_height").value;
else scroll = value;
if (value == null) scroll = parseFloat(document.getElementById("wall_height").value);
else if (value != null) scroll = value;
// document.getElementById("wall_height_value").innerHTML = (Math.ceil((parseFloat(scroll)+0.1)*10)/ 10);
document.getElementById("wall_height_value").innerHTML = `${scroll}м`;
// document.getElementById("wall_height_value").innerHTML = `${scroll}м`;
// console.log(scroll);
wall.style.height = `${scroll * 200}px`;
@ -129,6 +129,10 @@ function load(objss){
wall_size_change(keys,values);
// document.getElementById("drags").style.left = $(".dropzone")[0].getBoundingClientRect().x;
}
if (keys == Object.keys(objs).at(-1)){
loaded();
}
});
resize_drags();
calc_total()
@ -137,7 +141,7 @@ function load(objss){
function load_proj_cloud(){
proj_from = "cloud";
document.getElementById("drags").innerHTML = "";
document.getElementById("top_panel_center").innerText = `загрузка ${proj_name} из облака`;
// document.getElementById("top_panel_center").innerText = `загрузка ${proj_name} из облака`;
$.post( "/load_proj",{name:proj_name})
.done(function( res ) {
if(res["out"] == "good"){
@ -146,7 +150,7 @@ function load_proj_cloud(){
// console.log(JSON.parse(res["body"]));
// $.cookie("objs",res["body"]);
load(JSON.parse(res["body"]));
document.getElementById("top_panel_center").innerText = `${proj_name} (облако)`;
// document.getElementById("top_panel_center").innerText = `${proj_name} (облако)`;
}
else if(res["out"] == "bad proj"){
console.log("bad");
@ -163,7 +167,7 @@ function load_proj_local(){
if(localStorage.getItem(proj_name) == null){
save_local()
}
document.getElementById("top_panel_center").innerText = `${proj_name} (локальное хранилище)`;
// document.getElementById("top_panel_center").innerText = `${proj_name} (локальное хранилище)`;
document.getElementById("drags").innerHTML = "";
load(JSON.parse(localStorage.getItem(proj_name)));
}
@ -204,9 +208,10 @@ function save(callback,with_pic = true){
}
}
function load_objs(callback){
let select = document.getElementById("group_select");
$.post( "/get_objs",{gid:select.options[select.selectedIndex].getAttribute("gid")})
function load_objs(callback,group){
// let select = document.getElementById("group_select");
console.log(group);
$.post( "/get_objs",{gid:group})
.done(function( res ) {
if(res["out"] == "good"){
// console.log(res["body"]);
@ -239,12 +244,6 @@ function load_obj(name,key,callback){
});
}
function set_pos(obj,x,y){
obj.style.transform = 'translate(' + x + 'px, ' + y + 'px)';
obj.setAttribute('data-x', x)
obj.setAttribute('data-y', y)
}
function dragMoveListener (event) {
var drag = event.target
var x = (parseFloat(drag.getAttribute('data-x')) || 0) + event.dx

View File

@ -61,7 +61,7 @@ module.exports.clear_sid = (inp,cook,res)=>{
if(inp["sid"] != null){
// res.send({out:"good"});
db.dl("sids","sid",`'${inp["sid"]}'`,() =>{
func.log("good boy "+inp["uuid"] + " logged out from "+inp["sid"]);
// func.log("good boy "+inp["uuid"] + " logged out from "+inp["sid"]);
});
// db.ggv("sids","id","sid",`'${cook["sid"]}'`,(sids)=>{
// Object.entries(sids).forEach(([key,value])=>{

View File

@ -29,3 +29,8 @@
</section>
<%- include('./static/end.ejs') %>
<script>
setTimeout(()=>{
loaded()
},1000);
</script>

View File

@ -1,3 +1,4 @@
<%- include('./load.ejs') %>
<style>
#proj_top_panel{
display: flex;
@ -7,27 +8,42 @@
text-align: center;
margin: auto;
}
#top_panel_right{
/* float: right; */
justify-content: space-between;
display: flex;
cursor: pointer;
/* width: 20vw; */
}
#top_panel_left{
/* float: left; */
justify-content: space-between;
/* width: 200px; */
cursor: pointer;
width: 5vw;
display: flex;
/* width: 20vw; */
}
#top_panel_center{
/* float: left; */
justify-content: space-between;
cursor: pointer;
width: 58vw;
display: flex;
/* width: 20vw; */
}
#top_panel{
height: 20px;
height: 100px;
display: flex;
margin-bottom: 2vh;
margin-top: 1vh;
}
/* button{
/* margin-inline: 5px; */
/* } */
.tpanel{
margin: auto 0px;
/* width: 100%; */
height: 100%;
}
.tpanel button{
border: 0px;
background-color: transparent;
cursor: pointer;
}
.menu_btn{
background: ghostwhite;
@ -44,35 +60,92 @@
border: 1px black solid;
z-index: 100;
}
#top_panel_right_main{
/* float: right; */
justify-content:space-between;
float: right;
display: flex;
cursor: pointer;
width: 14vw;
/* width: 20vw; */
/* height: 60px; */
}
#top_panel_right_sec{
/* float: right; */
justify-content:space-between;
float: left;
display: flex;
cursor: pointer;
width: 14vw;
transform: translateY(100%);
/* width: 20vw; */
/* height: 60px; */
}
.top_panel_right img{
width: 3vw;
height: 3vh;
}
@media (max-width: 900px) {
#top_panel_right_main{
display: none;
}
#top_panel_right_sec{
display: flex;
}
#top_panel_center{
width: 70vw;
}
}
@media (min-width: 900px) {
#top_panel_right_main{
display: flex;
}
#top_panel_right_sec{
display: none;
}
}
</style>
<header id="top_panel">
<!-- <div id="user_name"></div> -->
<div id="proj_top_panel">
<div id="top_panel_left"></div>
<div id="top_panel_center"></div>
<div id="top_panel_right"></div>
<div id="top_panel_left" class="tpanel"></div>
<div id="top_panel_center" class="tpanel">
<button onclick="goto('/main')">Мои проекты</button>
<button onclick="goto('/tamp')">Шаблоны</button>
<button onclick="goto('/gallery')">Галерея</button>
<button onclick="goto('/faq')">FAQ</button>
<button onclick="goto('/help')">Связаться с поддержкой</button>
</div>
<div id="top_panel_right_main" class="tpanel top_panel_right">
<a href=""><img src="/img/vk.svg" alt=""></a>
<a href=""><img src="/img/youtube.svg" alt=""></a>
<a href=""><img src="/img/ok.svg" alt=""></a>
<a href=""><img src="/img/telegram.svg" alt=""></a>
</div>
</div> <!-- <div><button onclick="logout();">logout</button></div> -->
</header>
<div id="user_menu" class="cmenu"></div>
<script>
get_from_uuid((res)=>{
let uname = document.getElementById("user_name");
let menu = document.getElementById("user_menu");
let header = document.getElementById("top_panel");
let right = document.getElementById("top_panel_right");
let left = document.getElementById("top_panel_left");
// get_from_uuid((res)=>{
// let uname = document.getElementById("user_name");
// let menu = document.getElementById("user_menu");
// let header = document.getElementById("top_panel");
// let right = document.getElementById("top_panel_right");
// let left = document.getElementById("top_panel_left");
if(document.title != "main") menu.innerHTML += `<button onclick="goto('/');">проекты</button> <br>`;
right.innerHTML += `<div id="user_name" class="menu_btn">${res["login"]}</div>`;
// if(document.title != "main") menu.innerHTML += `<button onclick="goto('/');">проекты</button> <br>`;
// right.innerHTML += `<div id="user_name" class="menu_btn">${res["login"]}</div>`;
if (res["admin"] == true){
menu.innerHTML += `<button onclick='goto("/admin")'>админ. панель</button><br>`;
}
menu.innerHTML += "<button onclick='logout();'>выйти</button><br>";
});
// if (res["admin"] == true){
// menu.innerHTML += `<button onclick='goto("/admin")'>админ. панель</button><br>`;
// }
// menu.innerHTML += "<button onclick='logout();'>выйти</button><br>";
// });
onscroll = (e)=>{
hide_menus();
@ -140,6 +213,18 @@
// menu.innerHTML = "<p>Option1</p><p>Option2</p><p>Option3</p><p>Option4</p>"
// document.body.appendChild(menu)
}
else if(e.target.id == "group_drop"){
// hide_menus();
// let menu = document.getElementById("object_edit_menu");
// let obj = e.target;
// menu.style.display = 'block';
// // menu.style = `top:${e.target.getBoundingClientRect().top+27}px;left:${e.target.getBoundingClientRect().left-13}px`;
// menu.style = `top:${e.target.getBoundingClientRect().top + 40}px;left:${e.target.getBoundingClientRect().left - 5}px`;
// // menu.onmouseleave = () => menu.style.display = 'none';
// // menu.innerHTML = "<p>Option1</p><p>Option2</p><p>Option3</p><p>Option4</p>"
// // document.body.appendChild(menu)
}
else{
hide_menus();

67
views/load.ejs Normal file
View File

@ -0,0 +1,67 @@
<style>
#load_div{
width: 100vw;
height: 100vh;
display: flex;
position: absolute;
z-index: 10000;
background-color: white;
pointer-events: none;
transition: background-color 1s;
}
#load_logo{
width: 12vw;
/* height: 12vh; */
/* margin: auto; */
position:absolute;
top:30.5%;
left:50%;
-ms-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translate(-50%,-50%);
transform: translate(-50%,-50%);
pointer-events: none;
transition-duration: 800ms;
}
</style>
<div id="load_div">
<img id="load_logo" src="/img/Умничка лого с обводкой-02 1.png" alt="">
</div>
<script>
let loaded_pos={
x:"10%",
// y:"6%",
// x: "55px",
y: "45px",
w:"8vw",
h:"8vh"
}
let loading_pos={
x:"50%",
y:"30.5%",
w:"12vw",
h:"12vh"
}
// document.getElementById("load_logo").style.transform = `translate(${center.x}px,${center.y}px)`
function loaded(){
let logo = document.getElementById("load_logo");
let load_div = document.getElementById("load_div");
load_div.style.backgroundColor = "transparent";
// load_div.style.transition = "background-color 1s"
// logo.style.transform = `translate(0px,0px)`;
logo.style.left = loaded_pos.x;
logo.style.top = loaded_pos.y;
logo.style.width = loaded_pos.w
}
function loading(){
let logo = document.getElementById("load_logo");
let load_div = document.getElementById("load_div");
load_div.style.backgroundColor = "white";
// load_div.style.transition = "background-color 1s"
// logo.style.transform = `translate(-50%,-50%)`;
logo.style.left = loading_pos.x;
logo.style.top = loading_pos.y;
logo.style.width = loading_pos.w
}
</script>

View File

@ -1,34 +1,145 @@
<%- include('./static/start.ejs',{name:'login',async: true}) %>
<%- include('./load.ejs') %>
<style>
* {
body{
/* width: 1920px;
height: 1080px; */
padding: 0%;
margin: 0%;
background-image: url("/img/background/photo_2023-06-06_08-53-47\ 1.png");
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
#login_form{
margin: auto;
background-color: rgba(255, 255, 255, 0.5);
/* width: 680px;
height: 450px; */
width: 52vw;
/* height: 550px; */
height: 55vh;
border-radius: 1.5vw;
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
backdrop-filter: blur(2vh);
}
#inputs{
margin: auto;
/* width: calc(var(--login-inp-w)+20); */
/* background-color: aliceblue; */
}
#login_form div{
margin: auto;
margin-block: 2vh;
}
input{
text-align: center;
}
iframe{
border: 0px;
display: none;
section{
display: flex;
justify-content: space-around;
width: 100vw;
height: 100vh;
}
.login-inp input{
/* padding-block: 20px;
padding-inline: 40px; */
height: var(--login-inp-h);
width: calc(var(--login-inp-w));
border: 0.1vh solid #505050;
margin: auto;
border-radius: 1.2vh;
}
.login-inp{
height: var(--login-inp-h);
width: calc(var(--login-inp-w)*1.03);
/* margin: auto; */
}
.pass-inp input{
/* padding-block: 5px;
padding-inline: 20px; */
height: var(--login-inp-h);
width: var(--login-inp-w);
border: 0.1vh solid #505050;
border-radius: 1.2vh;
}
.pass-inp{
height: var(--login-inp-h);
width: calc(var(--login-inp-w)*1.03);
}
.login-btn input{
height: var(--login-inp-h);
width: calc(var(--login-inp-w)/2);
border: 0.1vh;
box-shadow: 0px 4px 4px 0px #00000040;
border-radius: 1.2vh;
}
.login-btn{
height: var(--login-inp-h);
width: calc(var(--login-inp-w)/2);
}
#logo{
margin: auto;
/* width: 216px;
height: 144.27px; */
width: 12vw;
height: 12vh;
display: flex;
justify-content: space-around;
}
#helps button{
background-color: transparent;
border: 0px;
}
#helps{
display: flex;
justify-content: space-evenly;
padding-top: 2.4vh;
}
@media (max-width: 900px) {
#helps{
display: grid;
}
}
/* #logo img{
width: 50%;
} */
</style>
<!-- <img id="logo_img_sec" style="width: 12vw; height: 12vh;" src="/img/Умничка лого с обводкой-02 1.png" alt=""> -->
<section>
<form action="#" id="login_form">
<div class="login-page">
<input name="login" type="text" id="login">
<label for="login">логин</label>
<div id="logo"></div>
<div id="inputs">
<div class="login-inp">
<input name="login" type="text" id="login" placeholder="Логин">
</div>
<div class="pass-page">
<input name="pass" type="password" id="pass">
<label for="pass">пароль</label>
<div class="pass-inp">
<input name="pass" type="password" id="pass" placeholder="Пароль">
</div>
<input type="submit" id="log_btn" onclick="log()" value="login">
<div class="login-btn" style="display: flex;justify-content: space-around;">
<input type="submit" id="log_btn" onclick="log()" value="Войти">
</div>
</div>
<div id="helps"><button>Восстановить пароль</button><button>Запросить доступ</button></div>
</form>
</section>
<!-- <input type="submit" value="" hidden> -->
<div id="res"></div>
<script>
loaded_pos.y = "30.5%";
loaded_pos.x = "50%";
loaded_pos.w = "12vw";
loaded();
// console.log($.cookie("uuid"));
// log_by_sid();
// let logo = document.getElementById("logo_img");
// 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();
@ -39,12 +150,13 @@
if (res["out"] == "bad"){
console.log(res["err"]);
if (res["err"] == "user" || res["err"] == "pass"){
document.querySelector("#res").innerHTML = "<p>wrong password or login</p>";
alert("wrong password or login")
}
}
else{
if(res["out"] == "goto"){
// postForm(res["url"], res["args"]);
loading();
goto(res["url"]);
}
// if(res["out"] == "logged"){

View File

@ -1,56 +1,47 @@
<%- include('./static/start.ejs',{name:'main',async: true}) %>
<%- include('./header.ejs') %>
<style>
.drag{
height: 50px;
width: 50px;
position: absolute;
text-align: center;
.p_img{
/* pointer-events: none; */
height: 200px;
border-radius: 10px;
width: 290px;
box-shadow: 0px 4px 4px 0px #00000040;
}
.dropzone {
background-color: #bfe4ff;
border: dashed 4px transparent;
border-radius: 4px;
height: 140px;
margin: 10px auto 30px;
padding: 10px;
width: 80%;
transition: background-color 0.3s;
.proj, .new_proj{
border: 0px;
background-color: transparent;
}
.trash {
background-color: #bfe4ff;
border: dashed 4px transparent;
border-radius: 4px;
margin: 10px auto 30px;
padding: 10px;
height: 50px;
width: 50px;
transition: background-color 0.3s;
z-index: -1;
.p_left{
display: block;
}
.drop-active {
border-color: #aaa;
.p_left div{
font-size: calc(var(--main-font-size)/2);
}
.drop-target {
background-color: #29e;
border-color: #fff;
border-style: solid;
.p_right{
display: flex;
margin-top:15px;
justify-content: space-between;
width: 130px;
}
img{
pointer-events: none;
.p_props{
display: flex;
justify-content: space-between;
}
.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">
<button onclick="new_proj()">создать новый проект</button>
<div id="projs_div"></div>
<div id="projs_div">
<button onclick="new_proj()" class="new_proj"><img class="p_img" src="img/new_proj.png" alt=""><h1>Новый проект</h1></button>
</div>
</section>
<!-- <script src="/lib/inter.js"></script> -->
@ -67,16 +58,58 @@
}
function new_proj(){
let name = ask("please enter project name");
let objs = { height:"2",width:"4"};
if(name != null && name!= "" && name!=" " && typeof name != "undefined" && name!="undefined"){
$.post( "/save_proj", {proj:JSON.stringify(objs),name:name,img:"img/img_placeholder.webp"})
.done(function( res ) {
if(res["out"] == "good"){
// console.log(scr)
// console.log("good");
// if(callback) callback(res);
goto(`/proj/${name}`);
}
})
}
}
load_projs((projs)=>{
console.log(projs);
if(projs.length == 0){
setTimeout(loaded(),1000)
}
else{
projs.forEach(proj => {
// console.log(proj);
console.log(proj);
let div = document.getElementById("projs_div");
div.innerHTML += `<button id='proj_${proj["name"]}' class='proj' onclick="goto('/proj/${proj["name"]}')">${proj["name"]}<br><img height="200" width="290" src='${proj["img"]}' alt='${proj["name"]}'></img></button>`;
div.innerHTML += `<button id='proj_${proj["name"]}' class='proj'>
<img src='${proj["img"]}' alt='${proj["name"]}' class="p_img" onclick="goto('/proj/${proj["name"]}')">
<div class="p_props">
<div class="p_left" style="text-align:left">
<h1>${proj["name"]}</h1>
<div>${proj["creation_date"].split("T")[0]}</div>
</div>
<div class="p_right">
<img src="/img/icon/edit.svg" style="width:24px;height:24px" onclick="del_proj('${proj["name"]}')">
<img src="/img/icon/copy.svg" style="width:24px;height:24px" onclick="del_proj('${proj["name"]}')">
<img src="/img/icon/download.svg" style="width:24px;height:24px" onclick="del_proj('${proj["name"]}')">
<img src="/img/icon/trash.svg" style="width:24px;height:24px" onclick="del_proj('${proj["name"]}')">
</div>
</div>
</button>`;
setTimeout(loaded(),1000)
});
}
});
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")
}
})
}
}
</script>
<%- include('./static/end.ejs') %>
<%- include('./static/end.ejs',{soc:true}) %>

224
views/old/project.ejs Normal file
View File

@ -0,0 +1,224 @@
<%- include('./static/start.ejs',{name:proj_name,async:true}) %>
<%- include('./header.ejs') %>
<script src="/lib/interact.js"></script>
<script src="/lib/html2canvas.js"></script>
<style>
.drag{
height: 50px;
width: 50px;
position: absolute;
text-align: center;
margin: auto;
z-index: 10;
}
#drags{
position: absolute;
margin: auto;
}
#drags img{
object-fit: contain;
}
.zones{
margin-block: 10px;
}
.wall {
/* border: dashed 4px transparent; */
border-radius: 4px;
transition: background-color 0.3s;
position: absolute;
inset: 0px;
margin: 5px auto;
width: 400px;
height: 200px;
background-color: #fff;
background-image: url("/img/bg1red.png");
background-size: 200px;
background-repeat: repeat;
background-position: bottom 0px left 0px;
border: 2px solid black;
/* overflow: visible; */
z-index: 2;
}
.createzone {
background-color: #bfe4ff;
border: dashed 4px transparent;
border-radius: 4px;
height: 22px;
width: 22px;
margin: 10px;
margin-top: 0px;
padding: 10px;
transition: background-color 0.3s;
}
.trash {
background-color: #bfe4ff;
border: dashed 4px transparent;
border-radius: 4px;
/* margin: 10px auto 30px; */
/* padding: 10px; */
height: 50px;
width: 50px;
transition: background-color 0.3s;
text-align: center;
/* z-index: -1; */
}
.czones{
display: flex;
margin: 0px auto;
/* justify-content: space-around; */
flex-wrap: wrap;
width: 75%;
/* height: 100px; */
/* overflow-x: auto; */
}
.drop-active {
border-color: #aaa;
}
/* .drop-target {
background-color: #29e;
border-color: #fff;
border-style: solid;
} */
#proj_top{
margin: auto;
width: 90%;
display: flex;
justify-content: space-around;
}
#proj_name{
background-color: #aaa;
border: 0px;
text-align: center;
}
.inputs{
display: flex;
width: 80vw;
margin: auto;
padding-block: 20px;
padding-bottom: 0px;
margin-top: 50px;
}
</style>
<div id="project_menu" class="cmenu">
<button id='proj_csave_btn' onclick='save_proj()'>сохранить в облако</button> <br>
<button id='proj_cload_btn' onclick='load_proj_cloud()'>загрузить из облака</button> <br>
<button id='proj_lsave_btn' onclick='save_proj_local()'>сохранить на локальное хранилище</button> <br>
<button id='proj_lload_btn' onclick='load_proj_local()'>загрузить из локальное хранилище</button> <br>
<button id='proj_del_btn' onclick='del_proj()'>удалить проект</button> <br>
</div>
<!-- <div class="dropzone"></div> -->
<div class="inputs">
<div id="wall_input">
<div id="obj_group">
<div style="display: flex;justify-content: space-between;">
<div style="width: 50px;">группа товаров</div>
<select name="" id="group_select" onchange="get_objs()"></select>
</div>
</div><br>
<div>
<div style="display: flex;width: 150px;justify-content: space-between;">
<label for="wall_height">высота </label>
<div id="wall_height_value">0</div>
</div>
<input type="range" step="0.1" min="0" max="5" id="wall_height" value="2" oninput="wall_size_change('height')" onchange="resize_drags()">
</div>
<div>
<div style="display: flex;width: 150px;justify-content: space-between;">
<label for="wall_width">ширина</label>
<div id="wall_width_value">0</div>
</div>
<input type="range" step="0.1" min="0" max="7" id="wall_width" value="4" oninput="wall_size_change('width')" onchange="resize_drags()">
</div>
</div>
<div class="czones"></div>
<img class="trash" style="height: 100px; width: 100px;" src="/img/shadow-energy.gif" alt="чёрная дыра">
</div>
<div class="zones" style="position: relative;">
<div id="drags"></div>
<div class="wall dropzone" id="wall"></div>
</div>
<div style="display:flex; justify-content: space-around;">цена проекта: <div style="display: flex;"><div id="proj_cost"></div>&nbsp;руб.</div></div>
<script src="/lib/inter.js"></script>
<script>
load_groups(()=>{
get_objs();
load_proj_cloud();
});
function get_objs(){
document.getElementsByClassName("czones")[0].innerHTML = "";
load_objs((data)=>{
data.forEach(value => {
let czones = document.getElementsByClassName("czones")[0];
let czone = document.createElement('div');
czone.classList.add(value["name"]);
czone.classList.add("createzone");
czones.append(czone)
});
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")
}
})
}
}
let proj_name = "<%= proj_name %>";
// console.log(proj_name);
// let menu = document.getElementById("project_menu");
// document.getElementById("top_panel_left").innerHTML = `<div id='proj_menu' class="menu_btn">настройки проекта</div>`;
function save_proj(type){
// document.getElementById('top_panel_center').innerHTML=`сохранение ${proj_name}`;
save((res)=>{
// document.getElementById('top_panel_center').innerHTML=`сохранено ${proj_name} в облако`;
setTimeout((res)=>{
// document.getElementById("top_panel_center").innerText = `${proj_name} (облако)`;
},3000)
})
}
function save_proj_local(type){
// document.getElementById('top_panel_center').innerHTML=`сохранение ${proj_name}`;
save_local();
// document.getElementById('top_panel_center').innerHTML=`сохранено ${proj_name} в локальное хранилище`;
setTimeout((res)=>{
// document.getElementById("top_panel_center").innerText = `${proj_name} (локальное хранилище)`;
},3000)
}
// drag_start();
// console.log(px_ratio);
$(window).resize(function(){isZooming();});
function isZooming(){
resize_drags();
}
</script>
<%- include('./static/end.ejs') %>

View File

@ -107,45 +107,46 @@
padding-bottom: 0px;
margin-top: 50px;
}
#group{
display: none;
position: absolute;
padding: 0px;
margin: 0px;
width: 200px;
}
</style>
<div id="project_menu" class="cmenu">
<button id='proj_csave_btn' onclick='save_proj()'>сохранить в облако</button> <br>
<button id='proj_cload_btn' onclick='load_proj_cloud()'>загрузить из облака</button> <br>
<button id='proj_lsave_btn' onclick='save_proj_local()'>сохранить на локальное хранилище</button> <br>
<button id='proj_lload_btn' onclick='load_proj_local()'>загрузить из локальное хранилище</button> <br>
<button id='proj_del_btn' onclick='del_proj()'>удалить проект</button> <br>
<!-- <button id='proj_cload_btn' onclick='load_proj_cloud()'>загрузить из облака</button> <br> -->
<!-- <button id='proj_lsave_btn' onclick='save_proj_local()'>сохранить на локальное хранилище</button> <br>
<button id='proj_lload_btn' onclick='load_proj_local()'>загрузить из локальное хранилище</button> <br> -->
<!-- <button id='proj_del_btn' onclick='del_proj()'>удалить проект</button> <br> -->
</div>
<!-- <div class="dropzone"></div> -->
<div class="inputs">
<div id="wall_input">
<div id="obj_group">
<div style="display: flex;justify-content: space-between;">
<div style="width: 50px;">группа товаров</div>
<select name="" id="group_select" onchange="get_objs()"></select>
</div>
</div><br>
<div>
<div id="wall_input" style="display: flex;justify-content: space-between;width: 95%;margin-left: 20px;">
<div style="display: flex;width: 150px;justify-content: space-between;">
<label for="wall_height">высота </label>
<div id="wall_height_value">0</div>
<label for="wall_height" style="margin: auto;">Высота стены</label>
<input type="text" id="wall_height" style="width: 50px; text-align: center;" value="2" oninput="wall_size_change('height');resize_drags();">
</div>
<input type="range" step="0.1" min="0" max="5" id="wall_height" value="2" oninput="wall_size_change('height')" onchange="resize_drags()">
</div>
<div>
<div style="display: flex;width: 150px;justify-content: space-between;">
<label for="wall_width">ширина</label>
<div id="wall_width_value">0</div>
<label for="wall_width" style="margin: auto;">Длина стены</label>
<input type="text" id="wall_width" style="width: 50px; text-align: center;" value="4" oninput="wall_size_change('width');resize_drags();">
</div>
<input type="range" step="0.1" min="0" max="7" id="wall_width" value="4" oninput="wall_size_change('width')" onchange="resize_drags()">
<div style="display: flex;width: 150px;justify-content: space-between;">
<label for="wall_color" style="margin: auto;">цвет стены</label>
<input type="color" id="wall_color" style="width: 50px;" value="#000000" onchange="wall_color_change()">
</div>
<!-- <div style="display: flex;width: 150px;justify-content: space-between;">
<label style="margin: auto;">Расчёт стоимости</label>
</div> -->
</div>
<div class="czones"></div>
<img class="trash" style="height: 100px; width: 100px;" src="/img/shadow-energy.gif" alt="чёрная дыра">
<!-- <img class="trash" style="height: 100px; width: 100px;" src="/img/shadow-energy.gif" alt="чёрная дыра"> -->
</div>
<div class="zones" style="position: relative;">
@ -153,15 +154,97 @@
<div class="wall dropzone" id="wall"></div>
</div>
<div style="display:flex; justify-content: space-around;">цена проекта: <div style="display: flex;"><div id="proj_cost"></div>&nbsp;руб.</div></div>
<div style="display:flex; justify-content: space-around;"><div style="display: flex;"><div id="proj_cost"></div>&nbsp;руб.</div></div>
<div class="inputs" style="display: flex;justify-content: space-between;">
<div id="obj_group" style="display: flex;justify-content: space-between; width: 30vw;">
<!-- <button name="" id="group_drop" >Помехи на стене</button> -->
<button name="" id="group_drop" onclick="group_drop()">Оборудование</button>
<ul id="group" class="cmenu"></ul>
</div>
<div style="display: flex;justify-content: space-between; width: 20vw;">
<div>copy</div>
<div>back</div>
<div>forw</div>
<div>del</div>
</div>
<div style="display: flex;justify-content: space-between; width: 7vw;">
<div><img src="/img/icon/save.svg" alt="" style="width: 30px;" onclick="save_proj()"></div>
<div>load</div>
</div>
</div>
<div class="czones" style="height: 500px;"></div>
<script src="/lib/inter.js"></script>
<script>
load_groups(()=>{
get_objs();
let proj_name = "<%= proj_name %>";
function group_drop(){
let e = document.getElementById("group_drop")
// document.getElementById("group").style = `top:${e.getBoundingClientRect().top+40}px;left:${e.getBoundingClientRect().left - 5}px`;
setTimeout(()=>{
document.getElementById("group").style.display = "block";
let childs = document.getElementById("group").getElementsByTagName("input");
let i = 0;
Object.entries(childs).forEach(([key,value]) => {
console.log(key,value);
if(value.checked == true){
get_objs(value)
i++;
}
if (i==0){
document.getElementsByClassName("czones")[0].innerHTML = "";
drag_start()
// e.removeChild(e.getElementsByClassName(value))
}
});
},1)
}
function wall_color_change(){
let wall = document.getElementById("wall")
let color = document.getElementById("wall_color")
wall.style.backgroundColor = color.value;
}
function get_groups(callback){
let select = document.getElementById("group");
// let name = select.options[select.selectedIndex].text;
$.post( "/get_groups")
.done(function( res ) {
if(res["out"] == "good"){
select.innerHTML = "";
res["body"].forEach(group => {
console.log(group);
let gd = document.createElement("div");
let group_div = document.createElement("input");
let label = document.createElement("label");
group_div.setAttribute("type","checkbox");
group_div.setAttribute("onchange","group_drop()");
label.setAttribute("for",`obj_group_${group["id"]}`);
label.innerText = group["name"].replace("$"," ");
// gd.innerText = group["name"].replace("$"," ");
group_div.setAttribute("group_count",group["count"]);
group_div.setAttribute("gid",group["id"]);
group_div.id = `obj_group_${group["id"]}`;
gd.append(group_div);
gd.append(label);
select.append(gd);
// select.append(label);
if(group["id"] == res["body"].at(-1)["id"]){
if(callback)callback();
}
});
}
// callback(res);
});
}
get_groups(()=>{
// get_objs();
load_proj_cloud();
});
function get_objs(){
function get_objs(group){
document.getElementsByClassName("czones")[0].innerHTML = "";
load_objs((data)=>{
data.forEach(value => {
@ -172,44 +255,44 @@
czones.append(czone)
});
drag_start()
})
},group.getAttribute("gid"))
}
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")
}
})
}
}
// 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")
// }
// })
// }
// }
let proj_name = "<%= proj_name %>";
// console.log(proj_name);
let menu = document.getElementById("project_menu");
document.getElementById("top_panel_left").innerHTML = `<div id='proj_menu' class="menu_btn">настройки проекта</div>`;
// let menu = document.getElementById("project_menu");
// document.getElementById("top_panel_left").innerHTML = `<div id='proj_menu' class="menu_btn">настройки проекта</div>`;
function save_proj(type){
document.getElementById('top_panel_center').innerHTML=`сохранение ${proj_name}`;
function save_proj(){
// document.getElementById('top_panel_center').innerHTML=`сохранение ${proj_name}`;
save((res)=>{
document.getElementById('top_panel_center').innerHTML=`сохранено ${proj_name} в облако`;
// document.getElementById('top_panel_center').innerHTML=`сохранено ${proj_name} в облако`;
alert("saved")
setTimeout((res)=>{
document.getElementById("top_panel_center").innerText = `${proj_name} (облако)`;
// document.getElementById("top_panel_center").innerText = `${proj_name} (облако)`;
},3000)
})
}
function save_proj_local(type){
document.getElementById('top_panel_center').innerHTML=`сохранение ${proj_name}`;
function save_proj_local(){
// document.getElementById('top_panel_center').innerHTML=`сохранение ${proj_name}`;
save_local();
document.getElementById('top_panel_center').innerHTML=`сохранено ${proj_name} в локальное хранилище`;
// document.getElementById('top_panel_center').innerHTML=`сохранено ${proj_name} в локальное хранилище`;
setTimeout((res)=>{
document.getElementById("top_panel_center").innerText = `${proj_name} (локальное хранилище)`;
// document.getElementById("top_panel_center").innerText = `${proj_name} (локальное хранилище)`;
},3000)
}
@ -220,6 +303,5 @@
function isZooming(){
resize_drags();
}
</script>
<%- include('./static/end.ejs') %>
<%- include('./static/end.ejs',{soc:true}) %>

View File

@ -1,3 +1,11 @@
<% if (typeof soc !== 'undefined') {%>
<div id="top_panel_right_sec" class="tpanel top_panel_right">
<a href=""><img src="/img/vk.svg" alt=""></a>
<a href=""><img src="/img/youtube.svg" alt=""></a>
<a href=""><img src="/img/ok.svg" alt=""></a>
<a href=""><img src="/img/telegram.svg" alt=""></a>
</div>
<%}%>
</body>
</html>
<script>
@ -15,6 +23,7 @@
// e.preventDefault(); //This could also be return false as I'm using jQuery.
// })
$(window).focus(function(){
console.log(document.title);
if(document.title == "login"){
// console.log(document.title);
log_by_sid();
@ -23,4 +32,5 @@
// console.log("check");
}
});
</script>

View File

@ -23,13 +23,35 @@
}
</script>
<style>
:root{
--login-inp-w:30vw;
--login-inp-h: 7.8vh;
--main-font-size: 1.5vw;
}
.main{
width: 80vw;
width: 90vw;
margin: auto;
padding-block: 20px;
}
html{
background-color:aliceblue;
padding: 0px;
margin: 0px;
}
body{
padding: 0px;
margin: 0px;
}
*{
font: "Circe Rounded";
font-size: var(--main-font-size);
font-weight:100;
color: #3C3C3C;
}
@media (max-width: 900px) {
:root{
--main-font-size: 12px;
}
}
</style>
</head>