From d9e90e97f811e48cefa81285911b26501f9aff87 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 18 Feb 2017 08:37:30 +0900 Subject: [PATCH] :v: --- src/web/app/mobile/mixins.js | 23 +++++++++++++++++++++++ src/web/app/mobile/mixins.ls | 19 ------------------- src/web/app/mobile/script.js | 2 +- 3 files changed, 24 insertions(+), 20 deletions(-) create mode 100644 src/web/app/mobile/mixins.js delete mode 100644 src/web/app/mobile/mixins.ls diff --git a/src/web/app/mobile/mixins.js b/src/web/app/mobile/mixins.js new file mode 100644 index 000000000..6d1626007 --- /dev/null +++ b/src/web/app/mobile/mixins.js @@ -0,0 +1,23 @@ +const riot = require('riot'); + +module.exports = me => { + if (me) { + require('./scripts/stream.ls')(me); + } + + require('./scripts/ui.ls'); + + riot.mixin('open-post-form', { + openPostForm: opts => { + const app = document.getElementById('app'); + app.style.display = 'none'; + const form = riot.mount(document.body.appendChild(document.createElement('mk-post-form')), opts)[0]; + function recover() { + app.style.display = 'block'; + } + form + .on('cancel', recover) + .on('post', recover); + } + }); +}; diff --git a/src/web/app/mobile/mixins.ls b/src/web/app/mobile/mixins.ls deleted file mode 100644 index 902774f91..000000000 --- a/src/web/app/mobile/mixins.ls +++ /dev/null @@ -1,19 +0,0 @@ -riot = require \riot - -module.exports = (me) ~> - if me? - (require './scripts/stream.ls') me - - require './scripts/ui.ls' - - riot.mixin \open-post-form do - open-post-form: (opts) -> - app = document.get-element-by-id \app - app.style.display = \none - form = document.body.append-child document.create-element \mk-post-form - form = riot.mount form, opts .0 - form.on \cancel recover - form.on \post recover - - function recover - app.style.display = \block diff --git a/src/web/app/mobile/script.js b/src/web/app/mobile/script.js index e22b4b643..db4bff450 100644 --- a/src/web/app/mobile/script.js +++ b/src/web/app/mobile/script.js @@ -4,7 +4,7 @@ require('./tags'); const boot = require('../boot.js'); -const mixins = require('./mixins.ls'); +const mixins = require('./mixins'); const route = require('./router.ls'); /**