diff --git a/public/index.html b/public/index.html index 5785d1e51..41a750bae 100644 --- a/public/index.html +++ b/public/index.html @@ -1262,7 +1262,7 @@ - Close + Close Past Chat Popup
diff --git a/public/script.js b/public/script.js index bc191ff2b..7b5c71357 100644 --- a/public/script.js +++ b/public/script.js @@ -702,7 +702,8 @@ async function delChat(chatfile) { }), }); if (response.ok === true) { - + clearChat(); + getChat(); } } @@ -2330,19 +2331,17 @@ async function getAllCharaChats() { mes = "..." + mes.substring(mes.length - strlen); } $("#select_chat_div").append( - '
' + - data[key]["file_name"] + - '
' + + '
' + + '
' + + '
' + + '
' + data[key]["file_name"] + '
' + + '
' + mes + "
" + - '
' + - "
" + "
" + + '
' + + '
' + ); if ( @@ -2351,7 +2350,7 @@ async function getAllCharaChats() { ) { //children().last() $("#select_chat_div") - .children(":nth-last-child(1)") + .find(".select_chat_block:last") .attr("highlight", true); } } @@ -3230,7 +3229,9 @@ $(document).ready(function () { bg_file_for_del.parent().remove(); } if (popup_type == "del_chat") { + $("#select_chat_cross").click(); delChat(chat_file_for_del); + $("#option_select_chat").click(); } if (popup_type == "del_ch") { console.log( diff --git a/public/style.css b/public/style.css index c4d752b5a..f35aa5ef7 100644 --- a/public/style.css +++ b/public/style.css @@ -2048,6 +2048,13 @@ input[type="range"]{ margin-bottom: 10px; } +.select_chat_block_wrapper{ + display: grid; + grid-template-columns: auto auto; + align-items: center; + grid-gap: 10px; +} + .select_chat_block { border-radius: 10px; /* margin-right: 10px; */ @@ -2092,9 +2099,9 @@ input[type="range"]{ } .PastChat_cross{ - position: absolute; +/* position: absolute; right: 15px; - margin-top: 5px; + margin-top: 5px; */ width: 15px; height: 15px; cursor: pointer; @@ -2108,6 +2115,11 @@ input[type="range"]{ box-shadow: 0 0 0 2pt black; } +.PastChat_cross:hover{ + background-color: var(--fullred); + box-shadow: 0 0 0 2pt red; +} + #advanced_book_logo { width: 35px; height: 35px; diff --git a/server.js b/server.js index 46ab7a0b4..3e5c3aaf6 100644 --- a/server.js +++ b/server.js @@ -814,8 +814,11 @@ app.post("/delbackground", jsonParser, function (request, response) { }); app.post("/delchat", jsonParser, function (request, response) { - - if (!request.body) return response.sendStatus(400); + console.log('/delchat entered'); + if (!request.body) { + console.log('no request body seen'); + return response.sendStatus(400); + } if (request.body.chatfile !== sanitize(request.body.chatfile)) { console.error('Malicious chat name prevented'); @@ -826,10 +829,15 @@ app.post("/delchat", jsonParser, function (request, response) { if (!fs.existsSync(fileName)) { console.log('Chat file not found'); return response.sendStatus(400); + } else { + console.log('found the chat file: ' + fileName); + /* fs.unlinkSync(fileName); */ + fs.rmSync(fileName); + console.log('deleted chat file: ' + fileName); + } - fs.rmSync(fileName); - console.log('deleted chat file: ' + fileName); + return response.send('ok'); });