summaryrefslogtreecommitdiff
path: root/src/web/app/common
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-02-18 12:35:18 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-02-18 12:35:18 +0900
commit99b34993640eb91a591faa4bccf7d7b6f176ad97 (patch)
treef45bd1e385dc9a78f5322e233767cbb44e3fa2cf /src/web/app/common
parentwip (diff)
downloadmisskey-99b34993640eb91a591faa4bccf7d7b6f176ad97.tar.gz
misskey-99b34993640eb91a591faa4bccf7d7b6f176ad97.tar.bz2
misskey-99b34993640eb91a591faa4bccf7d7b6f176ad97.zip
wip
Diffstat (limited to 'src/web/app/common')
-rw-r--r--src/web/app/common/views/components/messaging-form.vue2
-rw-r--r--src/web/app/common/views/components/messaging-message.vue4
-rw-r--r--src/web/app/common/views/components/messaging-room.vue10
-rw-r--r--src/web/app/common/views/components/messaging.vue12
-rw-r--r--src/web/app/common/views/components/poll.vue2
-rw-r--r--src/web/app/common/views/components/post-menu.vue2
-rw-r--r--src/web/app/common/views/components/reaction-picker.vue2
-rw-r--r--src/web/app/common/views/components/signin.vue4
-rw-r--r--src/web/app/common/views/components/signup.vue6
-rw-r--r--src/web/app/common/views/components/stream-indicator.vue12
-rw-r--r--src/web/app/common/views/components/uploader.vue2
-rw-r--r--src/web/app/common/views/components/widgets/photo-stream.vue8
-rw-r--r--src/web/app/common/views/components/widgets/slideshow.vue4
13 files changed, 35 insertions, 35 deletions
diff --git a/src/web/app/common/views/components/messaging-form.vue b/src/web/app/common/views/components/messaging-form.vue
index bf4dd17baa..18d45790e4 100644
--- a/src/web/app/common/views/components/messaging-form.vue
+++ b/src/web/app/common/views/components/messaging-form.vue
@@ -62,7 +62,7 @@ export default Vue.extend({
send() {
this.sending = true;
- this.$root.$data.os.api('messaging/messages/create', {
+ (this as any).api('messaging/messages/create', {
user_id: this.user.id,
text: this.text
}).then(message => {
diff --git a/src/web/app/common/views/components/messaging-message.vue b/src/web/app/common/views/components/messaging-message.vue
index b1afe7a690..6f44332aff 100644
--- a/src/web/app/common/views/components/messaging-message.vue
+++ b/src/web/app/common/views/components/messaging-message.vue
@@ -8,7 +8,7 @@
<p class="read" v-if="message.is_me && message.is_read">%i18n:common.tags.mk-messaging-message.is-read%</p>
<button class="delete-button" v-if="message.is_me" title="%i18n:common.delete%"><img src="/assets/desktop/messaging/delete.png" alt="Delete"/></button>
<div class="content" v-if="!message.is_deleted">
- <mk-post-html v-if="message.ast" :ast="message.ast" :i="$root.$data.os.i"/>
+ <mk-post-html v-if="message.ast" :ast="message.ast" :i="os.i"/>
<mk-url-preview v-for="url in urls" :url="url" :key="url"/>
<div class="image" v-if="message.file"><img src={ message.file.url } alt="image" title={ message.file.name }/></div>
</div>
@@ -30,7 +30,7 @@ export default Vue.extend({
props: ['message'],
computed: {
isMe(): boolean {
- return this.message.user_id == this.$root.$data.os.i.id;
+ return this.message.user_id == (this as any).os.i.id;
},
urls(): string[] {
if (this.message.ast) {
diff --git a/src/web/app/common/views/components/messaging-room.vue b/src/web/app/common/views/components/messaging-room.vue
index 838e1e2653..978610d7ff 100644
--- a/src/web/app/common/views/components/messaging-room.vue
+++ b/src/web/app/common/views/components/messaging-room.vue
@@ -48,7 +48,7 @@ export default Vue.extend({
},
mounted() {
- this.connection = new MessagingStreamConnection(this.$root.$data.os.i, this.user.id);
+ this.connection = new MessagingStreamConnection((this as any).os.i, this.user.id);
this.connection.on('message', this.onMessage);
this.connection.on('read', this.onRead);
@@ -72,7 +72,7 @@ export default Vue.extend({
return new Promise((resolve, reject) => {
const max = this.existMoreMessages ? 20 : 10;
- this.$root.$data.os.api('messaging/messages', {
+ (this as any).api('messaging/messages', {
user_id: this.user.id,
limit: max + 1,
until_id: this.existMoreMessages ? this.messages[0].id : undefined
@@ -99,7 +99,7 @@ export default Vue.extend({
const isBottom = this.isBottom();
this.messages.push(message);
- if (message.user_id != this.$root.$data.os.i.id && !document.hidden) {
+ if (message.user_id != (this as any).os.i.id && !document.hidden) {
this.connection.send({
type: 'read',
id: message.id
@@ -109,7 +109,7 @@ export default Vue.extend({
if (isBottom) {
// Scroll to bottom
this.scrollToBottom();
- } else if (message.user_id != this.$root.$data.os.i.id) {
+ } else if (message.user_id != (this as any).os.i.id) {
// Notify
this.notify('%i18n:common.tags.mk-messaging-room.new-message%');
}
@@ -157,7 +157,7 @@ export default Vue.extend({
onVisibilitychange() {
if (document.hidden) return;
this.messages.forEach(message => {
- if (message.user_id !== this.$root.$data.os.i.id && !message.is_read) {
+ if (message.user_id !== (this as any).os.i.id && !message.is_read) {
this.connection.send({
type: 'read',
id: message.id
diff --git a/src/web/app/common/views/components/messaging.vue b/src/web/app/common/views/components/messaging.vue
index f45f99b535..1b56382b08 100644
--- a/src/web/app/common/views/components/messaging.vue
+++ b/src/web/app/common/views/components/messaging.vue
@@ -71,13 +71,13 @@ export default Vue.extend({
};
},
mounted() {
- this.connection = this.$root.$data.os.streams.messagingIndexStream.getConnection();
- this.connectionId = this.$root.$data.os.streams.messagingIndexStream.use();
+ this.connection = (this as any).os.streams.messagingIndexStream.getConnection();
+ this.connectionId = (this as any).os.streams.messagingIndexStream.use();
this.connection.on('message', this.onMessage);
this.connection.on('read', this.onRead);
- this.$root.$data.os.api('messaging/history').then(messages => {
+ (this as any).api('messaging/history').then(messages => {
this.fetching = false;
this.messages = messages;
});
@@ -85,11 +85,11 @@ export default Vue.extend({
beforeDestroy() {
this.connection.off('message', this.onMessage);
this.connection.off('read', this.onRead);
- this.$root.$data.os.stream.dispose(this.connectionId);
+ (this as any).os.stream.dispose(this.connectionId);
},
methods: {
isMe(message) {
- return message.user_id == this.$root.$data.os.i.id;
+ return message.user_id == (this as any).os.i.id;
},
onMessage(message) {
this.messages = this.messages.filter(m => !(
@@ -109,7 +109,7 @@ export default Vue.extend({
this.result = [];
return;
}
- this.$root.$data.os.api('users/search', {
+ (this as any).api('users/search', {
query: this.q,
max: 5
}).then(users => {
diff --git a/src/web/app/common/views/components/poll.vue b/src/web/app/common/views/components/poll.vue
index 19ce557e73..d06c019dba 100644
--- a/src/web/app/common/views/components/poll.vue
+++ b/src/web/app/common/views/components/poll.vue
@@ -47,7 +47,7 @@
},
vote(id) {
if (this.poll.choices.some(c => c.is_voted)) return;
- this.$root.$data.os.api('posts/polls/vote', {
+ (this as any).api('posts/polls/vote', {
post_id: this.post.id,
choice: id
}).then(() => {
diff --git a/src/web/app/common/views/components/post-menu.vue b/src/web/app/common/views/components/post-menu.vue
index 7a33360f60..e14d67fc8d 100644
--- a/src/web/app/common/views/components/post-menu.vue
+++ b/src/web/app/common/views/components/post-menu.vue
@@ -48,7 +48,7 @@ export default Vue.extend({
},
methods: {
pin() {
- this.$root.$data.os.api('i/pin', {
+ (this as any).api('i/pin', {
post_id: this.post.id
}).then(() => {
this.$destroy();
diff --git a/src/web/app/common/views/components/reaction-picker.vue b/src/web/app/common/views/components/reaction-picker.vue
index 0446d7b18e..f3731cd632 100644
--- a/src/web/app/common/views/components/reaction-picker.vue
+++ b/src/web/app/common/views/components/reaction-picker.vue
@@ -68,7 +68,7 @@ export default Vue.extend({
},
methods: {
react(reaction) {
- this.$root.$data.os.api('posts/reactions/create', {
+ (this as any).api('posts/reactions/create', {
post_id: this.post.id,
reaction: reaction
}).then(() => {
diff --git a/src/web/app/common/views/components/signin.vue b/src/web/app/common/views/components/signin.vue
index 989c017054..31243e99a1 100644
--- a/src/web/app/common/views/components/signin.vue
+++ b/src/web/app/common/views/components/signin.vue
@@ -28,7 +28,7 @@ export default Vue.extend({
},
methods: {
onUsernameChange() {
- this.$root.$data.os.api('users/show', {
+ (this as any).api('users/show', {
username: this.username
}).then(user => {
this.user = user;
@@ -37,7 +37,7 @@ export default Vue.extend({
onSubmit() {
this.signing = true;
- this.$root.$data.os.api('signin', {
+ (this as any).api('signin', {
username: this.username,
password: this.password,
token: this.user && this.user.two_factor_enabled ? this.token : undefined
diff --git a/src/web/app/common/views/components/signup.vue b/src/web/app/common/views/components/signup.vue
index 34d17ef0ea..1fdc49a181 100644
--- a/src/web/app/common/views/components/signup.vue
+++ b/src/web/app/common/views/components/signup.vue
@@ -88,7 +88,7 @@ export default Vue.extend({
this.usernameState = 'wait';
- this.$root.$data.os.api('username/available', {
+ (this as any).api('username/available', {
username: this.username
}).then(result => {
this.usernameState = result.available ? 'ok' : 'unavailable';
@@ -115,12 +115,12 @@ export default Vue.extend({
this.passwordRetypeState = this.password == this.retypedPassword ? 'match' : 'not-match';
},
onSubmit() {
- this.$root.$data.os.api('signup', {
+ (this as any).api('signup', {
username: this.username,
password: this.password,
'g-recaptcha-response': (window as any).grecaptcha.getResponse()
}).then(() => {
- this.$root.$data.os.api('signin', {
+ (this as any).api('signin', {
username: this.username,
password: this.password
}).then(() => {
diff --git a/src/web/app/common/views/components/stream-indicator.vue b/src/web/app/common/views/components/stream-indicator.vue
index 00bd58c1f9..c1c0672e48 100644
--- a/src/web/app/common/views/components/stream-indicator.vue
+++ b/src/web/app/common/views/components/stream-indicator.vue
@@ -26,10 +26,10 @@ export default Vue.extend({
};
},
created() {
- this.stream = this.$root.$data.os.stream.borrow();
+ this.stream = (this as any).os.stream.borrow();
- this.$root.$data.os.stream.on('connected', this.onConnected);
- this.$root.$data.os.stream.on('disconnected', this.onDisconnected);
+ (this as any).os.stream.on('connected', this.onConnected);
+ (this as any).os.stream.on('disconnected', this.onDisconnected);
this.$nextTick(() => {
if (this.stream.state == 'connected') {
@@ -38,12 +38,12 @@ export default Vue.extend({
});
},
beforeDestroy() {
- this.$root.$data.os.stream.off('connected', this.onConnected);
- this.$root.$data.os.stream.off('disconnected', this.onDisconnected);
+ (this as any).os.stream.off('connected', this.onConnected);
+ (this as any).os.stream.off('disconnected', this.onDisconnected);
},
methods: {
onConnected() {
- this.stream = this.$root.$data.os.stream.borrow();
+ this.stream = (this as any).os.stream.borrow();
setTimeout(() => {
anime({
diff --git a/src/web/app/common/views/components/uploader.vue b/src/web/app/common/views/components/uploader.vue
index 21f92caabf..6367b69973 100644
--- a/src/web/app/common/views/components/uploader.vue
+++ b/src/web/app/common/views/components/uploader.vue
@@ -50,7 +50,7 @@ export default Vue.extend({
reader.readAsDataURL(file);
const data = new FormData();
- data.append('i', this.$root.$data.os.i.token);
+ data.append('i', (this as any).os.i.token);
data.append('file', file);
if (folder) data.append('folder_id', folder);
diff --git a/src/web/app/common/views/components/widgets/photo-stream.vue b/src/web/app/common/views/components/widgets/photo-stream.vue
index afbdc2162c..4d6b660696 100644
--- a/src/web/app/common/views/components/widgets/photo-stream.vue
+++ b/src/web/app/common/views/components/widgets/photo-stream.vue
@@ -26,12 +26,12 @@ export default define({
};
},
mounted() {
- 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('drive_file_created', this.onDriveFileCreated);
- this.$root.$data.os.api('drive/stream', {
+ (this as any).api('drive/stream', {
type: 'image/*',
limit: 9
}).then(images => {
@@ -41,7 +41,7 @@ export default define({
},
beforeDestroy() {
this.connection.off('drive_file_created', this.onDriveFileCreated);
- this.$root.$data.os.stream.dispose(this.connectionId);
+ (this as any).os.stream.dispose(this.connectionId);
},
methods: {
onDriveFileCreated(file) {
diff --git a/src/web/app/common/views/components/widgets/slideshow.vue b/src/web/app/common/views/components/widgets/slideshow.vue
index c24e3003c4..a200aa061d 100644
--- a/src/web/app/common/views/components/widgets/slideshow.vue
+++ b/src/web/app/common/views/components/widgets/slideshow.vue
@@ -89,7 +89,7 @@ export default define({
fetch() {
this.fetching = true;
- this.$root.$data.os.api('drive/files', {
+ (this as any).api('drive/files', {
folder_id: this.props.folder,
type: 'image/*',
limit: 100
@@ -102,7 +102,7 @@ export default define({
});
},
choose() {
- this.$root.$data.api.chooseDriveFolder().then(folder => {
+ (this as any).apis.chooseDriveFolder().then(folder => {
this.props.folder = folder ? folder.id : null;
this.fetch();
});