mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 08:14:10 +00:00
Update timeago helper, add long form option
This commit is contained in:
parent
7886fd5998
commit
dbc3c0fbe3
1 changed files with 9 additions and 8 deletions
17
resources/assets/js/app.js
vendored
17
resources/assets/js/app.js
vendored
|
@ -103,31 +103,31 @@ window.App.util = {
|
|||
}
|
||||
return Math.floor(seconds) + "s";
|
||||
}),
|
||||
timeAhead: (function(ts) {
|
||||
timeAhead: (function(ts, short = true) {
|
||||
let date = Date.parse(ts);
|
||||
let diff = date - Date.parse(new Date());
|
||||
let seconds = Math.floor((diff) / 1000);
|
||||
let interval = Math.floor(seconds / 63072000);
|
||||
if (interval >= 1) {
|
||||
return interval + "y";
|
||||
return interval + (short ? "y" : " years");
|
||||
}
|
||||
interval = Math.floor(seconds / 604800);
|
||||
if (interval >= 1) {
|
||||
return interval + "w";
|
||||
return interval + (short ? "w" : " weeks");
|
||||
}
|
||||
interval = Math.floor(seconds / 86400);
|
||||
if (interval >= 1) {
|
||||
return interval + "d";
|
||||
return interval + (short ? "d" : " days");
|
||||
}
|
||||
interval = Math.floor(seconds / 3600);
|
||||
if (interval >= 1) {
|
||||
return interval + "h";
|
||||
return interval + (short ? "h" : " hours");
|
||||
}
|
||||
interval = Math.floor(seconds / 60);
|
||||
if (interval >= 1) {
|
||||
return interval + "m";
|
||||
return interval + (short ? "m" : " minutes");
|
||||
}
|
||||
return Math.floor(seconds) + "s";
|
||||
return Math.floor(seconds) + (short ? "s" : " seconds");
|
||||
}),
|
||||
rewriteLinks: (function(i) {
|
||||
|
||||
|
@ -234,7 +234,8 @@ window.App.util = {
|
|||
'filter-willow': 'brightness(1.2) contrast(.85) saturate(.05) sepia(.2)',
|
||||
'filter-xpro-ii': 'sepia(.45) contrast(1.25) brightness(1.75) saturate(1.3) hue-rotate(-5deg)'
|
||||
},
|
||||
emoji: ['😂','💯','❤️','🙌','👏','👌','😍','😯','😢','😅','😁','🙂','😎','😀','🤣','😃','😄','😆','😉','😊','😋','😘','😗','😙','😚','🤗','🤩','🤔','🤨','😐','😑','😶','🙄','😏','😣','😥','😮','🤐','😪','😫','😴','😌','😛','😜','😝','🤤','😒','😓','😔','😕','🙃','🤑','😲','🙁','😖','😞','😟','😤','😭','😦','😧','😨','😩','🤯','😬','😰','😱','😳','🤪','😵','😡','😠','🤬','😷','🤒','🤕','🤢','🤮','🤧','😇','🤠','🤡','🤥','🤫','🤭','🧐','🤓','😈','👿','👹','👺','💀','👻','👽','🤖','💩','😺','😸','😹','😻','😼','😽','🙀','😿','😾','🤲','👐','🤝','👍','👎','👊','✊','🤛','🤜','🤞','✌️','🤟','🤘','👈','👉','👆','👇','☝️','✋','🤚','🖐','🖖','👋','🤙','💪','🖕','✍️','🙏','💍','💄','💋','👄','👅','👂','👃','👣','👁','👀','🧠','🗣','👤','👥'
|
||||
emoji: [
|
||||
'😂','💯','❤️','🙌','👏','👌','😍','😯','😢','😅','😁','🙂','😎','😀','🤣','😃','😄','😆','😉','😊','😋','😘','😗','😙','😚','🤗','🤩','🤔','🤨','😐','😑','😶','🙄','😏','😣','😥','😮','🤐','😪','😫','😴','😌','😛','😜','😝','🤤','😒','😓','😔','😕','🙃','🤑','😲','🙁','😖','😞','😟','😤','😭','😦','😧','😨','😩','🤯','😬','😰','😱','😳','🤪','😵','😡','😠','🤬','😷','🤒','🤕','🤢','🤮','🤧','😇','🤠','🤡','🤥','🤫','🤭','🧐','🤓','😈','👿','👹','👺','💀','👻','👽','🤖','💩','😺','😸','😹','😻','😼','😽','🙀','😿','😾','🤲','👐','🤝','👍','👎','👊','✊','🤛','🤜','🤞','✌️','🤟','🤘','👈','👉','👆','👇','☝️','✋','🤚','🖐','🖖','👋','🤙','💪','🖕','✍️','🙏','💍','💄','💋','👄','👅','👂','👃','👣','👁','👀','🧠','🗣','👤','👥'
|
||||
],
|
||||
embed: {
|
||||
post: (function(url, caption = true, likes = false, layout = 'full') {
|
||||
|
|
Loading…
Reference in a new issue