Got better looking timestamps

This commit is contained in:
jsrobson10 2019-04-17 17:39:03 +10:00
parent 39d8540498
commit 0d44e0aca2
2 changed files with 24 additions and 2 deletions

View File

@ -25,6 +25,22 @@ function is_url(text) {
return /^(ftp|http|https):\/\/[^ "]+$/.test(text);
}
function fixInt(num, size)
{
// Convert the number to a string
num = num.toString()
// Loop over the number until its big enough
while(num.length < size)
{
// Add a zero to the start
num = "0" + num;
}
// Return the number
return num;
}
function text_to_html(text)
{
// Make the text XSS safe
@ -85,7 +101,7 @@ function text_to_html(text)
}
// Is the text a dash (underline)
if(text[r][i] == "-" && !code_check)
else if(text[r][i] == "-" && !code_check)
{
// Invert the varible
underline_check = !underline_check;

View File

@ -182,7 +182,13 @@ function chat_switch_to(id)
// Get the date
var date = new Date(connections[active_profile].chats[id].messages[i].date);
date = date.toString();
date = (
(date.getMonth()+1)+"/"+
date.getDate()+"/"+
date.getFullYear()+" - "+
date.getHours()+":"+
fixInt(date.getMinutes(), 2)
);
// Should the chat header be included
if(