diff --git a/package-lock.json b/package-lock.json index 3dac0d1..6078c1f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6576,6 +6576,12 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "xdate": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/xdate/-/xdate-0.8.2.tgz", + "integrity": "sha1-17AzwASF0CaVuvAET06s2j/JYaM=", + "dev": true + }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", diff --git a/package.json b/package.json index 3a67e63..b817b0f 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,8 @@ "style-loader": "^0.19.0", "ts-loader": "^3.2.0", "typescript": "^2.6.2", - "webpack": "^3.10.0" + "webpack": "^3.10.0", + "xdate": "^0.8.2" }, "dependencies": { "koa": "^2.4.1", diff --git a/src/client/index.ts b/src/client/index.ts index 5e6a1a0..a142256 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -6,7 +6,8 @@ import "jquery" (window).Popper = require("popper.js") import "bootstrap/dist/js/bootstrap.min.js" import "./ctrl-enter.ts" +(window).XDate = require("xdate") addEventListener("load", () => { riot.mount("app") -}) \ No newline at end of file +}) diff --git a/src/client/tags/pages/user-top.tag b/src/client/tags/pages/user-top.tag index 0f49f56..a83a8c1 100644 --- a/src/client/tags/pages/user-top.tag +++ b/src/client/tags/pages/user-top.tag @@ -5,7 +5,7 @@ page-user-top .jumbotron(style="text-align: center") img(src="{user.avatarUrl}",style="width:8em;height:8em;") h1 {user.name} - p さんの{user.questionBoxName || "質問箱"} + p さんの{user.questionBoxName || "質問箱"} a(href='{user.avatar || "https://"+user.acct.split("@")[1]+"/@"+user.acct.split("@")[0]}',rel="nofollow") Mastodonのプロフィール p {user.description} form(action="javascript://",onsubmit="{submit}") @@ -13,12 +13,12 @@ page-user-top .d-flex.justify-content-end(style="line-height: 2.5em;") span(ref="character_counter",style="padding-right: 1em;") {charcounter} button.btn.btn-primary.col-xs-2(type="submit",disabled="{charcounter < 0}") 質問する - h2 回答 + h2 回答 span.badge.badge-pill.badge-secondary(if="{questions.length}",style="font-size: 50%") {questions.length} .card.mb-2(each="{question in questions}",if="{question_loaded}") .card-body h4.card-title {question.question} - h6.card-subtitle.mb-2: a(href="/@{user.acct}/questions/{question._id}").text-muted {question.answeredAt} + h6.card-subtitle.mb-2: a(href="/@{user.acct}/questions/{question._id}").text-muted {new XDate(question.answeredAt).toString("yyyy-MM-dd HH:mm:ss")} p.card-text.question-text {question.answer} loading(if="{!question_loaded}") script. @@ -49,4 +49,4 @@ page-user-top alert("質問しました!") location.reload() }) - } \ No newline at end of file + }