This commit is contained in:
syuilo 2018-02-18 12:35:18 +09:00
parent 61b95e0c26
commit 99b3499364
103 changed files with 878 additions and 790 deletions

View file

@ -26,8 +26,8 @@ export default Vue.extend({
mounted() {
document.title = 'Misskey';
this.connection = this.$root.$data.os.stream.getConnection();
this.connectionId = this.$root.$data.os.stream.use();
this.connection = (this as any).os.stream.getConnection();
this.connectionId = (this as any).os.stream.use();
this.connection.on('post', this.onStreamPost);
document.addEventListener('visibilitychange', this.onVisibilitychange, false);
@ -36,12 +36,12 @@ export default Vue.extend({
},
beforeDestroy() {
this.connection.off('post', this.onStreamPost);
this.$root.$data.os.stream.dispose(this.connectionId);
(this as any).os.stream.dispose(this.connectionId);
document.removeEventListener('visibilitychange', this.onVisibilitychange);
},
methods: {
onStreamPost(post) {
if (document.hidden && post.user_id != this.$root.$data.os.i.id) {
if (document.hidden && post.user_id != (this as any).os.i.id) {
this.unreadCount++;
document.title = `(${this.unreadCount}) ${getPostSummary(post)}`;
}

View file

@ -1,5 +1,5 @@
<template>
<component v-bind:is="$root.$data.os.isSignedIn ? 'home' : 'welcome'"></component>
<component v-bind:is="os.isSignedIn ? 'home' : 'welcome'"></component>
</template>
<script lang="ts">

View file

@ -21,7 +21,7 @@ export default Vue.extend({
document.documentElement.style.background = '#fff';
this.$root.$data.os.api('users/show', {
(this as any).api('users/show', {
username: this.username
}).then(user => {
this.fetching = false;

View file

@ -23,7 +23,7 @@ export default Vue.extend({
mounted() {
Progress.start();
this.$root.$data.os.api('posts/show', {
(this as any).api('posts/show', {
post_id: this.postId
}).then(post => {
this.fetching = false;

View file

@ -44,7 +44,7 @@ export default Vue.extend({
document.addEventListener('keydown', this.onDocumentKeydown);
window.addEventListener('scroll', this.onScroll);
this.$root.$data.os.api('posts/search', parse(this.query)).then(posts => {
(this as any).api('posts/search', parse(this.query)).then(posts => {
this.fetching = false;
this.posts = posts;
});
@ -65,7 +65,7 @@ export default Vue.extend({
if (this.moreFetching || this.fetching || this.posts.length == 0) return;
this.offset += limit;
this.moreFetching = true;
return this.$root.$data.os.api('posts/search', Object.assign({}, parse(this.query), {
return (this as any).api('posts/search', Object.assign({}, parse(this.query), {
limit: limit,
offset: this.offset
})).then(posts => {

View file

@ -22,7 +22,7 @@ export default Vue.extend({
};
},
mounted() {
this.$root.$data.os.api('users/followers', {
(this as any).api('users/followers', {
user_id: this.user.id,
iknow: true,
limit: 16

View file

@ -27,7 +27,7 @@ export default Vue.extend({
};
},
mounted() {
this.$root.$data.os.api('users/get_frequently_replied_users', {
(this as any).api('users/get_frequently_replied_users', {
user_id: this.user.id,
limit: 4
}).then(docs => {

View file

@ -51,9 +51,9 @@ export default Vue.extend({
},
onBannerClick() {
if (!this.$root.$data.os.isSignedIn || this.$root.$data.os.i.id != this.user.id) return;
if (!(this as any).os.isSignedIn || (this as any).os.i.id != this.user.id) return;
updateBanner(this.$root.$data.os.i, i => {
updateBanner((this as any).os.i, i => {
this.user.banner_url = i.banner_url;
});
}

View file

@ -4,7 +4,7 @@
<div ref="left">
<mk-user-profile :user="user"/>
<mk-user-photos :user="user"/>
<mk-user-followers-you-know v-if="$root.$data.os.isSignedIn && $root.$data.os.i.id != user.id" :user="user"/>
<mk-user-followers-you-know v-if="os.isSignedIn && os.i.id != user.id" :user="user"/>
<p>%i18n:desktop.tags.mk-user.last-used-at%: <b><mk-time :time="user.last_used_at"/></b></p>
</div>
</div>

View file

@ -23,7 +23,7 @@ export default Vue.extend({
};
},
mounted() {
this.$root.$data.os.api('users/posts', {
(this as any).api('users/posts', {
user_id: this.user.id,
with_media: true,
limit: 9

View file

@ -1,6 +1,6 @@
<template>
<div class="mk-user-profile">
<div class="friend-form" v-if="$root.$data.os.isSignedIn && $root.$data.os.i.id != user.id">
<div class="friend-form" v-if="os.isSignedIn && os.i.id != user.id">
<mk-follow-button :user="user" size="big"/>
<p class="followed" v-if="user.is_followed">%i18n:desktop.tags.mk-user.follows-you%</p>
<p v-if="user.is_muted">%i18n:desktop.tags.mk-user.muted% <a @click="unmute">%i18n:desktop.tags.mk-user.unmute%</a></p>
@ -35,7 +35,7 @@ export default Vue.extend({
methods: {
showFollowing() {
document.body.appendChild(new MkUserFollowingWindow({
parent: this,
propsData: {
user: this.user
}
@ -44,7 +44,7 @@ export default Vue.extend({
showFollowers() {
document.body.appendChild(new MkUserFollowersWindow({
parent: this,
propsData: {
user: this.user
}
@ -52,7 +52,7 @@ export default Vue.extend({
},
mute() {
this.$root.$data.os.api('mute/create', {
(this as any).api('mute/create', {
user_id: this.user.id
}).then(() => {
this.user.is_muted = true;
@ -62,7 +62,7 @@ export default Vue.extend({
},
unmute() {
this.$root.$data.os.api('mute/delete', {
(this as any).api('mute/delete', {
user_id: this.user.id
}).then(() => {
this.user.is_muted = false;

View file

@ -29,7 +29,7 @@ export default Vue.extend({
},
mounted() {
Progress.start();
this.$root.$data.os.api('users/show', {
(this as any).api('users/show', {
username: this.username
}).then(user => {
this.fetching = false;