This commit is contained in:
syuilo 2017-02-20 16:27:24 +09:00
parent c05abf4da7
commit 3a39a36bed
22 changed files with 136 additions and 100 deletions

View File

@ -226,7 +226,7 @@
, 4000ms , 4000ms
}; };
this.on-visibilitychange = () => { this.onVisibilitychange = () => {
if document.hidden then return if document.hidden then return
@messages.forEach (message) => @messages.forEach (message) =>
if message.user_id != this.I.id and not message.is_read if message.user_id != this.I.id and not message.is_read

View File

@ -28,18 +28,18 @@
document.title = 'Misskey' document.title = 'Misskey'
this.Progress.start(); this.Progress.start();
this.stream.on 'post' this.on-stream-post 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.on('unmount', () => {
this.stream.off 'post' this.on-stream-post this.stream.off 'post' this.on-stream-post
document.removeEventListener 'visibilitychange' @window-on-visibilitychange document.removeEventListener 'visibilitychange' @window-onVisibilitychange
this.on-stream-post = (post) => { this.on-stream-post = (post) => {
if document.hidden and post.user_id !== this.I.id if document.hidden and post.user_id !== this.I.id
@unread-count++ @unread-count++
document.title = '(' + @unread-count + ') ' + @get-post-summary post document.title = '(' + @unread-count + ') ' + @get-post-summary post
this.window-on-visibilitychange = () => { this.window-onVisibilitychange = () => {
if !document.hidden if !document.hidden
this.unread-count = 0 this.unread-count = 0
document.title = 'Misskey' document.title = 'Misskey'

View File

@ -59,7 +59,7 @@
this.mode = 'default' this.mode = 'default'
this.on('mount', () => { this.on('mount', () => {
document.addEventListener 'visibilitychange' @window-on-visibilitychange, false document.addEventListener 'visibilitychange' @window-onVisibilitychange, false
document.addEventListener 'keydown' this.on-document-keydown document.addEventListener 'keydown' this.on-document-keydown
window.addEventListener 'scroll' this.on-scroll window.addEventListener 'scroll' this.on-scroll
@ -71,7 +71,7 @@
this.trigger('loaded'); this.trigger('loaded');
this.on('unmount', () => { this.on('unmount', () => {
document.removeEventListener 'visibilitychange' @window-on-visibilitychange document.removeEventListener 'visibilitychange' @window-onVisibilitychange
document.removeEventListener 'keydown' this.on-document-keydown document.removeEventListener 'keydown' this.on-document-keydown
window.removeEventListener 'scroll' this.on-scroll window.removeEventListener 'scroll' this.on-scroll
@ -120,7 +120,7 @@
@unread-count++ @unread-count++
document.title = '(' + @unread-count + ') ' + @get-post-summary post document.title = '(' + @unread-count + ') ' + @get-post-summary post
this.window-on-visibilitychange = () => { this.window-onVisibilitychange = () => {
if !document.hidden if !document.hidden
this.unread-count = 0 this.unread-count = 0
document.title = 'Misskey' document.title = 'Misskey'

View File

@ -56,19 +56,24 @@
</style> </style>
<script> <script>
this.files = [] this.files = [];
this.on('mount', () => { this.on('mount', () => {
this.refs.browser.on('change-selected', (files) => { this.refs.browser.on('change-selected', files => {
this.files = files this.update({
this.update(); files: files
});
});
});
this.cancel = () => { this.cancel = () => {
this.trigger('canceled'); this.trigger('canceled');
this.unmount(); this.unmount();
};
this.ok = () => { this.ok = () => {
this.trigger 'selected' this.files this.trigger('selected', this.files);
this.unmount(); this.unmount();
};
</script> </script>
</mk-drive-selector> </mk-drive-selector>

View File

@ -5,57 +5,64 @@
<style> <style>
:scope :scope
display block display block
</style> </style>
<script> <script>
this.mixin('ui'); this.mixin('ui');
this.mixin('ui-progress'); this.mixin('ui-progress');
this.on('mount', () => { this.on('mount', () => {
document.title = 'Misskey Drive' document.title = 'Misskey Drive';
this.ui.trigger('title', '<i class="fa fa-cloud"></i>ドライブ'); this.ui.trigger('title', '<i class="fa fa-cloud"></i>ドライブ');
this.refs.ui.refs.browser.on('begin-load', () => { this.refs.ui.refs.browser.on('begin-load', () => {
this.Progress.start(); this.Progress.start();
});
this.refs.ui.refs.browser.on('loaded-mid', () => { this.refs.ui.refs.browser.on('loaded-mid', () => {
this.Progress.set(0.5); this.Progress.set(0.5);
});
this.refs.ui.refs.browser.on('loaded', () => { this.refs.ui.refs.browser.on('loaded', () => {
this.Progress.done(); this.Progress.done();
});
this.refs.ui.refs.browser.on('move-root', () => { this.refs.ui.refs.browser.on('move-root', () => {
title = 'Misskey Drive' const title = 'Misskey Drive';
// Rewrite URL // 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.ui.trigger('title', '<i class="fa fa-cloud"></i>ドライブ');
});
this.refs.ui.refs.browser.on('open-folder', (folder, silent) => { 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 // 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 // TODO: escape html characters in folder.name
this.ui.trigger('title', '<i class="fa fa-folder-open"></i>' + 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) => { 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 // 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 // TODO: escape html characters in file.name
this.ui.trigger('title', '<mk-file-type-icon class="icon"></mk-file-type-icon>' + 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 type: file.type
});
});
</script> </script>
</mk-drive-page> </mk-drive-page>

View File

@ -43,18 +43,24 @@
</style> </style>
<script> <script>
this.mode = 'signin' this.mode = 'signin';
this.signup = () => { this.signup = () => {
this.mode = 'signup' this.update({
this.update(); mode: 'signup'
});
};
this.signin = () => { this.signin = () => {
this.mode = 'signin' this.update({
this.update(); mode: 'signin'
});
};
this.introduction = () => { this.introduction = () => {
this.mode = 'introduction' this.update({
this.update(); mode: 'introduction'
});
};
</script> </script>
</mk-entrance> </mk-entrance>

View File

@ -34,9 +34,5 @@
> i > i
padding 14px padding 14px
</style> </style>
</mk-entrance-signup> </mk-entrance-signup>

View File

@ -5,7 +5,6 @@
<style> <style>
:scope :scope
display block display block
</style> </style>
<script> <script>
this.mixin('i'); this.mixin('i');
@ -14,7 +13,7 @@
this.mixin('stream'); this.mixin('stream');
this.mixin('get-post-summary'); this.mixin('get-post-summary');
this.unread-count = 0 this.unreadCount = 0;
this.on('mount', () => { this.on('mount', () => {
document.title = 'Misskey' document.title = 'Misskey'
@ -22,24 +21,31 @@
this.Progress.start(); this.Progress.start();
this.stream.on 'post' this.on-stream-post this.stream.on('post', this.onStreamPost);
document.addEventListener 'visibilitychange' @window-on-visibilitychange, false document.addEventListener('visibilitychange', this.onVisibilitychange, false);
this.refs.ui.refs.home.on('loaded', () => { this.refs.ui.refs.home.on('loaded', () => {
this.Progress.done(); this.Progress.done();
});
});
this.on('unmount', () => { this.on('unmount', () => {
this.stream.off 'post' this.on-stream-post this.stream.off('post', this.onStreamPost);
document.removeEventListener 'visibilitychange' @window-on-visibilitychange document.removeEventListener('visibilitychange', this.onVisibilitychange);
});
this.on-stream-post = (post) => { this.onStreamPost = post => {
if document.hidden and post.user_id !== this.I.id if (document.hidden && post.user_id !== this.I.id) {
@unread-count++ this.unreadCount++;
document.title = '(' + @unread-count + ') ' + @get-post-summary post document.title = `(${this.unreadCount}) ${this.getPostSummary(post)}`;
}
};
this.window-on-visibilitychange = () => { this.onVisibilitychange = () => {
if !document.hidden if (!document.hidden) {
this.unread-count = 0 this.unreadCount = 0;
document.title = 'Misskey' document.title = 'Misskey';
}
};
</script> </script>
</mk-home-page> </mk-home-page>

View File

@ -10,18 +10,21 @@
this.mixin('api'); this.mixin('api');
this.mixin('ui'); this.mixin('ui');
this.fetching = true this.fetching = true;
this.on('mount', () => { this.on('mount', () => {
this.api('users/show', { this.api('users/show', {
username: this.opts.username username: this.opts.username
}).then(user => { }).then(user => {
this.fetching = false this.update({
this.user = user fetching: false,
this.update(); user: user
});
document.title = 'メッセージ: ' + user.name + ' | Misskey' document.title = `メッセージ: ${user.name} | Misskey`;
// TODO: ユーザー名をエスケープ // 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> </script>
</mk-messaging-room-page> </mk-messaging-room-page>

View File

@ -11,11 +11,12 @@
this.mixin('page'); this.mixin('page');
this.on('mount', () => { this.on('mount', () => {
document.title = 'Misskey | メッセージ' document.title = 'Misskey | メッセージ';
this.ui.trigger('title', '<i class="fa fa-comments-o"></i>メッセージ'); this.ui.trigger('title', '<i class="fa fa-comments-o"></i>メッセージ');
this.refs.ui.refs.index.on('navigate-user', (user) => { this.refs.ui.refs.index.on('navigate-user', user => {
this.page '/i/messaging/' + user.username this.page('/i/messaging/' + user.username);
});
});
</script> </script>
</mk-messaging-page> </mk-messaging-page>

View File

@ -3,10 +3,5 @@
<style> <style>
:scope :scope
display block display block
</style> </style>
</mk-new-post-page> </mk-new-post-page>

View File

@ -12,12 +12,14 @@
this.mixin('ui-progress'); this.mixin('ui-progress');
this.on('mount', () => { this.on('mount', () => {
document.title = 'Misskey | 通知' document.title = 'Misskey | 通知';
this.ui.trigger('title', '<i class="fa fa-bell-o"></i>通知'); this.ui.trigger('title', '<i class="fa fa-bell-o"></i>通知');
this.Progress.start(); this.Progress.start();
this.refs.ui.refs.notifications.on('loaded', () => { this.refs.ui.refs.notifications.on('loaded', () => {
this.Progress.done(); this.Progress.done();
});
});
</script> </script>
</mk-notifications-page> </mk-notifications-page>

View File

@ -21,18 +21,21 @@
this.mixin('ui'); this.mixin('ui');
this.mixin('ui-progress'); this.mixin('ui-progress');
this.post = this.opts.post this.post = this.opts.post;
this.on('mount', () => { this.on('mount', () => {
document.title = 'Misskey' document.title = 'Misskey';
this.ui.trigger('title', '<i class="fa fa-sticky-note-o"></i>投稿'); this.ui.trigger('title', '<i class="fa fa-sticky-note-o"></i>投稿');
this.Progress.start(); this.Progress.start();
this.refs.ui.refs.post.on('post-fetched', () => { this.refs.ui.refs.post.on('post-fetched', () => {
this.Progress.set(0.5); this.Progress.set(0.5);
});
this.refs.ui.refs.post.on('loaded', () => { this.refs.ui.refs.post.on('loaded', () => {
this.Progress.done(); this.Progress.done();
});
});
</script> </script>
</mk-post-page> </mk-post-page>

View File

@ -5,20 +5,21 @@
<style> <style>
:scope :scope
display block display block
</style> </style>
<script> <script>
this.mixin('ui'); this.mixin('ui');
this.mixin('ui-progress'); this.mixin('ui-progress');
this.on('mount', () => { this.on('mount', () => {
document.title = '検索: ' + this.opts.query + ' | Misskey' document.title = `検索: ${this.opts.query} | Misskey`
// TODO: クエリをHTMLエスケープ // 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.Progress.start();
this.refs.ui.refs.search.on('loaded', () => { this.refs.ui.refs.search.on('loaded', () => {
this.Progress.done(); this.Progress.done();
});
});
</script> </script>
</mk-search-page> </mk-search-page>

View File

@ -16,7 +16,8 @@
this.mixin('ui'); this.mixin('ui');
this.on('mount', () => { this.on('mount', () => {
document.title = 'Misskey | 設定' document.title = 'Misskey | 設定';
this.ui.trigger('title', '<i class="fa fa-cog"></i>設定'); this.ui.trigger('title', '<i class="fa fa-cog"></i>設定');
});
</script> </script>
</mk-settings-page> </mk-settings-page>

View File

@ -10,7 +10,8 @@
this.mixin('ui'); this.mixin('ui');
this.on('mount', () => { this.on('mount', () => {
document.title = 'Misskey | API' document.title = 'Misskey | API';
this.ui.trigger('title', '<i class="fa fa-key"></i>API'); this.ui.trigger('title', '<i class="fa fa-key"></i>API');
});
</script> </script>
</mk-api-info-page> </mk-api-info-page>

View File

@ -10,7 +10,8 @@
this.mixin('ui'); this.mixin('ui');
this.on('mount', () => { this.on('mount', () => {
document.title = 'Misskey | アプリケーション' document.title = 'Misskey | アプリケーション';
this.ui.trigger('title', '<i class="fa fa-puzzle-piece"></i>アプリケーション'); this.ui.trigger('title', '<i class="fa fa-puzzle-piece"></i>アプリケーション');
});
</script> </script>
</mk-authorized-apps-page> </mk-authorized-apps-page>

View File

@ -10,7 +10,8 @@
this.mixin('ui'); this.mixin('ui');
this.on('mount', () => { this.on('mount', () => {
document.title = 'Misskey | ログイン履歴' document.title = 'Misskey | ログイン履歴';
this.ui.trigger('title', '<i class="fa fa-sign-in"></i>ログイン履歴'); this.ui.trigger('title', '<i class="fa fa-sign-in"></i>ログイン履歴');
});
</script> </script>
</mk-signin-history-page> </mk-signin-history-page>

View File

@ -10,7 +10,8 @@
this.mixin('ui'); this.mixin('ui');
this.on('mount', () => { this.on('mount', () => {
document.title = 'Misskey | Twitter連携' document.title = 'Misskey | Twitter連携';
this.ui.trigger('title', '<i class="fa fa-twitter"></i>Twitter連携'); this.ui.trigger('title', '<i class="fa fa-twitter"></i>Twitter連携');
});
</script> </script>
</mk-twitter-setting-page> </mk-twitter-setting-page>

View File

@ -5,15 +5,14 @@
<style> <style>
:scope :scope
display block display block
</style> </style>
<script> <script>
this.mixin('ui'); this.mixin('ui');
this.mixin('ui-progress'); this.mixin('ui-progress');
this.mixin('api'); this.mixin('api');
this.fetching = true this.fetching = true;
this.user = null this.user = null;
this.on('mount', () => { this.on('mount', () => {
this.Progress.start(); this.Progress.start();
@ -21,16 +20,19 @@
this.api('users/show', { this.api('users/show', {
username: this.opts.user username: this.opts.user
}).then(user => { }).then(user => {
this.user = user this.update({
this.fetching = false fetching: false,
user: user
});
document.title = user.name + 'のフォロワー | Misskey' document.title = user.name + 'のフォロワー | Misskey';
// TODO: ユーザー名をエスケープ // TODO: ユーザー名をエスケープ
this.ui.trigger('title', '<img src="'); + user.avatar_url + '?thumbnail&size=64">' + user.name + 'のフォロワー' this.ui.trigger('title', '<img src="' + user.avatar_url + '?thumbnail&size=64">' + user.name + 'のフォロワー');
this.update();
this.refs.ui.refs.list.on('loaded', () => { this.refs.ui.refs.list.on('loaded', () => {
this.Progress.done(); this.Progress.done();
});
});
});
</script> </script>
</mk-user-followers-page> </mk-user-followers-page>

View File

@ -5,15 +5,14 @@
<style> <style>
:scope :scope
display block display block
</style> </style>
<script> <script>
this.mixin('ui'); this.mixin('ui');
this.mixin('ui-progress'); this.mixin('ui-progress');
this.mixin('api'); this.mixin('api');
this.fetching = true this.fetching = true;
this.user = null this.user = null;
this.on('mount', () => { this.on('mount', () => {
this.Progress.start(); this.Progress.start();
@ -21,16 +20,19 @@
this.api('users/show', { this.api('users/show', {
username: this.opts.user username: this.opts.user
}).then(user => { }).then(user => {
this.user = user this.update({
this.fetching = false fetching: false,
user: user
});
document.title = user.name + 'のフォロー | Misskey' document.title = user.name + 'のフォロー | Misskey';
// TODO: ユーザー名をエスケープ // TODO: ユーザー名をエスケープ
this.ui.trigger('title', '<img src="'); + user.avatar_url + '?thumbnail&size=64">' + user.name + 'のフォロー' this.ui.trigger('title', '<img src="' + user.avatar_url + '?thumbnail&size=64">' + user.name + 'のフォロー');
this.update();
this.refs.ui.refs.list.on('loaded', () => { this.refs.ui.refs.list.on('loaded', () => {
this.Progress.done(); this.Progress.done();
});
});
});
</script> </script>
</mk-user-following-page> </mk-user-following-page>

View File

@ -11,15 +11,17 @@
this.mixin('ui'); this.mixin('ui');
this.mixin('ui-progress'); this.mixin('ui-progress');
this.user = this.opts.user this.user = this.opts.user;
this.on('mount', () => { this.on('mount', () => {
this.Progress.start(); this.Progress.start();
this.refs.ui.refs.user.on('loaded', (user) => { this.refs.ui.refs.user.on('loaded', user => {
this.Progress.done(); this.Progress.done();
document.title = user.name + ' | Misskey' document.title = user.name + ' | Misskey';
// TODO: ユーザー名をエスケープ // 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> </script>
</mk-user-page> </mk-user-page>