2017-11-05 07:38:50 +08:00
|
|
|
"use strict";
|
|
|
|
|
2017-11-09 11:33:08 +08:00
|
|
|
function showMessage(str) {
|
|
|
|
console.log("message: ", str);
|
|
|
|
|
2017-08-22 09:31:23 +08:00
|
|
|
const top = $("#top-message");
|
|
|
|
|
2017-09-24 23:34:16 +08:00
|
|
|
top.fadeIn(1500).css("display","inline-block");
|
2017-08-22 09:31:23 +08:00
|
|
|
top.html(str);
|
|
|
|
top.fadeOut(1500);
|
2017-08-14 09:42:10 +08:00
|
|
|
}
|
|
|
|
|
2017-11-09 11:33:08 +08:00
|
|
|
function showError(str) {
|
|
|
|
console.log("error: ", str);
|
|
|
|
|
2017-08-22 09:31:23 +08:00
|
|
|
const error = $("#error-message");
|
|
|
|
|
2017-09-24 23:34:16 +08:00
|
|
|
error.show().css("display","inline-block");
|
2017-08-22 09:31:23 +08:00
|
|
|
error.html(str);
|
|
|
|
error.fadeOut(10000);
|
2017-09-07 10:06:43 +08:00
|
|
|
}
|
|
|
|
|
2017-10-01 10:36:14 +08:00
|
|
|
function getDateFromTS(timestamp) {
|
|
|
|
// Date accepts number of milliseconds since epoch so UTC timestamp works without any extra handling
|
|
|
|
// see https://stackoverflow.com/questions/4631928/convert-utc-epoch-to-local-date-with-javascript
|
2017-10-25 06:57:00 +08:00
|
|
|
return new Date(timestamp * 1000);
|
2017-10-01 10:36:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function formatTime(date) {
|
|
|
|
return (date.getHours() <= 9 ? "0" : "") + date.getHours() + ":" + (date.getMinutes() <= 9 ? "0" : "") + date.getMinutes();
|
|
|
|
}
|
|
|
|
|
|
|
|
function formatDate(date) {
|
|
|
|
return date.getDate() + ". " + (date.getMonth() + 1) + ". " + date.getFullYear();
|
|
|
|
}
|
|
|
|
|
|
|
|
function formatDateTime(date) {
|
|
|
|
return formatDate(date) + " " + formatTime(date);
|
2017-06-12 04:04:07 +08:00
|
|
|
}
|