color, messages, logs, object groups
color fixed scrollbar; messages fixes & added date type; object groups changed button layout; logs fixes & added logs delition
This commit is contained in:
parent
72e973cd71
commit
c998dbb68e
12
db.js
12
db.js
|
@ -37,6 +37,18 @@ module.exports.dl = (table,key,value,callback,prevs = false) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports.dl_con = (table,condision,callback,prevs = false) => {
|
||||||
|
// console.log('SELECT * FROM `'+table+'` WHERE `'+key+'` = '+value);
|
||||||
|
db(prevs).query(`DELETE FROM ${table} WHERE ${condision}`, (err, rows, fields) => {
|
||||||
|
if (err) {
|
||||||
|
console.log("sql err");
|
||||||
|
throw err;
|
||||||
|
}else{
|
||||||
|
if(callback)callback(rows);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// get values where
|
// get values where
|
||||||
module.exports.gv = (table,key,value,callback,prevs = false) => {
|
module.exports.gv = (table,key,value,callback,prevs = false) => {
|
||||||
// console.log(`SELECT * FROM ${table} WHERE ${key} = ${value}`);
|
// console.log(`SELECT * FROM ${table} WHERE ${key} = ${value}`);
|
||||||
|
|
16
func.js
16
func.js
|
@ -129,14 +129,26 @@ module.exports.logs_file = (res)=>{
|
||||||
module.exports.get_logs = (res)=>{
|
module.exports.get_logs = (res)=>{
|
||||||
db.gav("logs","0",(db_logs)=>{
|
db.gav("logs","0",(db_logs)=>{
|
||||||
let logs_str = "";
|
let logs_str = "";
|
||||||
|
if(Object.keys(db_logs).length > 0){
|
||||||
for (let i = Object.keys(db_logs).length-1; i >= 0; i--) {
|
for (let i = Object.keys(db_logs).length-1; i >= 0; i--) {
|
||||||
const log = Object.values(db_logs)[i];
|
const log = Object.values(db_logs)[i];
|
||||||
let date = moment(log[`date_time`]).utc().format('YYYY-MM-DD');
|
let date = moment(log[`date_time`]).format('YYYY-MM-DD');
|
||||||
logs_str+=`${date}_${log.time}|${log.log} \n`;
|
logs_str+=`${date}_${log.time}|${log.log} \n`;
|
||||||
if(i == 0){
|
if(i == 0){
|
||||||
res.send(logs_str);
|
res.send({out:"good",body:logs_str});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
res.send({out:"good",body:logs_str});
|
||||||
|
}
|
||||||
|
},true);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.del_logs = (inp,res)=>{
|
||||||
|
if(inp["date"] == '')inp["date"] = moment().format('YYYY-MM-DD');
|
||||||
|
db.dl_con("logs",`date = '${inp["date"]}'`,(db_logs)=>{
|
||||||
|
this.get_logs(res);
|
||||||
},true);
|
},true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
21
index.js
21
index.js
|
@ -389,7 +389,7 @@ app.post("/template/loads", (req,res) => {try{
|
||||||
|
|
||||||
// main routes
|
// main routes
|
||||||
app.get('/', (req, res) => {
|
app.get('/', (req, res) => {
|
||||||
let inp = req.body;
|
let inp = req.query;
|
||||||
let cook = req.cookies;
|
let cook = req.cookies;
|
||||||
func.sid(cook,res,(include)=>{
|
func.sid(cook,res,(include)=>{
|
||||||
if(include){
|
if(include){
|
||||||
|
@ -401,28 +401,35 @@ app.get('/', (req, res) => {
|
||||||
},false)
|
},false)
|
||||||
});
|
});
|
||||||
app.get("/main", (req,res) =>{try{
|
app.get("/main", (req,res) =>{try{
|
||||||
let inp = req.body;let cook = req.cookies;
|
let inp = req.query;let cook = req.cookies;
|
||||||
func.sid(cook,res,()=>{
|
func.sid(cook,res,()=>{
|
||||||
res.render('main');
|
res.render('main');
|
||||||
})
|
})
|
||||||
} catch (error) {route_err({req:req,error:error});}
|
} catch (error) {route_err({req:req,error:error});}
|
||||||
});
|
});
|
||||||
app.get("/logs", (req,res) =>{try{
|
app.get("/logs/get", (req,res) =>{try{
|
||||||
let inp = req.body;let cook = req.cookies;
|
let inp = req.query;let cook = req.cookies;
|
||||||
func.sid(cook,res,()=>{
|
func.sid(cook,res,()=>{
|
||||||
func.get_logs(res);
|
func.get_logs(res);
|
||||||
})
|
},true,true)
|
||||||
|
} catch (error) {route_err({req:req,error:error});}
|
||||||
|
});
|
||||||
|
app.get("/logs/del", (req,res) =>{try{
|
||||||
|
let inp = req.query;let cook = req.cookies;
|
||||||
|
func.sid(cook,res,()=>{
|
||||||
|
func.del_logs(inp,res);
|
||||||
|
},true,true)
|
||||||
} catch (error) {route_err({req:req,error:error});}
|
} catch (error) {route_err({req:req,error:error});}
|
||||||
});
|
});
|
||||||
app.get("/help", (req,res) =>{try{
|
app.get("/help", (req,res) =>{try{
|
||||||
let inp = req.body;let cook = req.cookies;
|
let inp = req.query;let cook = req.cookies;
|
||||||
func.sid(cook,res,()=>{
|
func.sid(cook,res,()=>{
|
||||||
res.render('help');
|
res.render('help');
|
||||||
})
|
})
|
||||||
} catch (error) {route_err({req:req,error:error});}
|
} catch (error) {route_err({req:req,error:error});}
|
||||||
});
|
});
|
||||||
app.get("/temp", (req,res) =>{try{
|
app.get("/temp", (req,res) =>{try{
|
||||||
let inp = req.body;let cook = req.cookies;
|
let inp = req.query;let cook = req.cookies;
|
||||||
func.sid(cook,res,()=>{
|
func.sid(cook,res,()=>{
|
||||||
res.render('templates');
|
res.render('templates');
|
||||||
})
|
})
|
||||||
|
|
|
@ -23,10 +23,10 @@
|
||||||
<section style="display: flex;">
|
<section style="display: flex;">
|
||||||
<div style="width: 7.5vw;">
|
<div style="width: 7.5vw;">
|
||||||
<h1>Логи</h1>
|
<h1>Логи</h1>
|
||||||
<button onclick="logs();" class="btn_white">Обновить</button>
|
<button onclick="get_logs();" class="btn_blue" style="margin-block: 0.5vh;">Обновить</button>
|
||||||
<br>
|
<button onclick="del_logs()" class="btn_blue" style="margin-block: 0.5vh; font-size: calc(var(--main-font-size)/1.4);">Удалить логи</button>
|
||||||
<label for="logs_check" style="font-size: calc(var(--main-font-size)/1.5);">Автозагрузка</label>
|
<label for="logs_check" style="font-size: calc(var(--main-font-size)/1.5);" style="margin-block: 0.5vh;">Автозагрузка</label>
|
||||||
<input type="checkbox" id="logs_check" oninput="logs_check(event)">
|
<input type="checkbox" id="logs_check" oninput="logs_check(event)" style="margin-block: 0.5vh;">
|
||||||
</div>
|
</div>
|
||||||
<div id="logs" style="background-color: white;width: 70vw;font-size: calc(var(--main-font-size)/1.4);overflow: auto;height: 80vh;"></div>
|
<div id="logs" style="background-color: white;width: 70vw;font-size: calc(var(--main-font-size)/1.4);overflow: auto;height: 80vh;"></div>
|
||||||
</section>
|
</section>
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
function log_check(){
|
function log_check(){
|
||||||
if($.cookie("auto_log") != null){
|
if($.cookie("auto_log") != null){
|
||||||
if(JSON.parse($.cookie("auto_log")) == true){
|
if(JSON.parse($.cookie("auto_log")) == true){
|
||||||
logs();
|
get_logs();
|
||||||
}
|
}
|
||||||
document.getElementById("logs_check").checked = JSON.parse($.cookie("auto_log"));
|
document.getElementById("logs_check").checked = JSON.parse($.cookie("auto_log"));
|
||||||
}else{
|
}else{
|
||||||
|
@ -46,16 +46,29 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function logs() {
|
function get_logs() {
|
||||||
let wait_msg = msg("Загрузка логов",{type:"wait"});
|
let wait_msg = msg("Загрузка логов",{type:"wait"});
|
||||||
$.get("/logs")
|
$.get("/logs/get")
|
||||||
.done(function( res ) {
|
.done(function( res ) {
|
||||||
document.getElementById("logs").innerText = res;
|
document.getElementById("logs").innerText = res["body"];
|
||||||
msg_del(wait_msg.id);
|
msg_del(wait_msg.id);
|
||||||
msg("Логи загружены")
|
msg("Логи загружены")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function del_logs() {
|
||||||
|
msg("date",{type:"date",res:(date)=>{if(date != false){
|
||||||
|
let wait_msg = msg(`Удаление логов за ${date}`,{type:"wait"});
|
||||||
|
$.get("/logs/del",{date:date})
|
||||||
|
.done(function( res ) {
|
||||||
|
document.getElementById("logs").innerText = res["body"];
|
||||||
|
msg_del(wait_msg.id);
|
||||||
|
msg("Логи удалены")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}})
|
||||||
|
}
|
||||||
|
|
||||||
function logs_check(event){
|
function logs_check(event){
|
||||||
let log_inp = event.target;
|
let log_inp = event.target;
|
||||||
let check = log_inp.checked;
|
let check = log_inp.checked;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div id="admin_colors" style="display: flex;justify-content: space-between;margin-top: 4vh;">
|
<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;">
|
<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>
|
<label for="obj_colors" style="min-width: 10vw;float: left;">цвет объекта</label>
|
||||||
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;"></div>
|
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;height: 4.5vh;"></div>
|
||||||
</div>
|
</div>
|
||||||
<div id="inp">
|
<div id="inp">
|
||||||
<input type="color" id="new_color" style="margin: auto;">
|
<input type="color" id="new_color" style="margin: auto;">
|
||||||
|
@ -24,6 +24,7 @@
|
||||||
color_div.classList.add("color_palette");
|
color_div.classList.add("color_palette");
|
||||||
color_div.id=`color_${value["color"]}`;
|
color_div.id=`color_${value["color"]}`;
|
||||||
color_div.setAttribute("color_id",`${value["id"]}`)
|
color_div.setAttribute("color_id",`${value["id"]}`)
|
||||||
|
color_div.setAttribute("color",`${value["color"]}`)
|
||||||
color_div.setAttribute("onclick",`clear_palette();document.getElementById('color_${value["color"]}').style.border = "1px blue solid";cur_color = 'color_${value["color"]}';`)
|
color_div.setAttribute("onclick",`clear_palette();document.getElementById('color_${value["color"]}').style.border = "1px blue solid";cur_color = 'color_${value["color"]}';`)
|
||||||
color_div.title = `#${value["color"]}`;
|
color_div.title = `#${value["color"]}`;
|
||||||
div.append(color_div);
|
div.append(color_div);
|
||||||
|
@ -48,9 +49,14 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function del_color(){
|
function del_color(){
|
||||||
|
if(document.getElementById(cur_color) == null){
|
||||||
|
msg("Цвет не выбран",{type:"warning"});
|
||||||
|
}
|
||||||
|
else{
|
||||||
let color_id = document.getElementById(cur_color).getAttribute("color_id")
|
let color_id = document.getElementById(cur_color).getAttribute("color_id")
|
||||||
|
let color = document.getElementById(cur_color).getAttribute("color")
|
||||||
msg("Удалить этот цвет?",{type:"ask",res:(out)=>{if(out){
|
msg("Удалить этот цвет?",{type:"ask",res:(out)=>{if(out){
|
||||||
$.post( "/admin/colors/delete", {id:color_id})
|
$.post( "/admin/colors/delete", {id:color_id,color:color})
|
||||||
.done(function( res ) {
|
.done(function( res ) {
|
||||||
if(res["out"] == "good"){
|
if(res["out"] == "good"){
|
||||||
msg("цвет удалён");
|
msg("цвет удалён");
|
||||||
|
@ -59,6 +65,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}}})
|
}}})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
|
@ -45,16 +45,16 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<div style="display: flex;justify-content: space-between;padding-block: 1vw;">
|
||||||
<h1>Изменение объектов</h1>
|
<h1>Изменение объектов</h1>
|
||||||
|
<div id="find_obj_btns">
|
||||||
|
<button onclick="edit_get_objs(true)" class="btn_blue">Найти по имени</button>
|
||||||
|
<button onclick='gids = [];edit_get_objs();' class="btn_blue">Сбосить</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div id="objs_in_group"></div>
|
<div id="objs_in_group"></div>
|
||||||
</div>
|
</div>
|
||||||
<div style="display: flex;justify-content: space-between;float: right;">
|
|
||||||
<div id="find_obj_btns">
|
|
||||||
<button onclick="edit_get_objs(true)" class="btn_blue">найти по имени</button>
|
|
||||||
<button onclick='gids = [];edit_get_objs();' class="btn_blue">очистить</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// load_groups(()=>{
|
// load_groups(()=>{
|
||||||
|
@ -304,7 +304,7 @@
|
||||||
`<td>${divs["width"]}</td>`+
|
`<td>${divs["width"]}</td>`+
|
||||||
`<td>${divs["cost"]}</td>`+
|
`<td>${divs["cost"]}</td>`+
|
||||||
`<td><a href='${divs["link"]}'>${divs["link"]}</a></td>`+
|
`<td><a href='${divs["link"]}'>${divs["link"]}</a></td>`+
|
||||||
`<td>${divs["color"]}</td>`+
|
`<td><input type='checkbox' id='obj_edit_color_check' ${(divs["color"] == true)? "checked":""} onclick='return false' onkeydown='return false'/></td>`+
|
||||||
`<td><button onclick='${divs["edit"]}' class='btn_blue'>Выбрать</button></td>`+
|
`<td><button onclick='${divs["edit"]}' class='btn_blue'>Выбрать</button></td>`+
|
||||||
"</tr>";
|
"</tr>";
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,11 @@
|
||||||
border: 0px;
|
border: 0px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
.yes-ans:hover, .no-ans:hover{
|
||||||
|
transition-duration: 200ms;
|
||||||
|
color: rgba(0, 144, 0, 0.5);
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,6 +49,9 @@
|
||||||
<script>
|
<script>
|
||||||
let msg_int = 0;
|
let msg_int = 0;
|
||||||
function msg(text,params = {type:null,time:null,res:null,def:null}){
|
function msg(text,params = {type:null,time:null,res:null,def:null}){
|
||||||
|
Object.values(document.getElementsByClassName("message")).forEach(element => {
|
||||||
|
element.setAttribute("ans","false");
|
||||||
|
});
|
||||||
params.time = (params.time == null)? 8:params.time;
|
params.time = (params.time == null)? 8:params.time;
|
||||||
params.type = (params.type == null)? "msg":params.type;
|
params.type = (params.type == null)? "msg":params.type;
|
||||||
msg_int++;
|
msg_int++;
|
||||||
|
@ -74,6 +82,9 @@
|
||||||
case "wait":
|
case "wait":
|
||||||
msg_div.style.borderColor = "rgba(0, 0, 255, 0.5)";
|
msg_div.style.borderColor = "rgba(0, 0, 255, 0.5)";
|
||||||
break;
|
break;
|
||||||
|
case "date":
|
||||||
|
msg_div.style.borderColor = "rgba(0, 255, 0, 0.5)";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -89,6 +100,8 @@
|
||||||
no.innerText = "Нет";
|
no.innerText = "Нет";
|
||||||
yes.classList.add("yes-ans")
|
yes.classList.add("yes-ans")
|
||||||
no.classList.add("no-ans")
|
no.classList.add("no-ans")
|
||||||
|
yes.classList.add("ans")
|
||||||
|
no.classList.add("ans")
|
||||||
yes.id = `${msg_div.id}-yes`;
|
yes.id = `${msg_div.id}-yes`;
|
||||||
no.id = `${msg_div.id}-no`;
|
no.id = `${msg_div.id}-no`;
|
||||||
q_div.append(yes)
|
q_div.append(yes)
|
||||||
|
@ -101,10 +114,21 @@
|
||||||
msg_div.setAttribute("ans","null")
|
msg_div.setAttribute("ans","null")
|
||||||
yes.setAttribute("onclick",`document.getElementById('${msg_div.id}').setAttribute("ans","true")`)
|
yes.setAttribute("onclick",`document.getElementById('${msg_div.id}').setAttribute("ans","true")`)
|
||||||
no.setAttribute("onclick",`document.getElementById('${msg_div.id}').setAttribute("ans","false")`)
|
no.setAttribute("onclick",`document.getElementById('${msg_div.id}').setAttribute("ans","false")`)
|
||||||
|
yes.focus();
|
||||||
|
yes.addEventListener('keydown', function(e) {
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
document.getElementById(`${msg_div.id}`).setAttribute("ans","true")
|
||||||
|
}
|
||||||
|
else if (e.keyCode === 27) {
|
||||||
|
document.getElementById(`${msg_div.id}`).setAttribute("ans","false")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
var observer = new MutationObserver(function(mutations) {
|
var observer = new MutationObserver(function(mutations) {
|
||||||
mutations.forEach(function(mutation) {
|
mutations.forEach(function(mutation) {
|
||||||
if (mutation.type = "attributes" && mutation.target.getAttribute("ans") != "null") {
|
if (mutation.type = "attributes" && mutation.target.getAttribute("ans") != "null") {
|
||||||
console.log(mutation);
|
// console.log(mutation);
|
||||||
if(mutation.target.getAttribute("ans") == "true"){
|
if(mutation.target.getAttribute("ans") == "true"){
|
||||||
params.res(true);fin();
|
params.res(true);fin();
|
||||||
}
|
}
|
||||||
|
@ -143,6 +167,8 @@
|
||||||
no.innerText = "Отменить";
|
no.innerText = "Отменить";
|
||||||
yes.classList.add("yes-ans")
|
yes.classList.add("yes-ans")
|
||||||
no.classList.add("no-ans")
|
no.classList.add("no-ans")
|
||||||
|
yes.classList.add("ans")
|
||||||
|
no.classList.add("ans")
|
||||||
yes.id = `${msg_div.id}-yes`;
|
yes.id = `${msg_div.id}-yes`;
|
||||||
no.id = `${msg_div.id}-no`;
|
no.id = `${msg_div.id}-no`;
|
||||||
q_div.append(yes)
|
q_div.append(yes)
|
||||||
|
@ -152,13 +178,22 @@
|
||||||
msg_div.setAttribute("ans","null")
|
msg_div.setAttribute("ans","null")
|
||||||
yes.setAttribute("onclick",`document.getElementById('${msg_div.id}').setAttribute("ans","true")`)
|
yes.setAttribute("onclick",`document.getElementById('${msg_div.id}').setAttribute("ans","true")`)
|
||||||
no.setAttribute("onclick",`document.getElementById('${msg_div.id}').setAttribute("ans","false")`)
|
no.setAttribute("onclick",`document.getElementById('${msg_div.id}').setAttribute("ans","false")`)
|
||||||
|
text.focus();
|
||||||
|
text.addEventListener('keydown', function(e) {
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
document.getElementById(`${msg_div.id}`).setAttribute("ans","true")
|
||||||
|
}
|
||||||
|
else if (e.keyCode === 27) {
|
||||||
|
document.getElementById(`${msg_div.id}`).setAttribute("ans","false")
|
||||||
|
}
|
||||||
|
})
|
||||||
// document.getElementById("message_div").style.pointerEvents = "all";
|
// document.getElementById("message_div").style.pointerEvents = "all";
|
||||||
// document.getElementById("message_div").setAttribute("onclick",`document.getElementById('${msg_div.id}').setAttribute("ans","false")`)
|
// document.getElementById("message_div").setAttribute("onclick",`document.getElementById('${msg_div.id}').setAttribute("ans","false")`)
|
||||||
|
|
||||||
var observer = new MutationObserver(function(mutations) {
|
var observer = new MutationObserver(function(mutations) {
|
||||||
mutations.forEach(function(mutation) {
|
mutations.forEach(function(mutation) {
|
||||||
if (mutation.type = "attributes" && mutation.target.getAttribute("ans") != "null") {
|
if (mutation.type = "attributes" && mutation.target.getAttribute("ans") != "null") {
|
||||||
console.log(mutation);
|
// console.log(mutation);
|
||||||
if(mutation.target.getAttribute("ans") == "true"){
|
if(mutation.target.getAttribute("ans") == "true"){
|
||||||
params.res(text.value);fin();
|
params.res(text.value);fin();
|
||||||
}
|
}
|
||||||
|
@ -182,7 +217,74 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(params.type != "wait" && params.type != "ask"){
|
if (params.type == "date"){
|
||||||
|
// msg_div.setAttribute("onclick",`msg_del("msg_${msg_int}")`);
|
||||||
|
let yes = document.createElement("button");
|
||||||
|
let no = document.createElement("button");
|
||||||
|
let q_div = document.createElement("div");
|
||||||
|
let date = document.createElement("input");
|
||||||
|
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.classList.add("ans")
|
||||||
|
no.classList.add("ans")
|
||||||
|
yes.id = `${msg_div.id}-yes`;
|
||||||
|
no.id = `${msg_div.id}-no`;
|
||||||
|
q_div.append(yes)
|
||||||
|
q_div.append(no)
|
||||||
|
msg_div.append(date)
|
||||||
|
msg_div.append(q_div)
|
||||||
|
date.setAttribute("type","date");
|
||||||
|
|
||||||
|
// document.getElementById("message_div").style.pointerEvents = "all";
|
||||||
|
// document.getElementById("message_div").setAttribute("onclick",`document.getElementById('${msg_div.id}').setAttribute("ans","false")`)
|
||||||
|
let now = new Date().toLocaleDateString().split(".").reverse().join('-');;
|
||||||
|
date.value = now;
|
||||||
|
|
||||||
|
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")`)
|
||||||
|
yes.focus();
|
||||||
|
yes.addEventListener('keydown', function(e) {
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
document.getElementById(`${msg_div.id}`).setAttribute("ans","true")
|
||||||
|
}
|
||||||
|
else if (e.keyCode === 27) {
|
||||||
|
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(date.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";
|
||||||
|
if (document.getElementById(msg_div.id) != null){
|
||||||
|
msg_div.style.transform = "translateX(120%)";
|
||||||
|
setTimeout(() => {
|
||||||
|
msg_root.removeChild(msg_div);
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(params.type != "wait" && params.type != "ask" && params.type != "date"){
|
||||||
msg_div.setAttribute("onclick",`msg_del("msg_${msg_int}")`);
|
msg_div.setAttribute("onclick",`msg_del("msg_${msg_int}")`);
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
if (document.getElementById(msg_div.id) != null){
|
if (document.getElementById(msg_div.id) != null){
|
||||||
|
|
|
@ -190,7 +190,7 @@
|
||||||
<div class="inputs" style="display: flex;justify-content: space-between;height: 5vh;">
|
<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%);">
|
<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>
|
<label for="obj_colors" style="min-width: 10vw;">цвет объекта</label>
|
||||||
<div id="obj_colors" style="display: flex; width: 30vw;overflow: auto;"></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)"> -->
|
<!-- <input id="obj_color" type="color" onchange="obj_color_change(event)"> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user