[Web] Implement XMPP

[Web] Various small fixes and enhancements
This commit is contained in:
andryyy
2021-02-11 09:34:21 +01:00
parent e51479700b
commit 06c89bac7d
24 changed files with 1093 additions and 677 deletions

View File

@@ -1,3 +1,38 @@
$(document).ready(function() {
// Parse seconds ago to date
// Get "now" timestamp
var ts_now = Math.round((new Date()).getTime() / 1000);
$('.parse_s_ago').each(function(i, parse_s_ago) {
var started_s_ago = parseInt($(this).text(), 10);
if (typeof started_s_ago != 'NaN') {
var started_date = new Date((ts_now - started_s_ago) * 1000);
var started_local_date = started_date.toLocaleDateString(undefined, {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit"
});
$(this).text(started_local_date);
}
});
// Parse general dates
$('.parse_date').each(function(i, parse_date) {
var started_date = new Date(Date.parse($(this).text()));
if (typeof started_date != 'NaN') {
var started_local_date = started_date.toLocaleDateString(undefined, {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit"
});
$(this).text(started_local_date);
}
});
});
jQuery(function($){
if (localStorage.getItem("current_page") === null) {
var current_page = {};
@@ -631,7 +666,11 @@ jQuery(function($){
$.each(data, function (i, item) {
if (item === null) { return true; }
if (item.message.match("^base64,")) {
item.message = atob(item.message.slice(7)).replace(/\\n/g, "<br />");
try {
item.message = atob(item.message.slice(7)).replace(/\\n/g, "<br />");
} catch(e) {
item.message = item.message.slice(7);
}
} else {
item.message = escapeHtml(item.message);
}

View File

@@ -256,6 +256,7 @@ jQuery(function($){
{"name":"rl","title":"RL","breakpoints":"xs sm md lg","style":{"maxWidth":"100px","width":"100px"}},
{"name":"backupmx","filterable": false,"style":{"maxWidth":"120px","width":"120px"},"title":lang.backup_mx,"breakpoints":"xs sm md lg","formatter": function(value){return 1==value?'&#10003;':0==value&&'&#10005;';}},
{"name":"domain_admins","title":lang.domain_admins,"style":{"word-break":"break-all","min-width":"200px"},"breakpoints":"xs sm md lg","filterable":(role == "admin"),"visible":(role == "admin")},
{"name":"xmpp","filterable": false,"style":{"maxWidth":"80px","width":"80px"},"title":"XMPP","formatter": function(value){return 1==value?'&#10003;':0==value&&'&#10005;';}},
{"name":"active","filterable": false,"style":{"maxWidth":"80px","width":"80px"},"title":lang.active,"formatter": function(value){return 1==value?'&#10003;':0==value&&'&#10005;';}},
{"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"240px","width":"240px"},"type":"html","title":lang.action,"breakpoints":"xs sm md"}
],