Spaces:
Sleeping
Sleeping
Delete scripts.js
Browse files- scripts.js +0 -39
scripts.js
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
var messages = $(".messages-content");
|
2 |
-
|
3 |
-
function insertMessage() {
|
4 |
-
var msgText = $(".action-box-input").val();
|
5 |
-
if ($.trim(msgText) == "") {
|
6 |
-
return false;
|
7 |
-
}
|
8 |
-
var msg = $("<div>").addClass("message personal").text(msgText);
|
9 |
-
$("<div>").addClass("timestamp").text(getTimestamp()).appendTo(msg);
|
10 |
-
msg.appendTo($('.messages-content'));
|
11 |
-
$(".action-box-input").val(null);
|
12 |
-
|
13 |
-
$.post("/get_abbreviation", { acronym: msgText }, function (data) {
|
14 |
-
var responseMsg = $("<div>").addClass("message").text(data.response);
|
15 |
-
$("<div>").addClass("timestamp").text(getTimestamp()).appendTo(responseMsg);
|
16 |
-
responseMsg.appendTo($('.messages-content'));
|
17 |
-
updateScrollbar();
|
18 |
-
});
|
19 |
-
}
|
20 |
-
|
21 |
-
function updateScrollbar() {
|
22 |
-
messages.scrollTop(messages[0].scrollHeight);
|
23 |
-
}
|
24 |
-
|
25 |
-
function getTimestamp() {
|
26 |
-
var d = new Date();
|
27 |
-
return d.getHours() + ":" + (d.getMinutes() < 10 ? '0' : '') + d.getMinutes();
|
28 |
-
}
|
29 |
-
|
30 |
-
$(window).on('keydown', function (e) {
|
31 |
-
if (e.which == 13) {
|
32 |
-
insertMessage();
|
33 |
-
return false;
|
34 |
-
}
|
35 |
-
});
|
36 |
-
|
37 |
-
$(window).on('load', function () {
|
38 |
-
messages.mCustomScrollbar();
|
39 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|