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
};
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

View File

@ -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'

View File

@ -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'

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

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

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>