This commit is contained in:
syuilo
2017-12-21 04:01:44 +09:00
parent c378e5fc94
commit eaf0d5e637
9 changed files with 172 additions and 27 deletions

View File

@@ -23,7 +23,7 @@ export default (mios: MiOS) => {
route('/i/settings/authorized-apps', settingsAuthorizedApps);
route('/post/new', newPost);
route('/post::post', post);
route('/search::query', search);
route('/search', search);
route('/:user', user.bind(null, 'overview'));
route('/:user/graphs', user.bind(null, 'graphs'));
route('/:user/followers', userFollowers);
@@ -83,7 +83,7 @@ export default (mios: MiOS) => {
function search(ctx) {
const el = document.createElement('mk-search-page');
el.setAttribute('query', ctx.params.query);
el.setAttribute('query', ctx.querystring.substr(2));
mount(el);
}

View File

@@ -15,6 +15,8 @@
width calc(100% - 32px)
</style>
<script>
import parse from '../../common/scripts/parse-search-query';
this.mixin('api');
this.max = 30;
@@ -24,9 +26,7 @@
this.withMedia = this.opts.withMedia;
this.init = new Promise((res, rej) => {
this.api('posts/search', {
query: this.query
}).then(posts => {
this.api('posts/search', parse(this.query)).then(posts => {
res(posts);
this.trigger('loaded');
});

View File

@@ -413,7 +413,7 @@
this.search = () => {
const query = window.prompt('%i18n:mobile.tags.mk-ui-nav.search%');
if (query == null || query == '') return;
this.page('/search:' + query);
this.page('/search?q=' + encodeURIComponent(query));
};
</script>
</mk-ui-nav>