diff --git a/src/web/app/common/tags/messaging/room.tag b/src/web/app/common/tags/messaging/room.tag index f8088470ea..8b1220e29a 100644 --- a/src/web/app/common/tags/messaging/room.tag +++ b/src/web/app/common/tags/messaging/room.tag @@ -226,7 +226,7 @@ , 4000ms }; - this.on-visibilitychange = () => { + this.onVisibilitychange = () => { if document.hidden then return @messages.forEach (message) => if message.user_id != this.I.id and not message.is_read diff --git a/src/web/app/desktop/tags/pages/home.tag b/src/web/app/desktop/tags/pages/home.tag index 4ed74a373d..433137e9cb 100644 --- a/src/web/app/desktop/tags/pages/home.tag +++ b/src/web/app/desktop/tags/pages/home.tag @@ -28,18 +28,18 @@ document.title = 'Misskey' this.Progress.start(); this.stream.on 'post' this.on-stream-post - document.addEventListener 'visibilitychange' @window-on-visibilitychange, false + document.addEventListener 'visibilitychange' @window-onVisibilitychange, false this.on('unmount', () => { this.stream.off 'post' this.on-stream-post - document.removeEventListener 'visibilitychange' @window-on-visibilitychange + document.removeEventListener 'visibilitychange' @window-onVisibilitychange this.on-stream-post = (post) => { if document.hidden and post.user_id !== this.I.id @unread-count++ document.title = '(' + @unread-count + ') ' + @get-post-summary post - this.window-on-visibilitychange = () => { + this.window-onVisibilitychange = () => { if !document.hidden this.unread-count = 0 document.title = 'Misskey' diff --git a/src/web/app/desktop/tags/user-timeline.tag b/src/web/app/desktop/tags/user-timeline.tag index acced7fc3d..bc2e1744ef 100644 --- a/src/web/app/desktop/tags/user-timeline.tag +++ b/src/web/app/desktop/tags/user-timeline.tag @@ -59,7 +59,7 @@ this.mode = 'default' this.on('mount', () => { - document.addEventListener 'visibilitychange' @window-on-visibilitychange, false + document.addEventListener 'visibilitychange' @window-onVisibilitychange, false document.addEventListener 'keydown' this.on-document-keydown window.addEventListener 'scroll' this.on-scroll @@ -71,7 +71,7 @@ this.trigger('loaded'); this.on('unmount', () => { - document.removeEventListener 'visibilitychange' @window-on-visibilitychange + document.removeEventListener 'visibilitychange' @window-onVisibilitychange document.removeEventListener 'keydown' this.on-document-keydown window.removeEventListener 'scroll' this.on-scroll @@ -120,7 +120,7 @@ @unread-count++ document.title = '(' + @unread-count + ') ' + @get-post-summary post - this.window-on-visibilitychange = () => { + this.window-onVisibilitychange = () => { if !document.hidden this.unread-count = 0 document.title = 'Misskey' diff --git a/src/web/app/mobile/tags/drive-selector.tag b/src/web/app/mobile/tags/drive-selector.tag index 873c491542..753a2c3a9b 100644 --- a/src/web/app/mobile/tags/drive-selector.tag +++ b/src/web/app/mobile/tags/drive-selector.tag @@ -56,19 +56,24 @@ </style> <script> - this.files = [] + this.files = []; this.on('mount', () => { - this.refs.browser.on('change-selected', (files) => { - this.files = files - this.update(); + this.refs.browser.on('change-selected', files => { + this.update({ + files: files + }); + }); + }); this.cancel = () => { this.trigger('canceled'); this.unmount(); + }; this.ok = () => { - this.trigger 'selected' this.files + this.trigger('selected', this.files); this.unmount(); + }; </script> </mk-drive-selector> diff --git a/src/web/app/mobile/tags/page/drive.tag b/src/web/app/mobile/tags/page/drive.tag index c3e16a704e..c4cc64261f 100644 --- a/src/web/app/mobile/tags/page/drive.tag +++ b/src/web/app/mobile/tags/page/drive.tag @@ -5,57 +5,64 @@ <style> :scope display block - </style> <script> this.mixin('ui'); this.mixin('ui-progress'); this.on('mount', () => { - document.title = 'Misskey Drive' + document.title = 'Misskey Drive'; this.ui.trigger('title', '<i class="fa fa-cloud"></i>ドライブ'); this.refs.ui.refs.browser.on('begin-load', () => { this.Progress.start(); + }); this.refs.ui.refs.browser.on('loaded-mid', () => { this.Progress.set(0.5); + }); this.refs.ui.refs.browser.on('loaded', () => { this.Progress.done(); + }); this.refs.ui.refs.browser.on('move-root', () => { - title = 'Misskey Drive' + const title = 'Misskey Drive'; // Rewrite URL - history.pushState null, title, '/i/drive' + history.pushState(null, title, '/i/drive'); - document.title = title + document.title = title; this.ui.trigger('title', '<i class="fa fa-cloud"></i>ドライブ'); + }); this.refs.ui.refs.browser.on('open-folder', (folder, silent) => { - title = folder.name + ' | Misskey Drive' + const title = folder.name + ' | Misskey Drive'; - if !silent + if (!silent) { // Rewrite URL - history.pushState null, title, '/i/drive/folder/' + folder.id + history.pushState(null, title, '/i/drive/folder/' + folder.id); + } - document.title = title + document.title = title; // TODO: escape html characters in folder.name this.ui.trigger('title', '<i class="fa fa-folder-open"></i>' + folder.name); + }); this.refs.ui.refs.browser.on('open-file', (file, silent) => { - title = file.name + ' | Misskey Drive' + const title = file.name + ' | Misskey Drive'; - if !silent + if (!silent) { // Rewrite URL - history.pushState null, title, '/i/drive/file/' + file.id + history.pushState(null, title, '/i/drive/file/' + file.id); + } - document.title = title + document.title = title; // TODO: escape html characters in file.name this.ui.trigger('title', '<mk-file-type-icon class="icon"></mk-file-type-icon>' + file.name); - riot.mount 'mk-file-type-icon' do + riot.mount('mk-file-type-icon', { type: file.type - + }); + }); </script> </mk-drive-page> diff --git a/src/web/app/mobile/tags/page/entrance.tag b/src/web/app/mobile/tags/page/entrance.tag index 1197d0578e..452dff992e 100644 --- a/src/web/app/mobile/tags/page/entrance.tag +++ b/src/web/app/mobile/tags/page/entrance.tag @@ -43,18 +43,24 @@ </style> <script> - this.mode = 'signin' + this.mode = 'signin'; this.signup = () => { - this.mode = 'signup' - this.update(); + this.update({ + mode: 'signup' + }); + }; this.signin = () => { - this.mode = 'signin' - this.update(); + this.update({ + mode: 'signin' + }); + }; this.introduction = () => { - this.mode = 'introduction' - this.update(); + this.update({ + mode: 'introduction' + }); + }; </script> </mk-entrance> diff --git a/src/web/app/mobile/tags/page/entrance/signup.tag b/src/web/app/mobile/tags/page/entrance/signup.tag index 5209543886..c4b3ee9f38 100644 --- a/src/web/app/mobile/tags/page/entrance/signup.tag +++ b/src/web/app/mobile/tags/page/entrance/signup.tag @@ -34,9 +34,5 @@ > i padding 14px - - - - </style> </mk-entrance-signup> diff --git a/src/web/app/mobile/tags/page/home.tag b/src/web/app/mobile/tags/page/home.tag index ac00800a16..c93803fb02 100644 --- a/src/web/app/mobile/tags/page/home.tag +++ b/src/web/app/mobile/tags/page/home.tag @@ -5,7 +5,6 @@ <style> :scope display block - </style> <script> this.mixin('i'); @@ -14,7 +13,7 @@ this.mixin('stream'); this.mixin('get-post-summary'); - this.unread-count = 0 + this.unreadCount = 0; this.on('mount', () => { document.title = 'Misskey' @@ -22,24 +21,31 @@ this.Progress.start(); - this.stream.on 'post' this.on-stream-post - document.addEventListener 'visibilitychange' @window-on-visibilitychange, false + this.stream.on('post', this.onStreamPost); + document.addEventListener('visibilitychange', this.onVisibilitychange, false); this.refs.ui.refs.home.on('loaded', () => { this.Progress.done(); + }); + }); this.on('unmount', () => { - this.stream.off 'post' this.on-stream-post - document.removeEventListener 'visibilitychange' @window-on-visibilitychange + this.stream.off('post', this.onStreamPost); + document.removeEventListener('visibilitychange', this.onVisibilitychange); + }); - this.on-stream-post = (post) => { - if document.hidden and post.user_id !== this.I.id - @unread-count++ - document.title = '(' + @unread-count + ') ' + @get-post-summary post + this.onStreamPost = post => { + if (document.hidden && post.user_id !== this.I.id) { + this.unreadCount++; + document.title = `(${this.unreadCount}) ${this.getPostSummary(post)}`; + } + }; - this.window-on-visibilitychange = () => { - if !document.hidden - this.unread-count = 0 - document.title = 'Misskey' + this.onVisibilitychange = () => { + if (!document.hidden) { + this.unreadCount = 0; + document.title = 'Misskey'; + } + }; </script> </mk-home-page> diff --git a/src/web/app/mobile/tags/page/messaging-room.tag b/src/web/app/mobile/tags/page/messaging-room.tag index 934a7f8771..29657802a6 100644 --- a/src/web/app/mobile/tags/page/messaging-room.tag +++ b/src/web/app/mobile/tags/page/messaging-room.tag @@ -10,18 +10,21 @@ this.mixin('api'); this.mixin('ui'); - this.fetching = true + this.fetching = true; this.on('mount', () => { this.api('users/show', { username: this.opts.username }).then(user => { - this.fetching = false - this.user = user - this.update(); + this.update({ + fetching: false, + user: user + }); - document.title = 'メッセージ: ' + user.name + ' | Misskey' + document.title = `メッセージ: ${user.name} | Misskey`; // TODO: ユーザー名をエスケープ - this.ui.trigger('title', '<i class="fa fa-comments-o"></i>'); + user.name + this.ui.trigger('title', '<i class="fa fa-comments-o"></i>' + user.name); + }); + }); </script> </mk-messaging-room-page> diff --git a/src/web/app/mobile/tags/page/messaging.tag b/src/web/app/mobile/tags/page/messaging.tag index 78a2ca9917..fd94cbfa4a 100644 --- a/src/web/app/mobile/tags/page/messaging.tag +++ b/src/web/app/mobile/tags/page/messaging.tag @@ -11,11 +11,12 @@ this.mixin('page'); this.on('mount', () => { - document.title = 'Misskey | メッセージ' + document.title = 'Misskey | メッセージ'; this.ui.trigger('title', '<i class="fa fa-comments-o"></i>メッセージ'); - this.refs.ui.refs.index.on('navigate-user', (user) => { - this.page '/i/messaging/' + user.username - + this.refs.ui.refs.index.on('navigate-user', user => { + this.page('/i/messaging/' + user.username); + }); + }); </script> </mk-messaging-page> diff --git a/src/web/app/mobile/tags/page/new-post.tag b/src/web/app/mobile/tags/page/new-post.tag index e323f0d955..3ba549c8dc 100644 --- a/src/web/app/mobile/tags/page/new-post.tag +++ b/src/web/app/mobile/tags/page/new-post.tag @@ -3,10 +3,5 @@ <style> :scope display block - - - - - </style> </mk-new-post-page> diff --git a/src/web/app/mobile/tags/page/notifications.tag b/src/web/app/mobile/tags/page/notifications.tag index b33386fb85..1d35d79edc 100644 --- a/src/web/app/mobile/tags/page/notifications.tag +++ b/src/web/app/mobile/tags/page/notifications.tag @@ -12,12 +12,14 @@ this.mixin('ui-progress'); this.on('mount', () => { - document.title = 'Misskey | 通知' + document.title = 'Misskey | 通知'; this.ui.trigger('title', '<i class="fa fa-bell-o"></i>通知'); this.Progress.start(); this.refs.ui.refs.notifications.on('loaded', () => { this.Progress.done(); + }); + }); </script> </mk-notifications-page> diff --git a/src/web/app/mobile/tags/page/post.tag b/src/web/app/mobile/tags/page/post.tag index 69a24c5528..2c4eba37a0 100644 --- a/src/web/app/mobile/tags/page/post.tag +++ b/src/web/app/mobile/tags/page/post.tag @@ -21,18 +21,21 @@ this.mixin('ui'); this.mixin('ui-progress'); - this.post = this.opts.post + this.post = this.opts.post; this.on('mount', () => { - document.title = 'Misskey' + document.title = 'Misskey'; this.ui.trigger('title', '<i class="fa fa-sticky-note-o"></i>投稿'); this.Progress.start(); this.refs.ui.refs.post.on('post-fetched', () => { this.Progress.set(0.5); + }); this.refs.ui.refs.post.on('loaded', () => { this.Progress.done(); + }); + }); </script> </mk-post-page> diff --git a/src/web/app/mobile/tags/page/search.tag b/src/web/app/mobile/tags/page/search.tag index 4dde50ab8d..fbf741f2e6 100644 --- a/src/web/app/mobile/tags/page/search.tag +++ b/src/web/app/mobile/tags/page/search.tag @@ -5,20 +5,21 @@ <style> :scope display block - </style> <script> this.mixin('ui'); this.mixin('ui-progress'); this.on('mount', () => { - document.title = '検索: ' + this.opts.query + ' | Misskey' + document.title = `検索: ${this.opts.query} | Misskey` // TODO: クエリをHTMLエスケープ - this.ui.trigger('title', '<i class="fa fa-search"></i>'); + this.opts.query + this.ui.trigger('title', '<i class="fa fa-search"></i>' + this.opts.query); this.Progress.start(); this.refs.ui.refs.search.on('loaded', () => { this.Progress.done(); + }); + }); </script> </mk-search-page> diff --git a/src/web/app/mobile/tags/page/settings.tag b/src/web/app/mobile/tags/page/settings.tag index 5e06a302ee..59974e8cb6 100644 --- a/src/web/app/mobile/tags/page/settings.tag +++ b/src/web/app/mobile/tags/page/settings.tag @@ -16,7 +16,8 @@ this.mixin('ui'); this.on('mount', () => { - document.title = 'Misskey | 設定' + document.title = 'Misskey | 設定'; this.ui.trigger('title', '<i class="fa fa-cog"></i>設定'); + }); </script> </mk-settings-page> diff --git a/src/web/app/mobile/tags/page/settings/api.tag b/src/web/app/mobile/tags/page/settings/api.tag index 039792c0a8..e4f954f51a 100644 --- a/src/web/app/mobile/tags/page/settings/api.tag +++ b/src/web/app/mobile/tags/page/settings/api.tag @@ -10,7 +10,8 @@ this.mixin('ui'); this.on('mount', () => { - document.title = 'Misskey | API' + document.title = 'Misskey | API'; this.ui.trigger('title', '<i class="fa fa-key"></i>API'); + }); </script> </mk-api-info-page> diff --git a/src/web/app/mobile/tags/page/settings/authorized-apps.tag b/src/web/app/mobile/tags/page/settings/authorized-apps.tag index 1415f11d0a..84904c91e5 100644 --- a/src/web/app/mobile/tags/page/settings/authorized-apps.tag +++ b/src/web/app/mobile/tags/page/settings/authorized-apps.tag @@ -10,7 +10,8 @@ this.mixin('ui'); this.on('mount', () => { - document.title = 'Misskey | アプリケーション' + document.title = 'Misskey | アプリケーション'; this.ui.trigger('title', '<i class="fa fa-puzzle-piece"></i>アプリケーション'); + }); </script> </mk-authorized-apps-page> diff --git a/src/web/app/mobile/tags/page/settings/signin.tag b/src/web/app/mobile/tags/page/settings/signin.tag index 092cd64419..874cdf4856 100644 --- a/src/web/app/mobile/tags/page/settings/signin.tag +++ b/src/web/app/mobile/tags/page/settings/signin.tag @@ -10,7 +10,8 @@ this.mixin('ui'); this.on('mount', () => { - document.title = 'Misskey | ログイン履歴' + document.title = 'Misskey | ログイン履歴'; this.ui.trigger('title', '<i class="fa fa-sign-in"></i>ログイン履歴'); + }); </script> </mk-signin-history-page> diff --git a/src/web/app/mobile/tags/page/settings/twitter.tag b/src/web/app/mobile/tags/page/settings/twitter.tag index 87550efe28..2026ab7daf 100644 --- a/src/web/app/mobile/tags/page/settings/twitter.tag +++ b/src/web/app/mobile/tags/page/settings/twitter.tag @@ -10,7 +10,8 @@ this.mixin('ui'); this.on('mount', () => { - document.title = 'Misskey | Twitter連携' + document.title = 'Misskey | Twitter連携'; this.ui.trigger('title', '<i class="fa fa-twitter"></i>Twitter連携'); + }); </script> </mk-twitter-setting-page> diff --git a/src/web/app/mobile/tags/page/user-followers.tag b/src/web/app/mobile/tags/page/user-followers.tag index 75a2c5d279..249897be2c 100644 --- a/src/web/app/mobile/tags/page/user-followers.tag +++ b/src/web/app/mobile/tags/page/user-followers.tag @@ -5,15 +5,14 @@ <style> :scope display block - </style> <script> this.mixin('ui'); this.mixin('ui-progress'); this.mixin('api'); - this.fetching = true - this.user = null + this.fetching = true; + this.user = null; this.on('mount', () => { this.Progress.start(); @@ -21,16 +20,19 @@ this.api('users/show', { username: this.opts.user }).then(user => { - this.user = user - this.fetching = false + this.update({ + fetching: false, + user: user + }); - document.title = user.name + 'のフォロワー | Misskey' + document.title = user.name + 'のフォロワー | Misskey'; // TODO: ユーザー名をエスケープ - this.ui.trigger('title', '<img src="'); + user.avatar_url + '?thumbnail&size=64">' + user.name + 'のフォロワー' - - this.update(); + this.ui.trigger('title', '<img src="' + user.avatar_url + '?thumbnail&size=64">' + user.name + 'のフォロワー'); this.refs.ui.refs.list.on('loaded', () => { this.Progress.done(); + }); + }); + }); </script> </mk-user-followers-page> diff --git a/src/web/app/mobile/tags/page/user-following.tag b/src/web/app/mobile/tags/page/user-following.tag index 44a054e822..a682715a02 100644 --- a/src/web/app/mobile/tags/page/user-following.tag +++ b/src/web/app/mobile/tags/page/user-following.tag @@ -5,15 +5,14 @@ <style> :scope display block - </style> <script> this.mixin('ui'); this.mixin('ui-progress'); this.mixin('api'); - this.fetching = true - this.user = null + this.fetching = true; + this.user = null; this.on('mount', () => { this.Progress.start(); @@ -21,16 +20,19 @@ this.api('users/show', { username: this.opts.user }).then(user => { - this.user = user - this.fetching = false + this.update({ + fetching: false, + user: user + }); - document.title = user.name + 'のフォロー | Misskey' + document.title = user.name + 'のフォロー | Misskey'; // TODO: ユーザー名をエスケープ - this.ui.trigger('title', '<img src="'); + user.avatar_url + '?thumbnail&size=64">' + user.name + 'のフォロー' - - this.update(); + this.ui.trigger('title', '<img src="' + user.avatar_url + '?thumbnail&size=64">' + user.name + 'のフォロー'); this.refs.ui.refs.list.on('loaded', () => { this.Progress.done(); + }); + }); + }); </script> </mk-user-following-page> diff --git a/src/web/app/mobile/tags/page/user.tag b/src/web/app/mobile/tags/page/user.tag index 4215ca2c35..2a0e48426f 100644 --- a/src/web/app/mobile/tags/page/user.tag +++ b/src/web/app/mobile/tags/page/user.tag @@ -11,15 +11,17 @@ this.mixin('ui'); this.mixin('ui-progress'); - this.user = this.opts.user + this.user = this.opts.user; this.on('mount', () => { this.Progress.start(); - this.refs.ui.refs.user.on('loaded', (user) => { + this.refs.ui.refs.user.on('loaded', user => { this.Progress.done(); - document.title = user.name + ' | Misskey' + document.title = user.name + ' | Misskey'; // TODO: ユーザー名をエスケープ - this.ui.trigger('title', '<i class="fa fa-user"></i>'); + user.name + this.ui.trigger('title', '<i class="fa fa-user"></i>' + user.name); + }); + }); </script> </mk-user-page>