Compare commits

..

No commits in common. "5916d3a963a6ef1b01a46631f8b53be9ddebdbe6" and "6b4fd9a997ad7db9f143bf969e418c91b0cf9878" have entirely different histories.

94 changed files with 27 additions and 50 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
node_modules
npm-debug.log

0
.gitattributes vendored Executable file → Normal file
View File

0
.gitignore vendored Executable file → Normal file
View File

2
Dockerfile Executable file → Normal file
View File

@ -16,4 +16,4 @@ RUN npm install
COPY . .
EXPOSE 8080
CMD [ "node", "index.js" ]
CMD [ "node", "index.js" ]

0
admin.js Executable file → Normal file
View File

0
back_users.sql Executable file → Normal file
View File

2
db.js Executable file → Normal file
View File

@ -189,4 +189,4 @@ module.exports.crc = (table,callback,prevs = false) =>{
if(callback)callback(rows[0]["COUNT(*)"]);
}
})
}
}

1
docker-compose.yml → docker-compose.yaml Executable file → Normal file
View File

@ -1,4 +1,5 @@
version: '3.1'
services:
db:
image: mysql

0
func.js Executable file → Normal file
View File

0
index.js Executable file → Normal file
View File

0
object.js Executable file → Normal file
View File

4
package-lock.json generated Executable file → Normal file
View File

@ -1,11 +1,11 @@
{
"name": "puzzle",
"name": "puzle",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "puzzle",
"name": "puzle",
"version": "1.0.0",
"license": "ISC",
"dependencies": {

2
package.json Executable file → Normal file
View File

@ -14,7 +14,7 @@
"replace-color": "^2.3.0",
"uuid": "^9.0.0"
},
"name": "puzzle",
"name": "puzle",
"version": "1.0.0",
"main": "index.js",
"scripts": {

0
project.js Executable file → Normal file
View File

0
public/favicon.ico Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

0
public/img/background/photo_2023-06-06_08-53-47 1.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.3 MiB

After

Width:  |  Height:  |  Size: 2.3 MiB

0
public/img/bg1red.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

0
public/img/drop.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 300 B

After

Width:  |  Height:  |  Size: 300 B

0
public/img/icon/back.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 600 B

After

Width:  |  Height:  |  Size: 600 B

0
public/img/icon/copy.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 661 B

After

Width:  |  Height:  |  Size: 661 B

0
public/img/icon/copy.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 814 B

After

Width:  |  Height:  |  Size: 814 B

0
public/img/icon/del.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 688 B

After

Width:  |  Height:  |  Size: 688 B

0
public/img/icon/down.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

0
public/img/icon/download.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 579 B

After

Width:  |  Height:  |  Size: 579 B

0
public/img/icon/download.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 847 B

After

Width:  |  Height:  |  Size: 847 B

0
public/img/icon/edit.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

0
public/img/icon/forw.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 603 B

After

Width:  |  Height:  |  Size: 603 B

0
public/img/icon/save.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

0
public/img/icon/save.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

0
public/img/icon/trash.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

0
public/img/icon/up.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

0
public/img/new_proj.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 848 KiB

After

Width:  |  Height:  |  Size: 848 KiB

View File

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View File

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

View File

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

View File

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

View File

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 95 KiB

View File

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 89 KiB

View File

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

View File

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

View File

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

View File

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

View File

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

View File

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

View File

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 164 KiB

0
public/img/ok.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

0
public/img/placeholder.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

0
public/img/proj_placeholder.webp Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 802 B

After

Width:  |  Height:  |  Size: 802 B

0
public/img/shadow-energy.gif Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 435 KiB

After

Width:  |  Height:  |  Size: 435 KiB

0
public/img/telegram.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

0
public/img/vk.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 721 B

0
public/img/youtube.svg Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 623 B

After

Width:  |  Height:  |  Size: 623 B

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

0
public/lib/aes.js Executable file → Normal file
View File

0
public/lib/ejs.js Executable file → Normal file
View File

0
public/lib/fn.js Executable file → Normal file
View File

0
public/lib/html2canvas.js Executable file → Normal file
View File

12
public/lib/inter.js Executable file → Normal file
View File

@ -123,10 +123,6 @@ function obj_click(id){
function obj_selection(clear = false){
cur_obj = (clear == true)? null:cur_obj;
let drags = document.getElementsByClassName("drag");
// let layer_inp = document.getElementsByClassName("layer_inp");
// let obj_color = document.getElementsByClassName("obj_color_div");
// layer_inp.value = 0;
// obj_color.style.display = "none";
Object.values(drags).forEach(element => {
// console.log(element.id,cur_obj);
if (element.id != cur_obj){
@ -194,7 +190,7 @@ function calc_total(start = false){
let obj_cost_div = document.createElement("li");
obj_cost_div.innerHTML =
`<div style="display:flex;"> ` +
`<div id='obj_cost_name'>${key.split("~g~")[0].replaceAll("$"," ")}`+
`<div id='obj_cost_name' style='font-size:calc(var(--main-font-size)/1);'>${key.split("~g~")[0].replaceAll("$"," ")}`+
`<div id='obj_cost_count'>&nbsp${Object.keys(value).length}X</div> </div>`+
`</div>`+
`<div id='obj_cost'>${parseInt(parseInt(objs_store[key]["cost"]) * Object.keys(value).length)}</div>`;
@ -206,7 +202,7 @@ function calc_total(start = false){
// return total;
objs["total"] = total;
document.getElementById("proj_cost_text").innerText = `Стоимость: ${total} руб.`;
document.getElementById("proj_cost_text").innerText = `стоимость: ${total} руб.`;
}
function load(objss){
@ -246,12 +242,8 @@ function load(objss){
function reload(save = false){
// objs = JSON.parse($.cookie("objs"));
// console.log(objs);
// objs = objs.sort();
document.getElementById("drags").innerHTML = "";
let cro = cur_obj;
load(objs);
cur_obj = cro;
obj_selection();
if(save){save(()=>{},false)}
}

0
public/lib/inter_group_object.js Executable file → Normal file
View File

0
public/lib/inter_temp.js Executable file → Normal file
View File

0
public/lib/interact.js Executable file → Normal file
View File

0
public/lib/interact.js.map Executable file → Normal file
View File

0
public/lib/jquery.cookie.js Executable file → Normal file
View File

0
public/lib/jquery.js vendored Executable file → Normal file
View File

0
templates.js Executable file → Normal file
View File

View File

@ -1,3 +0,0 @@
#!/bin/bash
git pull https://github.com/n0rdye/puzzle.git --autostash;
docker-compose restart;

0
user.js Executable file → Normal file
View File

0
vars.js Executable file → Normal file
View File

0
views/admin.ejs Executable file → Normal file
View File

0
views/admin/objects.ejs Executable file → Normal file
View File

4
views/admin/objects/group_object.ejs Executable file → Normal file
View File

@ -187,10 +187,10 @@
<div style="display:flex; justify-content: space-around;"></div>
<div class="inputs" style="display: flex;justify-content: space-between;height: 6vh;">
<div class="inputs" style="display: flex;justify-content: space-between;height: 5vh;">
<div id="obj_color_div" style="justify-content: space-evenly; width: 50vw;display: none;transform: translateX(30%);">
<label for="obj_colors" style="min-width: 10vw;">цвет объекта</label>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 100%;"></div>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 50px;"></div>
<!-- <input id="obj_color" type="color" onchange="obj_color_change(event)"> -->
</div>
</div>

4
views/admin/objects/object_colors.ejs Executable file → Normal file
View File

@ -1,7 +1,7 @@
<div id="admin_colors" style="display: flex;justify-content: space-between;height: 6vh;">
<div id="admin_colors" style="display: flex;justify-content: space-between;margin-top: 4vh;">
<div id="obj_color_div" style="justify-content: space-between; width: 50vw;display: flex;">
<label for="obj_colors" style="min-width: 10vw;float: left;">цвет объекта</label>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 100%;"></div>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 50px;"></div>
</div>
<div id="inp">
<input type="color" id="new_color" style="margin: auto;">

0
views/admin/objects/object_creation.ejs Executable file → Normal file
View File

10
views/admin/objects/object_edit.ejs Executable file → Normal file
View File

@ -61,7 +61,6 @@
// edit_get_objs();
// });
const get_object_id = new URL(window.location).searchParams.get("object_id");
let wait_msg_object_load = (get_object_id != null)? msg("загружаем прошлый объект",{type:"wait"}):null;
function set_edit(id){
@ -84,7 +83,8 @@
function edit_get_objs(by_name = false,callback){
document.getElementById("objs_in_group").innerHTML = "";
// if (obj_edit_type == "edit") set_obj_edit_params();
if (obj_edit_type == "edit") set_obj_edit_params();
let wait_msg_object_load = (get_object_id != null)? msg("загружаем прошлый объект",{type:"wait"}):null;
edit_load_objs((data)=>{
let wait_msg = msg("Загрузка объектов",{type:"wait"})
data.forEach(value => {
@ -98,7 +98,6 @@
if(get_object_id != null && wait_msg_object_load != null){
set_edit(get_object_id);
msg_del(wait_msg_object_load.id);
wait_msg_object_load = null;
}
if(callback)callback(true);
}
@ -195,10 +194,9 @@
msg("название товара не было изменино поскольку оно занято",{type:"warning"})
}
else{
// window.history.pushState({}, null, `${(new URL(window.location)).toString().split("?")[0]}`);
// delete get_object_id;
window.history.pushState({}, null, `${(new URL(window.location)).toString().split("?")[0]}`);
msg("товар сохранён");
// set_obj_edit_params();
set_obj_edit_params();
edit_get_objs();
}
}

0
views/admin/objects/object_groups.ejs Executable file → Normal file
View File

0
views/admin/users.ejs Executable file → Normal file
View File

0
views/admin/users/user_edit.ejs Executable file → Normal file
View File

0
views/admin/users/user_reg.ejs Executable file → Normal file
View File

0
views/header.ejs Executable file → Normal file
View File

0
views/help.ejs Executable file → Normal file
View File

0
views/load.ejs Executable file → Normal file
View File

0
views/login.ejs Executable file → Normal file
View File

0
views/main.ejs Executable file → Normal file
View File

0
views/message.ejs Executable file → Normal file
View File

0
views/old/project.ejs Executable file → Normal file
View File

27
views/project.ejs Executable file → Normal file
View File

@ -147,7 +147,7 @@
</div>
<div id="cost_div" style="display: flex;width: 15vw;justify-content: space-between;">
<button id="proj_cost" class="menu_btn" style="width: 100%;z-index: 3;">
<div id="proj_cost_text" style="pointer-events: none;font-size:calc(var(--main-font-size)/1.2);">Стоимость</div>
<div id="proj_cost_text" style="pointer-events: none;">Расчет стоимости</div>
<img src="/img/drop.png" style="width: 1vw;height: 0.5vw;pointer-events: none;" alt="\/">
</button>
<style>
@ -165,15 +165,6 @@
width: 14vw;
padding: 0.45vw;
}
#cost_list #obj_cost_name{
font-size:calc(var(--main-font-size)/1.3);
}
#cost_list #obj_cost_count{
font-size:calc(var(--main-font-size)/1.3);
}
#cost_list #obj_cost{
font-size:calc(var(--main-font-size)/1.3);
}
</style>
<ul id="cost_list" class="cmenu">
</ul>
@ -196,10 +187,10 @@
<div style="display:flex; justify-content: space-around;"></div>
<div class="inputs" style="display: flex;justify-content: space-between;height: 6vh;">
<div class="inputs" style="display: flex;justify-content: space-between;height: 5vh;">
<div id="obj_color_div" style="justify-content: space-evenly; width: 50vw;display: none;transform: translateX(30%);">
<label for="obj_colors" style="min-width: 10vw;">цвет объекта</label>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 100%;"></div>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 50px;"></div>
<!-- <input id="obj_color" type="color" onchange="obj_color_change(event)"> -->
</div>
</div>
@ -329,7 +320,7 @@
}
function img_download(){
msg("добавить на фото Стоимость?",{type:"ask",res:(out)=>{
msg("добавить на фото стоимость?",{type:"ask",res:(out)=>{
let wait_msg = msg("делаем фото",{type:"wait"})
proj_img((src)=>{
msg("изображение проекта готово",{time:3})
@ -352,13 +343,12 @@
width += document.getElementById("proj_cost").getBoundingClientRect().width;
document.getElementById("drags").append(document.getElementById("cost_div"));
document.getElementById("cost_div").style.marginLeft = `${parseInt(document.getElementById("wall").style.width) + 4}px`;
document.getElementById("cost_div").style.marginTop = `4px`;
document.getElementById("cost_list").style.display = "block";
}
html2canvas(document.getElementById("drags"),{
y:6,
x:0,
width:(width+5),
y:7,
x:2,
width:width,
logging:false
// scale:0.99
}).then(canvas => {
@ -428,7 +418,6 @@
}
function go_back(){
obj_selection(true)
if(objs_back.length > 0){
objs_forw.push(objs);
objs = objs_back.at(-1);
@ -438,7 +427,6 @@
}
}
function go_forw(){
obj_selection(true)
if(objs_forw.length > 0){
objs_back.push(objs);
objs = objs_forw.at(-1);
@ -477,7 +465,6 @@
}
}
// console.log(objs[obj.classList[0]][obj.getAttribute("id")]);
reload();
}
function obj_del(){

0
views/static/404.ejs Executable file → Normal file
View File

0
views/static/end.ejs Executable file → Normal file
View File

0
views/static/language.ejs Executable file → Normal file
View File

0
views/static/start.ejs Executable file → Normal file
View File

4
views/template.ejs Executable file → Normal file
View File

@ -187,10 +187,10 @@
<div style="display:flex; justify-content: space-around;"></div>
<div class="inputs" style="display: flex;justify-content: space-between;height: 6vh;">
<div class="inputs" style="display: flex;justify-content: space-between;height: 5vh;">
<div id="obj_color_div" style="justify-content: space-evenly; width: 50vw;display: none;transform: translateX(30%);">
<label for="obj_colors" style="min-width: 10vw;">цвет объекта</label>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 100%;"></div>
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 4.5vh;"></div>
<!-- <input id="obj_color" type="color" onchange="obj_color_change(event)"> -->
</div>
</div>

0
views/templates.ejs Executable file → Normal file
View File