2017-02-18 00:37:30 +01:00
|
|
|
const riot = require('riot');
|
|
|
|
|
|
|
|
module.exports = me => {
|
|
|
|
if (me) {
|
2017-02-18 05:23:23 +01:00
|
|
|
require('./scripts/stream')(me);
|
2017-02-18 00:37:30 +01:00
|
|
|
}
|
|
|
|
|
2017-02-18 05:24:39 +01:00
|
|
|
require('./scripts/ui');
|
2017-02-18 00:37:30 +01:00
|
|
|
|
|
|
|
riot.mixin('open-post-form', {
|
|
|
|
openPostForm: opts => {
|
|
|
|
const app = document.getElementById('app');
|
|
|
|
app.style.display = 'none';
|
2017-02-18 05:26:27 +01:00
|
|
|
|
2017-02-18 00:37:30 +01:00
|
|
|
function recover() {
|
|
|
|
app.style.display = 'block';
|
|
|
|
}
|
2017-02-18 05:26:27 +01:00
|
|
|
|
|
|
|
const form = riot.mount(document.body.appendChild(document.createElement('mk-post-form')), opts)[0];
|
2017-02-18 00:37:30 +01:00
|
|
|
form
|
|
|
|
.on('cancel', recover)
|
|
|
|
.on('post', recover);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|