summaryrefslogtreecommitdiff
path: root/src/web/app/mobile/mixins.js
blob: 98601a10721a2d6514517ba88b0a891736409807 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const riot = require('riot');

module.exports = me => {
	if (me) {
		require('./scripts/stream')(me);
	}

	require('./scripts/ui');

	riot.mixin('open-post-form', {
		openPostForm: opts => {
			const app = document.getElementById('app');
			app.style.display = 'none';

			function recover() {
				app.style.display = 'block';
			}

			const form = riot.mount(document.body.appendChild(document.createElement('mk-post-form')), opts)[0];
			form
				.on('cancel', recover)
				.on('post', recover);
		}
	});
};