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) + 'ヶ月前' diff --git a/src/web/app/desktop/tags/analog-clock.tag b/src/web/app/desktop/tags/analog-clock.tag index c1390be649..ec627ec65f 100644 --- a/src/web/app/desktop/tags/analog-clock.tag +++ b/src/web/app/desktop/tags/analog-clock.tag @@ -11,16 +11,16 @@ diff --git a/src/web/app/desktop/tags/home-widgets/mentions.tag b/src/web/app/desktop/tags/home-widgets/mentions.tag index 492eacb177..706242547a 100644 --- a/src/web/app/desktop/tags/home-widgets/mentions.tag +++ b/src/web/app/desktop/tags/home-widgets/mentions.tag @@ -73,7 +73,7 @@ this.fetch = (cb) => { this.api 'posts/mentions' do - following: @mode == 'following' + following: this.mode == 'following' .then (posts) => this.is-loading = false this.is-empty = posts.length == 0 @@ -90,7 +90,7 @@ this.more-loading = true this.update(); this.api 'posts/mentions' do - following: @mode == 'following' + following: this.mode == 'following' max_id: this.refs.timeline.tail!.id .then (posts) => this.more-loading = false diff --git a/src/web/app/desktop/tags/home-widgets/photo-stream.tag b/src/web/app/desktop/tags/home-widgets/photo-stream.tag index f7a80f40a9..c606fac640 100644 --- a/src/web/app/desktop/tags/home-widgets/photo-stream.tag +++ b/src/web/app/desktop/tags/home-widgets/photo-stream.tag @@ -64,7 +64,7 @@ this.initializing = true this.on('mount', () => { - @stream.on 'drive_file_created' this.on-stream-drive-file-created + this.stream.on 'drive_file_created' this.on-stream-drive-file-created this.api 'drive/stream' do type: 'image/*' @@ -75,7 +75,7 @@ this.update(); this.on('unmount', () => { - @stream.off 'drive_file_created' this.on-stream-drive-file-created + this.stream.off 'drive_file_created' this.on-stream-drive-file-created this.on-stream-drive-file-created = (file) => { if /^image\/.+$/.test file.type diff --git a/src/web/app/desktop/tags/home-widgets/rss-reader.tag b/src/web/app/desktop/tags/home-widgets/rss-reader.tag index 2ced342a43..d44f76b169 100644 --- a/src/web/app/desktop/tags/home-widgets/rss-reader.tag +++ b/src/web/app/desktop/tags/home-widgets/rss-reader.tag @@ -73,10 +73,10 @@ this.on('mount', () => { @fetch! - this.clock = set-interval @fetch, 60000ms + this.clock = setInterval @fetch, 60000ms this.on('unmount', () => { - clear-interval @clock + clearInterval @clock this.fetch = () => { this.api CONFIG.url + '/api:rss' do diff --git a/src/web/app/desktop/tags/home-widgets/timeline.tag b/src/web/app/desktop/tags/home-widgets/timeline.tag index dbeac5eaf8..b040689564 100644 --- a/src/web/app/desktop/tags/home-widgets/timeline.tag +++ b/src/web/app/desktop/tags/home-widgets/timeline.tag @@ -42,9 +42,9 @@ this.no-following = this.I.following_count == 0 this.on('mount', () => { - @stream.on 'post' this.on-stream-post - @stream.on 'follow' this.on-stream-follow - @stream.on 'unfollow' this.on-stream-unfollow + this.stream.on 'post' this.on-stream-post + this.stream.on 'follow' this.on-stream-follow + this.stream.on 'unfollow' this.on-stream-unfollow document.addEventListener 'keydown' this.on-document-keydown window.addEventListener 'scroll' this.on-scroll @@ -53,9 +53,9 @@ this.trigger('loaded'); this.on('unmount', () => { - @stream.off 'post' this.on-stream-post - @stream.off 'follow' this.on-stream-follow - @stream.off 'unfollow' this.on-stream-unfollow + this.stream.off 'post' this.on-stream-post + this.stream.off 'follow' this.on-stream-follow + this.stream.off 'unfollow' this.on-stream-unfollow document.removeEventListener 'keydown' this.on-document-keydown window.removeEventListener 'scroll' this.on-scroll diff --git a/src/web/app/desktop/tags/home-widgets/tips.tag b/src/web/app/desktop/tags/home-widgets/tips.tag index 08e1b1737e..6718c70630 100644 --- a/src/web/app/desktop/tags/home-widgets/tips.tag +++ b/src/web/app/desktop/tags/home-widgets/tips.tag @@ -43,10 +43,10 @@ this.on('mount', () => { @set! - this.clock = set-interval @change, 20000ms + this.clock = setInterval @change, 20000ms this.on('unmount', () => { - clear-interval @clock + clearInterval @clock this.set = () => { this.refs.text.innerHTML = @tips[Math.floor Math.random! * @tips.length] diff --git a/src/web/app/desktop/tags/home-widgets/user-recommendation.tag b/src/web/app/desktop/tags/home-widgets/user-recommendation.tag index f2a8a7476d..19b6310ea0 100644 --- a/src/web/app/desktop/tags/home-widgets/user-recommendation.tag +++ b/src/web/app/desktop/tags/home-widgets/user-recommendation.tag @@ -120,13 +120,13 @@ this.on('mount', () => { @fetch! - this.clock = set-interval => + this.clock = setInterval => if @users.length < @limit @fetch true , 60000ms this.on('unmount', () => { - clear-interval @clock + clearInterval @clock this.fetch = (quiet = false) => { this.loading = true @@ -134,7 +134,7 @@ if not quiet then this.update(); this.api 'users/recommendation' do limit: @limit - offset: @limit * @page + offset: @limit * this.page .then (users) => this.loading = false this.users = users @@ -146,7 +146,7 @@ if @users.length < @limit this.page = 0 else - @page++ + this.page++ @fetch! diff --git a/src/web/app/desktop/tags/home.tag b/src/web/app/desktop/tags/home.tag index 729022073e..3d0d9d415a 100644 --- a/src/web/app/desktop/tags/home.tag +++ b/src/web/app/desktop/tags/home.tag @@ -62,7 +62,7 @@ this.mode = this.opts.mode || 'timeline' // https://github.com/riot/riot/issues/2080 - if @mode == '' then this.mode = 'timeline' + if this.mode == '' then this.mode = 'timeline' this.home = [] @@ -70,7 +70,7 @@ this.refs.tl.on('loaded', () => { this.trigger('loaded'); - this.I.data.home.for-each (widget) => + this.I.data.home.forEach (widget) => try el = document.createElement 'mk-' + widget.name + '-home-widget' switch widget.place @@ -84,7 +84,7 @@ // noop this.on('unmount', () => { - @home.for-each (widget) => + @home.forEach (widget) => widget.unmount! diff --git a/src/web/app/desktop/tags/notifications.tag b/src/web/app/desktop/tags/notifications.tag index 39a33e4102..39d86c5e20 100644 --- a/src/web/app/desktop/tags/notifications.tag +++ b/src/web/app/desktop/tags/notifications.tag @@ -194,19 +194,19 @@ .catch (err, text-status) -> console.error err - @stream.on 'notification' this.on-notification + this.stream.on 'notification' this.on-notification this.on('unmount', () => { - @stream.off 'notification' this.on-notification + this.stream.off 'notification' this.on-notification this.on-notification = (notification) => { @notifications.unshift notification this.update(); this.on('update', () => { - @notifications.for-each (notification) => - date = (new Date notification.created_at).get-date! - month = (new Date notification.created_at).get-month! + 1 + @notifications.forEach (notification) => + date = (new Date notification.created_at).getDate() + month = (new Date notification.created_at).getMonth() + 1 notification._date = date notification._datetext = month + '月 ' + date + '日' diff --git a/src/web/app/desktop/tags/pages/home.tag b/src/web/app/desktop/tags/pages/home.tag index 3dd0b69d83..4ed74a373d 100644 --- a/src/web/app/desktop/tags/pages/home.tag +++ b/src/web/app/desktop/tags/pages/home.tag @@ -27,11 +27,11 @@ document.title = 'Misskey' this.Progress.start(); - @stream.on 'post' this.on-stream-post + this.stream.on 'post' this.on-stream-post document.addEventListener 'visibilitychange' @window-on-visibilitychange, false this.on('unmount', () => { - @stream.off 'post' this.on-stream-post + this.stream.off 'post' this.on-stream-post document.removeEventListener 'visibilitychange' @window-on-visibilitychange this.on-stream-post = (post) => { diff --git a/src/web/app/desktop/tags/post-detail-sub.tag b/src/web/app/desktop/tags/post-detail-sub.tag index 1a6dbe0699..b61898f675 100644 --- a/src/web/app/desktop/tags/post-detail-sub.tag +++ b/src/web/app/desktop/tags/post-detail-sub.tag @@ -110,31 +110,31 @@ this.post = this.opts.post - this.url = CONFIG.url + '/' + @post.user.username + '/' + @post.id + this.url = CONFIG.url + '/' + this.post.user.username + '/' + this.post.id - this.title = @date-stringify @post.created_at + this.title = @date-stringify this.post.created_at this.on('mount', () => { - if @post.text? - tokens = @analyze @post.text + if this.post.text? + tokens = @analyze this.post.text this.refs.text.innerHTML = @compile tokens - this.refs.text.children.for-each (e) => + this.refs.text.children.forEach (e) => if e.tag-name == 'MK-URL' riot.mount e this.like = () => { - if @post.is_liked + if this.post.is_liked this.api 'posts/likes/delete' do - post_id: @post.id + post_id: this.post.id .then => - @post.is_liked = false + this.post.is_liked = false this.update(); else this.api 'posts/likes/create' do - post_id: @post.id + post_id: this.post.id .then => - @post.is_liked = true + this.post.is_liked = true this.update(); diff --git a/src/web/app/desktop/tags/post-detail.tag b/src/web/app/desktop/tags/post-detail.tag index c835521ad5..958b0c681b 100644 --- a/src/web/app/desktop/tags/post-detail.tag +++ b/src/web/app/desktop/tags/post-detail.tag @@ -349,18 +349,18 @@ this.post = post this.trigger('loaded'); - this.is-repost = @post.repost? - this.p = if @is-repost then @post.repost else @post + this.is-repost = this.post.repost? + this.p = if @is-repost then this.post.repost else this.post - this.title = @date-stringify @p.created_at + this.title = @date-stringify this.p.created_at this.update(); - if @p.text? - tokens = @analyze @p.text + if this.p.text? + tokens = @analyze this.p.text this.refs.text.innerHTML = @compile tokens - this.refs.text.children.for-each (e) => + this.refs.text.children.forEach (e) => if e.tag-name == 'MK-URL' riot.mount e @@ -369,12 +369,12 @@ .filter (t) -> t.type == 'link' .map (t) => this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview' - riot.mount @preview, do + riot.mount this.preview, do url: t.content // Get likes this.api 'posts/likes' do - post_id: @p.id + post_id: this.p.id limit: 8 .then (likes) => this.likes = likes @@ -382,7 +382,7 @@ // Get reposts this.api 'posts/reposts' do - post_id: @p.id + post_id: this.p.id limit: 8 .then (reposts) => this.reposts = reposts @@ -390,7 +390,7 @@ // Get replies this.api 'posts/replies' do - post_id: @p.id + post_id: this.p.id limit: 8 .then (replies) => this.replies = replies @@ -401,25 +401,25 @@ this.reply = () => { form = document.body.appendChild document.createElement 'mk-post-form-window' riot.mount form, do - reply: @p + reply: this.p this.repost = () => { form = document.body.appendChild document.createElement 'mk-repost-form-window' riot.mount form, do - post: @p + post: this.p this.like = () => { - if @p.is_liked + if this.p.is_liked this.api 'posts/likes/delete' do - post_id: @p.id + post_id: this.p.id .then => - @p.is_liked = false + this.p.is_liked = false this.update(); else this.api 'posts/likes/create' do - post_id: @p.id + post_id: this.p.id .then => - @p.is_liked = true + this.p.is_liked = true this.update(); this.load-context = () => { @@ -427,7 +427,7 @@ // Get context this.api 'posts/context' do - post_id: @p.reply_to_id + post_id: this.p.reply_to_id .then (context) => this.context = context.reverse! this.loading-context = false diff --git a/src/web/app/desktop/tags/post-form.tag b/src/web/app/desktop/tags/post-form.tag index d49feba144..ed56e2a117 100644 --- a/src/web/app/desktop/tags/post-form.tag +++ b/src/web/app/desktop/tags/post-form.tag @@ -348,7 +348,7 @@ e.stopPropagation(); this.draghover = true // ドラッグされてきたものがファイルだったら - if e.dataTransfer.effect-allowed == 'all' + if e.dataTransfer.effectAllowed == 'all' e.dataTransfer.dropEffect = 'copy' else e.dataTransfer.dropEffect = 'move' @@ -367,7 +367,7 @@ // ファイルだったら if e.dataTransfer.files.length > 0 - Array.prototype.for-each.call e.dataTransfer.files, (file) => + Array.prototype.forEach.call e.dataTransfer.files, (file) => @upload file return false @@ -390,7 +390,7 @@ this.onkeydown = (e) => { if (e.which == 10 || e.which == 13) && (e.ctrlKey || e.meta-key) - @post! + this.post! this.onpaste = (e) => { data = e.clipboardData @@ -402,14 +402,14 @@ @upload item.getAsFile(); this.select-file = () => { - this.refs.file.click! + this.refs.file.click(); this.select-file-from-drive = () => { browser = document.body.appendChild document.createElement 'mk-select-file-from-drive-window' i = riot.mount browser, do multiple: true i[0].one 'selected' (files) => - files.for-each @add-file + files.forEach @add-file this.change-file = () => { files = this.refs.file.files @@ -448,7 +448,7 @@ text: this.refs.text.value media_ids: files reply_to_id: if @in-reply-to-post? then @in-reply-to-post.id else undefined - poll: if @poll then this.refs.poll.get! else undefined + poll: if this.poll then this.refs.poll.get! else undefined .then (data) => this.trigger('post'); @notify if @in-reply-to-post? then '返信しました!' else '投稿しました!' diff --git a/src/web/app/desktop/tags/post-preview.tag b/src/web/app/desktop/tags/post-preview.tag index 5ee0a6065d..06008da3cf 100644 --- a/src/web/app/desktop/tags/post-preview.tag +++ b/src/web/app/desktop/tags/post-preview.tag @@ -88,6 +88,6 @@ this.post = this.opts.post - this.title = @date-stringify @post.created_at + this.title = @date-stringify this.post.created_at diff --git a/src/web/app/desktop/tags/post-status-graph.tag b/src/web/app/desktop/tags/post-status-graph.tag index 039c676b10..f4a890a0c9 100644 --- a/src/web/app/desktop/tags/post-status-graph.tag +++ b/src/web/app/desktop/tags/post-status-graph.tag @@ -16,24 +16,24 @@ this.post-promise = if @is-promise this.opts.post then this.opts.post else Promise.resolve this.opts.post this.on('mount', () => { - post <~ @post-promise.then + post <~ this.post-promise.then this.post = post this.update(); this.api 'aggregation/posts/like' do - post_id: @post.id + post_id: this.post.id limit: 30days .then (likes) => likes = likes.reverse! this.api 'aggregation/posts/repost' do - post_id: @post.id + post_id: this.post.id limit: 30days .then (repost) => repost = repost.reverse! this.api 'aggregation/posts/reply' do - post_id: @post.id + post_id: this.post.id limit: 30days .then (replies) => replies = replies.reverse! diff --git a/src/web/app/desktop/tags/search-posts.tag b/src/web/app/desktop/tags/search-posts.tag index a450e8a02c..c56caa05e2 100644 --- a/src/web/app/desktop/tags/search-posts.tag +++ b/src/web/app/desktop/tags/search-posts.tag @@ -63,16 +63,16 @@ this.refs.timeline.focus(); this.more = () => { - if @more-loading or @is-loading or @timeline.posts.length == 0 + if @more-loading or @is-loading or this.timeline.posts.length == 0 return this.more-loading = true this.update(); this.api 'posts/search' do query: @query - page: @page + 1 + page: this.page + 1 .then (posts) => this.more-loading = false - @page++ + this.page++ this.update(); this.refs.timeline.prepend-posts posts .catch (err) => diff --git a/src/web/app/desktop/tags/stream-indicator.tag b/src/web/app/desktop/tags/stream-indicator.tag index caa727dd8c..c3669c0744 100644 --- a/src/web/app/desktop/tags/stream-indicator.tag +++ b/src/web/app/desktop/tags/stream-indicator.tag @@ -35,7 +35,7 @@ if @state == 'connected' this.root.style.opacity = 0 - @stream-state-ev.on('connected', () => { + this.stream-state-ev.on('connected', () => { this.state = @get-stream-state! this.update(); setTimeout => @@ -44,7 +44,7 @@ } 200ms 'linear' , 1000ms - @stream-state-ev.on('closed', () => { + this.stream-state-ev.on('closed', () => { this.state = @get-stream-state! this.update(); Velocity this.root, { diff --git a/src/web/app/desktop/tags/sub-post-content.tag b/src/web/app/desktop/tags/sub-post-content.tag index 0fdd049ec2..8d4a06b49d 100644 --- a/src/web/app/desktop/tags/sub-post-content.tag +++ b/src/web/app/desktop/tags/sub-post-content.tag @@ -34,11 +34,11 @@ this.post = this.opts.post this.on('mount', () => { - if @post.text? - tokens = @analyze @post.text + if this.post.text? + tokens = @analyze this.post.text this.refs.text.innerHTML = @compile tokens, false - this.refs.text.children.for-each (e) => + this.refs.text.children.forEach (e) => if e.tag-name == 'MK-URL' riot.mount e diff --git a/src/web/app/desktop/tags/timeline-post-sub.tag b/src/web/app/desktop/tags/timeline-post-sub.tag index bdeffea181..2c76527f1a 100644 --- a/src/web/app/desktop/tags/timeline-post-sub.tag +++ b/src/web/app/desktop/tags/timeline-post-sub.tag @@ -14,7 +14,7 @@ this.post = this.opts.post - this.title = @date-stringify @post.created_at + this.title = @date-stringify this.post.created_at diff --git a/src/web/app/desktop/tags/ui-header-nav.tag b/src/web/app/desktop/tags/ui-header-nav.tag index 88607d6a5b..a884aa0b28 100644 --- a/src/web/app/desktop/tags/ui-header-nav.tag +++ b/src/web/app/desktop/tags/ui-header-nav.tag @@ -84,8 +84,8 @@ this.page = this.opts.page this.on('mount', () => { - @stream.on 'read_all_messaging_messages' this.on-read-all-messaging-messages - @stream.on 'unread_messaging_message' this.on-unread-messaging-message + this.stream.on 'read_all_messaging_messages' this.on-read-all-messaging-messages + this.stream.on 'unread_messaging_message' this.on-unread-messaging-message // Fetch count of unread messaging messages this.api 'messaging/unread' @@ -95,8 +95,8 @@ this.update(); this.on('unmount', () => { - @stream.off 'read_all_messaging_messages' this.on-read-all-messaging-messages - @stream.off 'unread_messaging_message' this.on-unread-messaging-message + this.stream.off 'read_all_messaging_messages' this.on-read-all-messaging-messages + this.stream.off 'unread_messaging_message' this.on-unread-messaging-message this.on-read-all-messaging-messages = () => { this.has-unread-messaging-messages = false diff --git a/src/web/app/desktop/tags/ui-header-notifications.tag b/src/web/app/desktop/tags/ui-header-notifications.tag index 0a355e022a..fac90bb83c 100644 --- a/src/web/app/desktop/tags/ui-header-notifications.tag +++ b/src/web/app/desktop/tags/ui-header-notifications.tag @@ -87,14 +87,14 @@ this.is-open = true this.update(); all = document.query-selector-all 'body *' - Array.prototype.for-each.call all, (el) => + Array.prototype.forEach.call all, (el) => el.addEventListener 'mousedown' @mousedown this.close = () => { this.is-open = false this.update(); all = document.query-selector-all 'body *' - Array.prototype.for-each.call all, (el) => + Array.prototype.forEach.call all, (el) => el.removeEventListener 'mousedown' @mousedown this.mousedown = (e) => { diff --git a/src/web/app/desktop/tags/ui-header-search.tag b/src/web/app/desktop/tags/ui-header-search.tag index cc8ca2ae02..f7e2842c79 100644 --- a/src/web/app/desktop/tags/ui-header-search.tag +++ b/src/web/app/desktop/tags/ui-header-search.tag @@ -36,6 +36,6 @@ this.onsubmit = (e) => { e.preventDefault(); - @page '/search:' + this.refs.q.value + this.page '/search:' + this.refs.q.value diff --git a/src/web/app/desktop/tags/user-photos.tag b/src/web/app/desktop/tags/user-photos.tag index 89453b4606..71899c92e6 100644 --- a/src/web/app/desktop/tags/user-photos.tag +++ b/src/web/app/desktop/tags/user-photos.tag @@ -77,8 +77,8 @@ limit: 9posts .then (posts) => this.initializing = false - posts.for-each (post) => - post.media.for-each (image) => + posts.forEach (post) => + post.media.forEach (image) => if @images.length < 9 @images.push image this.update(); diff --git a/src/web/app/desktop/tags/user-timeline.tag b/src/web/app/desktop/tags/user-timeline.tag index ab82b2677f..c982a68a7d 100644 --- a/src/web/app/desktop/tags/user-timeline.tag +++ b/src/web/app/desktop/tags/user-timeline.tag @@ -84,7 +84,7 @@ this.fetch = (cb) => { this.api 'users/posts' do user_id: @user.id - with_replies: @mode == 'with-replies' + with_replies: this.mode == 'with-replies' .then (posts) => this.is-loading = false this.is-empty = posts.length == 0 @@ -102,7 +102,7 @@ this.update(); this.api 'users/posts' do user_id: @user.id - with_replies: @mode == 'with-replies' + with_replies: this.mode == 'with-replies' max_id: this.refs.timeline.tail!.id .then (posts) => this.more-loading = false diff --git a/src/web/app/desktop/tags/users-list.tag b/src/web/app/desktop/tags/users-list.tag index 9fd1239526..dbb7069c4c 100644 --- a/src/web/app/desktop/tags/users-list.tag +++ b/src/web/app/desktop/tags/users-list.tag @@ -104,7 +104,7 @@ this.fetching = true this.update(); obj <~ this.opts.fetch do - @mode == 'iknow' + this.mode == 'iknow' @limit null this.users = obj.users @@ -117,7 +117,7 @@ this.more-fetching = true this.update(); obj <~ this.opts.fetch do - @mode == 'iknow' + this.mode == 'iknow' @limit @cursor this.users = @users.concat obj.users diff --git a/src/web/app/desktop/tags/window.tag b/src/web/app/desktop/tags/window.tag index 81011e9f50..3c7cc14f74 100644 --- a/src/web/app/desktop/tags/window.tag +++ b/src/web/app/desktop/tags/window.tag @@ -304,7 +304,7 @@ z = 0 ws = document.query-selector-all 'mk-window' - ws.for-each (w) !=> + ws.forEach (w) !=> if w == this.root then return m = w.query-selector ':scope > .main' mz = Number(document.default-view.get-computed-style m, null .z-index) diff --git a/src/web/app/dev/tags/new-app-form.tag b/src/web/app/dev/tags/new-app-form.tag index 2718bcd5d0..d0906d6381 100644 --- a/src/web/app/dev/tags/new-app-form.tag +++ b/src/web/app/dev/tags/new-app-form.tag @@ -222,7 +222,7 @@ cb = this.refs.cb.value permission = [] - this.refs.permission.query-selector-all 'input' .for-each (el) => + this.refs.permission.query-selector-all 'input' .forEach (el) => if el.checked then permission.push el.value locker = document.body.appendChild document.createElement 'mk-locker' diff --git a/src/web/app/mobile/tags/drive.tag b/src/web/app/mobile/tags/drive.tag index 6daa50c26d..d0c9b87b99 100644 --- a/src/web/app/mobile/tags/drive.tag +++ b/src/web/app/mobile/tags/drive.tag @@ -133,7 +133,7 @@ this.files = [] this.folders = [] - this.hierarchy-folders = [] + this.hierarchyFolders = [] this.selected-files = [] // 現在の階層(フォルダ) @@ -146,10 +146,10 @@ this.multiple = if this.opts.multiple? then this.opts.multiple else false this.on('mount', () => { - @stream.on 'drive_file_created' this.on-stream-drive-file-created - @stream.on 'drive_file_updated' this.on-stream-drive-file-updated - @stream.on 'drive_folder_created' this.on-stream-drive-folder-created - @stream.on 'drive_folder_updated' this.on-stream-drive-folder-updated + this.stream.on 'drive_file_created' this.on-stream-drive-file-created + this.stream.on 'drive_file_updated' this.on-stream-drive-file-updated + this.stream.on 'drive_folder_created' this.on-stream-drive-folder-created + this.stream.on 'drive_folder_updated' this.on-stream-drive-folder-updated // Riotのバグでnullを渡しても""になる // https://github.com/riot/riot/issues/2080 @@ -162,10 +162,10 @@ @load! this.on('unmount', () => { - @stream.off 'drive_file_created' this.on-stream-drive-file-created - @stream.off 'drive_file_updated' this.on-stream-drive-file-updated - @stream.off 'drive_folder_created' this.on-stream-drive-folder-created - @stream.off 'drive_folder_updated' this.on-stream-drive-folder-updated + this.stream.off 'drive_file_created' this.on-stream-drive-file-created + this.stream.off 'drive_file_updated' this.on-stream-drive-file-updated + this.stream.off 'drive_folder_created' this.on-stream-drive-folder-created + this.stream.off 'drive_folder_updated' this.on-stream-drive-folder-updated this.on-stream-drive-file-created = (file) => { @add-file file, true @@ -210,10 +210,10 @@ folder_id: target-folder .then (folder) => this.folder = folder - this.hierarchy-folders = [] + this.hierarchyFolders = [] x = (f) => - @hierarchy-folders.unshift f + @hierarchyFolders.unshift f if f.parent? x f.parent @@ -275,7 +275,7 @@ if this.folder != null or this.file != null this.file = null this.folder = null - this.hierarchy-folders = [] + this.hierarchyFolders = [] this.update(); this.trigger('move-root'); @load! @@ -325,9 +325,9 @@ flag = false complete = => if flag - load-folders.for-each (folder) => + load-folders.forEach (folder) => @add-folder folder - load-files.for-each (file) => + load-files.forEach (file) => @add-file file this.loading = false this.update(); @@ -361,10 +361,10 @@ .then (file) => this.file = file this.folder = null - this.hierarchy-folders = [] + this.hierarchyFolders = [] x = (f) => - @hierarchy-folders.unshift f + @hierarchyFolders.unshift f if f.parent? x f.parent diff --git a/src/web/app/mobile/tags/follow-button.tag b/src/web/app/mobile/tags/follow-button.tag index 36447f3acd..71a38254d4 100644 --- a/src/web/app/mobile/tags/follow-button.tag +++ b/src/web/app/mobile/tags/follow-button.tag @@ -62,12 +62,12 @@ this.user = user this.init = false this.update(); - @stream.on 'follow' this.on-stream-follow - @stream.on 'unfollow' this.on-stream-unfollow + this.stream.on 'follow' this.on-stream-follow + this.stream.on 'unfollow' this.on-stream-unfollow this.on('unmount', () => { - @stream.off 'follow' this.on-stream-follow - @stream.off 'unfollow' this.on-stream-unfollow + this.stream.off 'follow' this.on-stream-follow + this.stream.off 'unfollow' this.on-stream-unfollow this.on-stream-follow = (user) => { if user.id == @user.id diff --git a/src/web/app/mobile/tags/home-timeline.tag b/src/web/app/mobile/tags/home-timeline.tag index 322ba8f932..b308c4168c 100644 --- a/src/web/app/mobile/tags/home-timeline.tag +++ b/src/web/app/mobile/tags/home-timeline.tag @@ -16,14 +16,14 @@ this.trigger('loaded'); this.on('mount', () => { - @stream.on 'post' this.on-stream-post - @stream.on 'follow' this.on-stream-follow - @stream.on 'unfollow' this.on-stream-unfollow + this.stream.on 'post' this.on-stream-post + this.stream.on 'follow' this.on-stream-follow + this.stream.on 'unfollow' this.on-stream-unfollow this.on('unmount', () => { - @stream.off 'post' this.on-stream-post - @stream.off 'follow' this.on-stream-follow - @stream.off 'unfollow' this.on-stream-unfollow + this.stream.off 'post' this.on-stream-post + this.stream.off 'follow' this.on-stream-follow + this.stream.off 'unfollow' this.on-stream-unfollow this.more = () => { this.api 'posts/timeline' do diff --git a/src/web/app/mobile/tags/notifications.tag b/src/web/app/mobile/tags/notifications.tag index 9d665ec93e..ef53c025e3 100644 --- a/src/web/app/mobile/tags/notifications.tag +++ b/src/web/app/mobile/tags/notifications.tag @@ -74,19 +74,19 @@ .catch (err, text-status) -> console.error err - @stream.on 'notification' this.on-notification + this.stream.on 'notification' this.on-notification this.on('unmount', () => { - @stream.off 'notification' this.on-notification + this.stream.off 'notification' this.on-notification this.on-notification = (notification) => { @notifications.unshift notification this.update(); this.on('update', () => { - @notifications.for-each (notification) => - date = (new Date notification.created_at).get-date! - month = (new Date notification.created_at).get-month! + 1 + @notifications.forEach (notification) => + date = (new Date notification.created_at).getDate() + month = (new Date notification.created_at).getMonth() + 1 notification._date = date notification._datetext = month + '月 ' + date + '日' diff --git a/src/web/app/mobile/tags/page/home.tag b/src/web/app/mobile/tags/page/home.tag index d46e834746..ac00800a16 100644 --- a/src/web/app/mobile/tags/page/home.tag +++ b/src/web/app/mobile/tags/page/home.tag @@ -22,14 +22,14 @@ this.Progress.start(); - @stream.on 'post' this.on-stream-post + this.stream.on 'post' this.on-stream-post document.addEventListener 'visibilitychange' @window-on-visibilitychange, false this.refs.ui.refs.home.on('loaded', () => { this.Progress.done(); this.on('unmount', () => { - @stream.off 'post' this.on-stream-post + this.stream.off 'post' this.on-stream-post document.removeEventListener 'visibilitychange' @window-on-visibilitychange this.on-stream-post = (post) => { diff --git a/src/web/app/mobile/tags/page/messaging.tag b/src/web/app/mobile/tags/page/messaging.tag index 1af983b1db..78a2ca9917 100644 --- a/src/web/app/mobile/tags/page/messaging.tag +++ b/src/web/app/mobile/tags/page/messaging.tag @@ -15,7 +15,7 @@ this.ui.trigger('title', 'メッセージ'); this.refs.ui.refs.index.on('navigate-user', (user) => { - @page '/i/messaging/' + user.username + this.page '/i/messaging/' + user.username diff --git a/src/web/app/mobile/tags/post-detail.tag b/src/web/app/mobile/tags/post-detail.tag index 9319cfe68e..fee132d7df 100644 --- a/src/web/app/mobile/tags/post-detail.tag +++ b/src/web/app/mobile/tags/post-detail.tag @@ -344,18 +344,18 @@ post_id: this.opts.post .then (post) => this.post = post - this.is-repost = @post.repost? - this.p = if @is-repost then @post.repost else @post - this.summary = @get-post-summary @p + this.is-repost = this.post.repost? + this.p = if @is-repost then this.post.repost else this.post + this.summary = @get-post-summary this.p this.trigger('loaded'); this.fetching = false this.update(); - if @p.text? - tokens = @analyze @p.text + if this.p.text? + tokens = @analyze this.p.text this.refs.text.innerHTML = @compile tokens - this.refs.text.children.for-each (e) => + this.refs.text.children.forEach (e) => if e.tag-name == 'MK-URL' riot.mount e @@ -364,12 +364,12 @@ .filter (t) -> t.type == 'link' .map (t) => this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview' - riot.mount @preview, do + riot.mount this.preview, do url: t.content // Get likes this.api 'posts/likes' do - post_id: @p.id + post_id: this.p.id limit: 8 .then (likes) => this.likes = likes @@ -377,7 +377,7 @@ // Get reposts this.api 'posts/reposts' do - post_id: @p.id + post_id: this.p.id limit: 8 .then (reposts) => this.reposts = reposts @@ -385,7 +385,7 @@ // Get replies this.api 'posts/replies' do - post_id: @p.id + post_id: this.p.id limit: 8 .then (replies) => this.replies = replies @@ -393,27 +393,27 @@ this.reply = () => { @open-post-form do - reply: @p + reply: this.p this.repost = () => { text = window.prompt '「' + @summary + '」をRepost' if text? this.api 'posts/create' do - repost_id: @p.id + repost_id: this.p.id text: if text == '' then undefined else text this.like = () => { - if @p.is_liked + if this.p.is_liked this.api 'posts/likes/delete' do - post_id: @p.id + post_id: this.p.id .then => - @p.is_liked = false + this.p.is_liked = false this.update(); else this.api 'posts/likes/create' do - post_id: @p.id + post_id: this.p.id .then => - @p.is_liked = true + this.p.is_liked = true this.update(); this.load-context = () => { @@ -421,7 +421,7 @@ // Get context this.api 'posts/context' do - post_id: @p.reply_to_id + post_id: this.p.reply_to_id .then (context) => this.context = context.reverse! this.loading-context = false diff --git a/src/web/app/mobile/tags/post-form.tag b/src/web/app/mobile/tags/post-form.tag index 7b7243cf06..05cb1c5657 100644 --- a/src/web/app/mobile/tags/post-form.tag +++ b/src/web/app/mobile/tags/post-form.tag @@ -202,7 +202,7 @@ this.onkeypress = (e) => { if (e.char-code == 10 || e.char-code == 13) && e.ctrlKey - @post! + this.post! else return true @@ -217,7 +217,7 @@ return true this.select-file = () => { - this.refs.file.click! + this.refs.file.click(); this.select-file-from-drive = () => { browser = document.body.appendChild document.createElement 'mk-drive-selector' @@ -225,7 +225,7 @@ multiple: true .0 browser.on('selected', (files) => { - files.for-each @add-file + files.forEach @add-file this.change-file = () => { files = this.refs.file.files @@ -264,7 +264,7 @@ text: this.refs.text.value media_ids: files reply_to_id: if this.opts.reply? then this.opts.reply.id else undefined - poll: if @poll then this.refs.poll.get! else undefined + poll: if this.poll then this.refs.poll.get! else undefined .then (data) => this.trigger('post'); this.unmount(); diff --git a/src/web/app/mobile/tags/stream-indicator.tag b/src/web/app/mobile/tags/stream-indicator.tag index caa727dd8c..c3669c0744 100644 --- a/src/web/app/mobile/tags/stream-indicator.tag +++ b/src/web/app/mobile/tags/stream-indicator.tag @@ -35,7 +35,7 @@ if @state == 'connected' this.root.style.opacity = 0 - @stream-state-ev.on('connected', () => { + this.stream-state-ev.on('connected', () => { this.state = @get-stream-state! this.update(); setTimeout => @@ -44,7 +44,7 @@ } 200ms 'linear' , 1000ms - @stream-state-ev.on('closed', () => { + this.stream-state-ev.on('closed', () => { this.state = @get-stream-state! this.update(); Velocity this.root, { diff --git a/src/web/app/mobile/tags/sub-post-content.tag b/src/web/app/mobile/tags/sub-post-content.tag index 91bd5ac1d3..a5af90cc74 100644 --- a/src/web/app/mobile/tags/sub-post-content.tag +++ b/src/web/app/mobile/tags/sub-post-content.tag @@ -33,11 +33,11 @@ this.post = this.opts.post this.on('mount', () => { - if @post.text? - tokens = @analyze @post.text + if this.post.text? + tokens = @analyze this.post.text this.refs.text.innerHTML = @compile tokens, false - this.refs.text.children.for-each (e) => + this.refs.text.children.forEach (e) => if e.tag-name == 'MK-URL' riot.mount e diff --git a/src/web/app/mobile/tags/timeline-post.tag b/src/web/app/mobile/tags/timeline-post.tag index 9cc6a088b5..2d6a6a1fa4 100644 --- a/src/web/app/mobile/tags/timeline-post.tag +++ b/src/web/app/mobile/tags/timeline-post.tag @@ -292,22 +292,22 @@ this.mixin('open-post-form'); this.post = this.opts.post - this.is-repost = @post.repost? and !@post.text? - this.p = if @is-repost then @post.repost else @post - this.summary = @get-post-summary @p - this.url = CONFIG.url + '/' + @p.user.username + '/' + @p.id + this.is-repost = this.post.repost? and !this.post.text? + this.p = if @is-repost then this.post.repost else this.post + this.summary = @get-post-summary this.p + this.url = CONFIG.url + '/' + this.p.user.username + '/' + this.p.id this.on('mount', () => { - if @p.text? - tokens = if @p._highlight? - then @analyze @p._highlight - else @analyze @p.text + if this.p.text? + tokens = if this.p._highlight? + then @analyze this.p._highlight + else @analyze this.p.text - this.refs.text.innerHTML = this.refs.text.innerHTML.replace '
' if @p._highlight? + this.refs.text.innerHTML = this.refs.text.innerHTML.replace '' if this.p._highlight? then @compile tokens, true, false else @compile tokens - this.refs.text.children.for-each (e) => + this.refs.text.children.forEach (e) => if e.tag-name == 'MK-URL' riot.mount e @@ -316,32 +316,32 @@ .filter (t) -> t.type == 'link' .map (t) => this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview' - riot.mount @preview, do + riot.mount this.preview, do url: t.content this.reply = () => { @open-post-form do - reply: @p + reply: this.p this.repost = () => { text = window.prompt '「' + @summary + '」をRepost' if text? this.api 'posts/create' do - repost_id: @p.id + repost_id: this.p.id text: if text == '' then undefined else text this.like = () => { - if @p.is_liked + if this.p.is_liked this.api 'posts/likes/delete' do - post_id: @p.id + post_id: this.p.id .then => - @p.is_liked = false + this.p.is_liked = false this.update(); else this.api 'posts/likes/create' do - post_id: @p.id + post_id: this.p.id .then => - @p.is_liked = true + this.p.is_liked = true this.update(); diff --git a/src/web/app/mobile/tags/timeline.tag b/src/web/app/mobile/tags/timeline.tag index c6ae414556..3887045e84 100644 --- a/src/web/app/mobile/tags/timeline.tag +++ b/src/web/app/mobile/tags/timeline.tag @@ -85,34 +85,34 @@ @set-posts posts this.on('update', () => { - @posts.for-each (post) => - date = (new Date post.created_at).get-date! - month = (new Date post.created_at).get-month! + 1 + this.posts.forEach (post) => + date = (new Date post.created_at).getDate() + month = (new Date post.created_at).getMonth() + 1 post._date = date post._datetext = month + '月 ' + date + '日' this.more = () => { - if @init or @fetching or @posts.length == 0 then return + if @init or @fetching or this.posts.length == 0 then return this.fetching = true this.update(); this.opts.more!.then (posts) => this.fetching = false - @prepend-posts posts + this.prepend-posts posts this.set-posts = (posts) => { this.posts = posts this.update(); this.prepend-posts = (posts) => { - posts.for-each (post) => - @posts.push post + posts.forEach (post) => + this.posts.push post this.update(); this.add-post = (post) => { - @posts.unshift post + this.posts.unshift post this.update(); this.tail = () => { - @posts[@posts.length - 1] + this.posts[this.posts.length - 1] diff --git a/src/web/app/mobile/tags/ui-nav.tag b/src/web/app/mobile/tags/ui-nav.tag index 67fbeefd15..d8769d9c06 100644 --- a/src/web/app/mobile/tags/ui-nav.tag +++ b/src/web/app/mobile/tags/ui-nav.tag @@ -126,6 +126,6 @@ this.search = () => { query = window.prompt '検索' if query? and query != '' - @page '/search:' + query + this.page '/search:' + query diff --git a/src/web/app/mobile/tags/ui.tag b/src/web/app/mobile/tags/ui.tag index 3913de7546..348c88b77a 100644 --- a/src/web/app/mobile/tags/ui.tag +++ b/src/web/app/mobile/tags/ui.tag @@ -23,11 +23,11 @@ // alert text this.on('mount', () => { - @stream.on 'notification' this.on-stream-notification + this.stream.on 'notification' this.on-stream-notification @ready! this.on('unmount', () => { - @stream.off 'notification' this.on-stream-notification + this.stream.off 'notification' this.on-stream-notification this.ready = () => { @ready-count++ diff --git a/src/web/app/mobile/tags/users-list.tag b/src/web/app/mobile/tags/users-list.tag index b0f7f73ff5..fc582e2665 100644 --- a/src/web/app/mobile/tags/users-list.tag +++ b/src/web/app/mobile/tags/users-list.tag @@ -86,7 +86,7 @@ this.fetching = true this.update(); obj <~ this.opts.fetch do - @mode == 'iknow' + this.mode == 'iknow' @limit null this.users = obj.users @@ -99,7 +99,7 @@ this.more-fetching = true this.update(); obj <~ this.opts.fetch do - @mode == 'iknow' + this.mode == 'iknow' @limit @cursor this.users = @users.concat obj.users