mirror of
https://github.com/nerzhul/ocsms.git
synced 2025-06-07 16:06:15 +00:00
Added proper date support
This commit is contained in:
parent
2ecaef769a
commit
6b80e30ca0
@ -72,6 +72,12 @@
|
|||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.msg-date {
|
||||||
|
font-style: italic;
|
||||||
|
font-size: 90%;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
.msg-spacer {
|
.msg-spacer {
|
||||||
clear: both;
|
clear: both;
|
||||||
}
|
}
|
||||||
|
13
js/script.js
13
js/script.js
@ -16,6 +16,10 @@ function fetchConversation(phoneNumber) {
|
|||||||
var conversationBuf = "";
|
var conversationBuf = "";
|
||||||
// Improve JS performance
|
// Improve JS performance
|
||||||
var msgClass = '';
|
var msgClass = '';
|
||||||
|
var unixDate = '';
|
||||||
|
var formatedDate = '';
|
||||||
|
var months = ['Jan.', 'Feb.', 'Mar.', 'Apr.', 'May', 'Jun.', 'Jul.', 'Aug.', 'Sep.',
|
||||||
|
'Oct.', 'Nov.', 'Dec.'];
|
||||||
|
|
||||||
$.each(jsondata["conversation"], function(id, vals) {
|
$.each(jsondata["conversation"], function(id, vals) {
|
||||||
if (vals["type"] == 1) {
|
if (vals["type"] == 1) {
|
||||||
@ -28,7 +32,14 @@ function fetchConversation(phoneNumber) {
|
|||||||
msgClass = '';
|
msgClass = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
conversationBuf += '<div><div class="' + msgClass + '">' + vals["msg"] + '</div><div class="msg-spacer"></div></div>';
|
// Multiplicate ID to permit date to use it properly
|
||||||
|
msgDate = new Date(id*1);
|
||||||
|
formatedDate = msgDate.getDate() + " " + months[msgDate.getMonth()-1] + " " +
|
||||||
|
msgDate.getHours() + ":" + msgDate.getMinutes();
|
||||||
|
|
||||||
|
conversationBuf += '<div><div class="' + msgClass + '"><div>' +
|
||||||
|
vals["msg"] + '</div><div class="msg-date">' +
|
||||||
|
formatedDate + '</div></div><div class="msg-spacer"></div></div>';
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#app-content').html(conversationBuf);
|
$('#app-content').html(conversationBuf);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user