mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 13:14:56 -04:00
display mtime_age in webclient
This commit is contained in:
parent
4068339770
commit
207ef144c5
3 changed files with 33 additions and 10 deletions
|
@ -94,6 +94,26 @@ matrixWebClient
|
|||
}
|
||||
};
|
||||
}])
|
||||
.filter('duration', function() {
|
||||
return function(time) {
|
||||
if (!time) return;
|
||||
var t = parseInt(time / 1000);
|
||||
var s = t % 60;
|
||||
var m = parseInt(t / 60) % 60;
|
||||
var h = parseInt(t / (60 * 60)) % 24;
|
||||
var d = parseInt(t / (60 * 60 * 24));
|
||||
if (t < 60) {
|
||||
return s + "s"
|
||||
}
|
||||
if (t < 60 * 60) {
|
||||
return m + "m " + s + "s";
|
||||
}
|
||||
if (t < 24 * 60 * 60) {
|
||||
return h + "h " + m + "m";
|
||||
}
|
||||
return d + "d " + h + "h";
|
||||
}
|
||||
})
|
||||
.filter('to_trusted', ['$sce', function($sce){
|
||||
return function(text) {
|
||||
return $sce.trustAsHtml(text);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue