dedup if condition

master
Aevann 2023-08-12 21:55:55 +03:00
parent aee38394f8
commit e6f0898b54
2 changed files with 4 additions and 2 deletions

View File

@ -1,5 +1,7 @@
const SITE_FULL_IMAGES = document.getElementById('SITE_FULL_IMAGES').value const SITE_FULL_IMAGES = document.getElementById('SITE_FULL_IMAGES').value
const is_chat = (location.pathname == '/chat' || location.pathname == '/old_chat')
function getMessageFromJsonData(success, json) { function getMessageFromJsonData(success, json) {
let message = success ? "Success!" : "Error, please try again later"; let message = success ? "Success!" : "Error, please try again later";
let key = success ? "message" : "error"; let key = success ? "message" : "error";
@ -506,7 +508,7 @@ function handle_files(input, newfiles) {
return return
} }
if (location.pathname != '/chat' && location.pathname != '/old_chat') { if (!is_chat) {
for (const file of newfiles) { for (const file of newfiles) {
insertText(ta, `[${file.name}]`); insertText(ta, `[${file.name}]`);
} }

View File

@ -420,7 +420,7 @@ function populate_speed_emoji_modal(results, textbox)
close_inline_speed_emoji_modal() close_inline_speed_emoji_modal()
textbox.value = textbox.value.replace(new RegExp(current_word+"(?=\\s|$)", "gi"), `:${name}: `) textbox.value = textbox.value.replace(new RegExp(current_word+"(?=\\s|$)", "gi"), `:${name}: `)
textbox.focus() textbox.focus()
if (document.location.pathname != '/chat' && document.location.pathname != '/old_chat'){ if (!is_chat){
markdown(textbox) markdown(textbox)
} }
}); });