1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-16 23:58:54 +09:00
This commit is contained in:
syuilo 2018-02-22 23:53:07 +09:00
parent e98626dbbc
commit b5068aae05
14 changed files with 102 additions and 126 deletions

View File

@ -67,6 +67,16 @@ export default class MiOS extends EventEmitter {
private isMetaFetching = false; private isMetaFetching = false;
public app: Vue;
public new(vm, props) {
const w = new vm({
parent: this.app,
propsData: props
}).$mount();
document.body.appendChild(w.$el);
}
/** /**
* A signing user * A signing user
*/ */

View File

@ -376,11 +376,9 @@ export default Vue.extend({
}, },
newWindow(folder) { newWindow(folder) {
document.body.appendChild(new MkDriveWindow({ (this as any).os.new(MkDriveWindow, {
propsData: { folder: folder
folder: folder });
}
}).$mount().$el);
}, },
move(target) { move(target) {

View File

@ -39,11 +39,9 @@ export default Vue.extend({
}, },
onClick() { onClick() {
document.body.appendChild(new MkImagesImageDialog({ (this as any).os.new(MkImagesImageDialog, {
propsData: { image: this.image
image: this.image });
}
}).$mount().$el);
} }
} }
}); });

View File

@ -12,11 +12,9 @@ import MkMessagingRoomWindow from './messaging-room-window.vue';
export default Vue.extend({ export default Vue.extend({
methods: { methods: {
navigate(user) { navigate(user) {
document.body.appendChild(new MkMessagingRoomWindow({ (this as any).os.new(MkMessagingRoomWindow, {
propsData: { user: user
user: user });
}
}).$mount().$el);
} }
} }
}); });

View File

@ -148,34 +148,26 @@ export default Vue.extend({
}); });
}, },
reply() { reply() {
document.body.appendChild(new MkPostFormWindow({ (this as any).os.new(MkPostFormWindow, {
propsData: { reply: this.p
reply: this.p });
}
}).$mount().$el);
}, },
repost() { repost() {
document.body.appendChild(new MkRepostFormWindow({ (this as any).os.new(MkRepostFormWindow, {
propsData: { post: this.p
post: this.p });
}
}).$mount().$el);
}, },
react() { react() {
document.body.appendChild(new MkReactionPicker({ (this as any).os.new(MkReactionPicker, {
propsData: { source: this.$refs.reactButton,
source: this.$refs.reactButton, post: this.p
post: this.p });
}
}).$mount().$el);
}, },
menu() { menu() {
document.body.appendChild(new MkPostMenu({ (this as any).os.new(MkPostMenu, {
propsData: { source: this.$refs.menuButton,
source: this.$refs.menuButton, post: this.p
post: this.p });
}
}).$mount().$el);
} }
} }
}); });

View File

@ -186,34 +186,26 @@ export default Vue.extend({
} }
}, },
reply() { reply() {
document.body.appendChild(new MkPostFormWindow({ (this as any).os.new(MkPostFormWindow, {
propsData: { reply: this.p
reply: this.p });
}
}).$mount().$el);
}, },
repost() { repost() {
document.body.appendChild(new MkRepostFormWindow({ (this as any).os.new(MkRepostFormWindow, {
propsData: { post: this.p
post: this.p });
}
}).$mount().$el);
}, },
react() { react() {
document.body.appendChild(new MkReactionPicker({ (this as any).os.new(MkReactionPicker, {
propsData: { source: this.$refs.reactButton,
source: this.$refs.reactButton, post: this.p
post: this.p });
}
}).$mount().$el);
}, },
menu() { menu() {
document.body.appendChild(new MkPostMenu({ (this as any).os.new(MkPostMenu, {
propsData: { source: this.$refs.menuButton,
source: this.$refs.menuButton, post: this.p
post: this.p });
}
}).$mount().$el);
}, },
onKeydown(e) { onKeydown(e) {
let shouldBeCancel = true; let shouldBeCancel = true;

View File

@ -70,11 +70,11 @@ export default Vue.extend({
}, },
drive() { drive() {
this.close(); this.close();
document.body.appendChild(new MkDriveWindow().$mount().$el); (this as any).os.new(MkDriveWindow);
}, },
settings() { settings() {
this.close(); this.close();
document.body.appendChild(new MkSettingsWindow().$mount().$el); (this as any).os.new(MkSettingsWindow);
} }
} }
}); });

View File

@ -79,7 +79,7 @@ export default Vue.extend({
}, },
messaging() { messaging() {
document.body.appendChild(new MkMessagingWindow().$mount().$el); (this as any).os.new(MkMessagingWindow);
} }
} }
}); });

View File

@ -17,11 +17,9 @@ export default define({
}).extend({ }).extend({
methods: { methods: {
navigate(user) { navigate(user) {
document.body.appendChild(new MkMessagingRoomWindow({ (this as any).os.new(MkMessagingRoomWindow, {
propsData: { user: user
user: user });
}
}).$mount().$el);
}, },
func() { func() {
if (this.props.design == 1) { if (this.props.design == 1) {

View File

@ -36,21 +36,15 @@ export default Vue.extend({
}, },
methods: { methods: {
showFollowing() { showFollowing() {
document.body.appendChild(new MkFollowingWindow({ (this as any).os.new(MkFollowingWindow, {
parent: this, user: this.user
propsData: { });
user: this.user
}
}).$mount().$el);
}, },
showFollowers() { showFollowers() {
document.body.appendChild(new MkFollowersWindow({ (this as any).os.new(MkFollowersWindow, {
parent: this, user: this.user
propsData: { });
user: this.user
}
}).$mount().$el);
}, },
mute() { mute() {

View File

@ -87,8 +87,26 @@ export default (callback: (launch: (api: (os: MiOS) => API) => [Vue, MiOS]) => v
// アプリ基底要素マウント // アプリ基底要素マウント
document.body.innerHTML = '<div id="app"></div>'; document.body.innerHTML = '<div id="app"></div>';
const app = new Vue({
router: new VueRouter({
mode: 'history'
}),
created() {
this.$watch('os.i', i => {
// キャッシュ更新
localStorage.setItem('me', JSON.stringify(i));
}, {
deep: true
});
},
render: createEl => createEl(App)
});
os.app = app;
const launch = (api: (os: MiOS) => API) => { const launch = (api: (os: MiOS) => API) => {
os.apis = api(os); os.apis = api(os);
Vue.mixin({ Vue.mixin({
data() { data() {
return { return {
@ -99,20 +117,8 @@ export default (callback: (launch: (api: (os: MiOS) => API) => [Vue, MiOS]) => v
} }
}); });
const app = new Vue({ // マウント
router: new VueRouter({ app.$mount('#app');
mode: 'history'
}),
created() {
this.$watch('os.i', i => {
// キャッシュ更新
localStorage.setItem('me', JSON.stringify(i));
}, {
deep: true
});
},
render: createEl => createEl(App)
}).$mount('#app');
return [app, os] as [Vue, MiOS]; return [app, os] as [Vue, MiOS];
}; };

View File

@ -154,22 +154,18 @@ export default Vue.extend({
}); });
}, },
react() { react() {
document.body.appendChild(new MkReactionPicker({ (this as any).os.new(MkReactionPicker, {
propsData: { source: this.$refs.reactButton,
source: this.$refs.reactButton, post: this.p,
post: this.p, compact: true
compact: true });
}
}).$mount().$el);
}, },
menu() { menu() {
document.body.appendChild(new MkPostMenu({ (this as any).os.new(MkPostMenu, {
propsData: { source: this.$refs.menuButton,
source: this.$refs.menuButton, post: this.p,
post: this.p, compact: true
compact: true });
}
}).$mount().$el);
} }
} }
}); });

View File

@ -169,22 +169,18 @@ export default Vue.extend({
}); });
}, },
react() { react() {
document.body.appendChild(new MkReactionPicker({ (this as any).os.new(MkReactionPicker, {
propsData: { source: this.$refs.reactButton,
source: this.$refs.reactButton, post: this.p,
post: this.p, compact: true
compact: true });
}
}).$mount().$el);
}, },
menu() { menu() {
document.body.appendChild(new MkPostMenu({ (this as any).os.new(MkPostMenu, {
propsData: { source: this.$refs.menuButton,
source: this.$refs.menuButton, post: this.p,
post: this.p, compact: true
compact: true });
}
}).$mount().$el);
} }
} }
}); });

View File

@ -53,11 +53,9 @@ export default Vue.extend({
id: notification.id id: notification.id
}); });
document.body.appendChild(new MkNotify({ (this as any).os.new(MkNotify, {
propsData: { notification
notification });
}
}).$mount().$el);
} }
} }
}); });