diff --git a/src/web/app/mobile/tags/page/home.tag b/src/web/app/mobile/tags/page/home.tag index c93803fb021b2f8a84b79e84b83ab48cf96dbdd0..68178aa991f5db3dbb506ac4a3c73e092588a93d 100644 --- a/src/web/app/mobile/tags/page/home.tag +++ b/src/web/app/mobile/tags/page/home.tag @@ -12,6 +12,7 @@ this.mixin('ui-progress'); this.mixin('stream'); this.mixin('get-post-summary'); + this.mixin('open-post-form'); this.unreadCount = 0; @@ -19,6 +20,10 @@ document.title = 'Misskey' this.ui.trigger('title', '<i class="fa fa-home"></i>ホーム'); + this.ui.trigger('func', () => { + this.openPostForm(); + }, 'pencil'); + this.Progress.start(); this.stream.on('post', this.onStreamPost); diff --git a/src/web/app/mobile/tags/ui-header.tag b/src/web/app/mobile/tags/ui-header.tag index b6d2e28bebefa36c066cf35c52f78f4de25dae31..265f12fd453707341e1e220800e47c6182e76d42 100644 --- a/src/web/app/mobile/tags/ui-header.tag +++ b/src/web/app/mobile/tags/ui-header.tag @@ -5,7 +5,7 @@ <div class="content"> <button class="nav" onclick={ parent.toggleDrawer }><i class="fa fa-bars"></i></button> <h1 ref="title">Misskey</h1> - <button class="post" onclick={ post }><i class="fa fa-pencil"></i></button> + <button if={ func } onclick={ func }><i class="fa fa-{ funcIcon }"></i></button> </div> </div> <style> @@ -74,7 +74,7 @@ > i transition all 0.2s ease - > .post + > button:last-child display block position absolute top 0 @@ -89,14 +89,27 @@ </style> <script> this.mixin('ui'); - this.mixin('open-post-form'); - this.ui.on('title', title => { - if (this.refs.title) this.refs.title.innerHTML = title; + this.func = null; + this.funcIcon = null; + + this.on('unmount', () => { + this.ui.off('title', this.setTitle); + this.ui.off('func', this.setFunc); }); - this.post = () => { - this.openPostForm(); + this.setTitle = title => { + this.refs.title.innerHTML = title; + }; + + this.setFunc = (fn, icon) => { + this.update({ + func: fn, + funcIcon: icon + }); }; + + this.ui.on('title', this.setTitle); + this.ui.on('func', this.setFunc); </script> </mk-ui-header>