Fix empty original substitution and bg mobile usability

This commit is contained in:
Cohee 2023-07-21 12:00:40 +03:00
parent 932da47476
commit bdca4b9bad
2 changed files with 17 additions and 5 deletions

View File

@ -1524,6 +1524,8 @@ function scrollChatToBottom() {
function substituteParams(content, _name1, _name2, _original) { function substituteParams(content, _name1, _name2, _original) {
_name1 = _name1 ?? name1; _name1 = _name1 ?? name1;
_name2 = _name2 ?? name2; _name2 = _name2 ?? name2;
_original = _original || '';
if (!content) { if (!content) {
return ''; return '';
} }
@ -1531,10 +1533,7 @@ function substituteParams(content, _name1, _name2, _original) {
// Replace {{original}} with the original message // Replace {{original}} with the original message
// Note: only replace the first instance of {{original}} // Note: only replace the first instance of {{original}}
// This will hopefully prevent the abuse // This will hopefully prevent the abuse
if (_original) { content = content.replace(/{{original}}/i, _original);
content = content.replace(/{{original}}/i, _original);
}
content = content.replace(/{{input}}/gi, $('#send_textarea').val()); content = content.replace(/{{input}}/gi, $('#send_textarea').val());
content = content.replace(/{{user}}/gi, _name1); content = content.replace(/{{user}}/gi, _name1);
content = content.replace(/{{char}}/gi, _name2); content = content.replace(/{{char}}/gi, _name2);
@ -7075,6 +7074,12 @@ $(document).ready(function () {
const fileExtension = old_bg.split('.').pop(); const fileExtension = old_bg.split('.').pop();
const old_bg_extensionless = old_bg.replace(`.${fileExtension}`, ''); const old_bg_extensionless = old_bg.replace(`.${fileExtension}`, '');
const new_bg_extensionless = await callPopup('<h3>Enter new background name:</h3>', 'input', old_bg_extensionless); const new_bg_extensionless = await callPopup('<h3>Enter new background name:</h3>', 'input', old_bg_extensionless);
if (!new_bg_extensionless) {
console.debug('no new_bg_extensionless');
return;
}
const new_bg = `${new_bg_extensionless}.${fileExtension}`; const new_bg = `${new_bg_extensionless}.${fileExtension}`;
if (old_bg_extensionless === new_bg_extensionless) { if (old_bg_extensionless === new_bg_extensionless) {

View File

@ -1661,6 +1661,11 @@ body.big-avatars .ch_description {
margin: 0; margin: 0;
filter: drop-shadow(0px 0px 3px white); filter: drop-shadow(0px 0px 3px white);
transition: opacity 0.2s ease-in-out; transition: opacity 0.2s ease-in-out;
display: none;
}
.bg_example:hover .bg_button {
display: block;
} }
.bg_button:hover { .bg_button:hover {
@ -4854,7 +4859,9 @@ body.waifuMode .zoomed_avatar {
@media screen and (max-width: 1000px) { @media screen and (max-width: 1000px) {
.bg_button {
font-size: 15px;
}
#extensions_settings, #extensions_settings,
#extensions_settings2 { #extensions_settings2 {