diff --git a/static/index.html b/static/index.html index 9e2d1bb..b23be10 100644 --- a/static/index.html +++ b/static/index.html @@ -153,6 +153,7 @@ width: 22px; vertical-align: text-bottom; } + #statuses-list .invisible { font-size: 0; line-height: 0; @@ -215,6 +216,8 @@ var loading_statues; var base_api_url = "https://thu.closed.social/"; + jQuery.timeago.settings.allowFuture = true; + function get_token() { (document.cookie || "").split("; ").forEach( (c) => { let cc = c.split("="); @@ -245,6 +248,43 @@ }); } + function render_poll(poll) { + if (!poll) + return ''; + let show_result = poll.expired || poll.voted; + return ` +
+ ${poll.options.map((option, idx) => ` + + ${option.title} + ${show_result ? ` - ${option.votes_count} / ${poll.votes_count}` : ''} + ${poll.own_votes.includes(idx) ? ' ✔️ ' : ''} + +
+
+
+ `).join('\n')} + ${poll.votes_count}人参与,${poll.expired ? '已结束' : `将结束于 +
+ `; + } + + function render_media(media_attachments) { + return media_attachments.map((media) => { + switch (media.type) { + case 'image': + return ``; + case 'video': + return ``; + case 'gifv': + return ``; + default: + return ''; + } + }).join('\n'); + } function render_content(text, is_mask_bot, emojis) { if (is_mask_bot) { @@ -270,18 +310,8 @@
${render_content(status.content, status.account.acct === "mask_bot", status.emojis)}
- ${status.media_attachments.map((media) => { - switch (media.type) { - case 'image': - return ``; - case 'video': - return ``; - case 'gifv': - return ``; - default: - return ''; - } - }).join('\n')} + ${render_poll(status.poll)} + ${render_media(status.media_attachments)}