From d042aa4fcb52200f2211acecd8ac03750e92c108 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 20 Feb 2017 11:02:43 +0900 Subject: wip --- src/web/app/common/tags/messaging/index.tag | 16 ++++++++-------- src/web/app/common/tags/messaging/room.tag | 10 +++++----- src/web/app/common/tags/ripple-string.tag | 2 +- src/web/app/common/tags/signin-history.tag | 4 ++-- src/web/app/common/tags/signin.tag | 2 +- src/web/app/common/tags/signup.tag | 10 +++++----- src/web/app/common/tags/time.tag | 24 ++++++++++++------------ 7 files changed, 34 insertions(+), 34 deletions(-) (limited to 'src/web/app/common') diff --git a/src/web/app/common/tags/messaging/index.tag b/src/web/app/common/tags/messaging/index.tag index 74173b738e..ca1adaaa70 100644 --- a/src/web/app/common/tags/messaging/index.tag +++ b/src/web/app/common/tags/messaging/index.tag @@ -314,11 +314,11 @@ query: q max: 5 .then (users) => - users.for-each (user) => + users.forEach (user) => user._click = => this.trigger 'navigate-user' user - this.search-result = [] - this.search-result = users + this.searchResult = [] + this.searchResult = users this.update(); .catch (err) => console.error err @@ -330,16 +330,16 @@ | 9, 40 => // Key[TAB] or Key[↓] e.preventDefault(); e.stopPropagation(); - this.refs.search-result.childNodes[0].focus(); + this.refs.searchResult.childNodes[0].focus(); }; - this.on-search-result-keydown = (i, e) => { + this.on-searchResult-keydown = (i, e) => { key = e.which switch (key) | 10, 13 => // Key[ENTER] e.preventDefault(); e.stopPropagation(); - @search-result[i]._click! + this.searchResult[i]._click(); | 27 => // Key[ESC] e.preventDefault(); e.stopPropagation(); @@ -347,11 +347,11 @@ | 38 => // Key[↑] e.preventDefault(); e.stopPropagation(); - (this.refs.search-result.childNodes[i].previous-element-sibling || this.refs.search-result.childNodes[@search-result.length - 1]).focus(); + (this.refs.searchResult.childNodes[i].previousElementSibling || this.refs.searchResult.childNodes[this.searchResult.length - 1]).focus(); | 9, 40 => // Key[TAB] or Key[↓] e.preventDefault(); e.stopPropagation(); - (this.refs.search-result.childNodes[i].next-element-sibling || this.refs.search-result.childNodes[0]).focus(); + (this.refs.searchResult.childNodes[i].nextElementSibling || this.refs.searchResult.childNodes[0]).focus(); }; diff --git a/src/web/app/common/tags/messaging/room.tag b/src/web/app/common/tags/messaging/room.tag index f04fd4638d..6565d4c418 100644 --- a/src/web/app/common/tags/messaging/room.tag +++ b/src/web/app/common/tags/messaging/room.tag @@ -159,9 +159,9 @@ document.removeEventListener 'visibilitychange' this.on-visibilitychange this.on('update', () => { - @messages.for-each (message) => - date = (new Date message.created_at).get-date! - month = (new Date message.created_at).get-month! + 1 + @messages.forEach (message) => + date = (new Date message.created_at).getDate() + month = (new Date message.created_at).getMonth() + 1 message._date = date message._datetext = month + '月 ' + date + '日' @@ -184,7 +184,7 @@ this.on-read = (ids) => { if not Array.isArray ids then ids = [ids] - ids.for-each (id) => + ids.forEach (id) => if (@messages.some (x) => x.id == id) exist = (@messages.map (x) -> x.id).index-of id @messages[exist].is_read = true @@ -215,7 +215,7 @@ this.on-visibilitychange = () => { if document.hidden then return - @messages.for-each (message) => + @messages.forEach (message) => if message.user_id != this.I.id and not message.is_read @connection.socket.send JSON.stringify do type: 'read' diff --git a/src/web/app/common/tags/ripple-string.tag b/src/web/app/common/tags/ripple-string.tag index f52d75e706..f6cd8c94d8 100644 --- a/src/web/app/common/tags/ripple-string.tag +++ b/src/web/app/common/tags/ripple-string.tag @@ -17,7 +17,7 @@ this.on('mount', () => { text = this.root.innerHTML this.root.innerHTML = '' - (text.split '').for-each (c, i) => + (text.split '').forEach (c, i) => ce = document.createElement 'span' ce.innerHTML = c ce.style.animationDelay = (i / 10) + 's' diff --git a/src/web/app/common/tags/signin-history.tag b/src/web/app/common/tags/signin-history.tag index 97087e3473..6b2ca1e6c9 100644 --- a/src/web/app/common/tags/signin-history.tag +++ b/src/web/app/common/tags/signin-history.tag @@ -63,10 +63,10 @@ .catch (err) => console.error err - @stream.on 'signin' this.on-signin + this.stream.on 'signin' this.on-signin this.on('unmount', () => { - @stream.off 'signin' this.on-signin + this.stream.off 'signin' this.on-signin this.on-signin = (signin) => { @history.unshift signin diff --git a/src/web/app/common/tags/signin.tag b/src/web/app/common/tags/signin.tag index e71795708f..204ed83269 100644 --- a/src/web/app/common/tags/signin.tag +++ b/src/web/app/common/tags/signin.tag @@ -127,7 +127,7 @@ username: this.refs.username.value password: this.refs.password.value .then => - location.reload! + location.reload(); .catch => alert 'something happened' this.signing = false diff --git a/src/web/app/common/tags/signup.tag b/src/web/app/common/tags/signup.tag index f8ac1c19cd..06e044a411 100644 --- a/src/web/app/common/tags/signup.tag +++ b/src/web/app/common/tags/signup.tag @@ -268,15 +268,15 @@ this.onsubmit = (e) => { e.preventDefault(); - username = this.refs.username.value - password = this.refs.password.value + const username = this.refs.username.value; + const password = this.refs.password.value; locker = document.body.appendChild document.createElement 'mk-locker' this.api 'signup' do - username: username - password: password - 'g-recaptcha-response': grecaptcha.get-response! + username: username, + password: password, + 'g-recaptcha-response': grecaptcha.getResponse() .then => this.api 'signin' do username: username diff --git a/src/web/app/common/tags/time.tag b/src/web/app/common/tags/time.tag index 1311133539..1bf0789162 100644 --- a/src/web/app/common/tags/time.tag +++ b/src/web/app/common/tags/time.tag @@ -6,25 +6,25 @@ this.tickid = null this.absolute = - @time.get-full-year! + '年' + - @time.get-month! + 1 + '月' + - @time.get-date! + '日' + + this.time.getFullYear() + '年' + + this.time.getMonth() + 1 + '月' + + this.time.getDate() + '日' + ' ' + - @time.get-hours! + '時' + - @time.get-minutes! + '分' + this.time.getHours() + '時' + + this.time.getMinutes() + '分' this.on('mount', () => { - if @mode == 'relative' or @mode == 'detail' - @tick! - this.tickid = set-interval @tick, 1000ms + if this.mode == 'relative' or this.mode == 'detail' + this.tick! + this.tickid = setInterval this.tick, 1000ms this.on('unmount', () => { - if @mode == 'relative' or @mode == 'detail' - clear-interval @tickid + if this.mode == 'relative' or this.mode == 'detail' + clearInterval this.tickid this.tick = () => { - now = new Date! - ago = (now - @time) / 1000ms + const now = new Date(); + ago = (now - this.time) / 1000ms this.relative = switch | ago >= 31536000s => ~~(ago / 31536000s) + '年前' | ago >= 2592000s => ~~(ago / 2592000s) + 'ヶ月前' -- cgit v1.2.3-freya