From 90959a8347cfe07606dab5edaa474b0aabbb31f8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 18 Feb 2017 16:55:18 +0900 Subject: [PATCH] :v: --- src/web/app/boot.js | 2 +- src/web/app/common/mixins.js | 48 ++++++++++++++++++++++++++++++++++++ src/web/app/common/mixins.ls | 37 --------------------------- 3 files changed, 49 insertions(+), 38 deletions(-) create mode 100644 src/web/app/common/mixins.js delete mode 100644 src/web/app/common/mixins.ls diff --git a/src/web/app/boot.js b/src/web/app/boot.js index a77bdd6dae..75a7086d1c 100644 --- a/src/web/app/boot.js +++ b/src/web/app/boot.js @@ -7,7 +7,7 @@ require('velocity-animate'); const api = require('./common/scripts/api'); const signout = require('./common/scripts/signout'); const generateDefaultUserdata = require('./common/scripts/generate-default-userdata'); -const mixins = require('./common/mixins.ls'); +const mixins = require('./common/mixins'); const checkForUpdate = require('./common/scripts/check-for-update.ls'); require('./common/tags'); diff --git a/src/web/app/common/mixins.js b/src/web/app/common/mixins.js new file mode 100644 index 0000000000..208d0fdf54 --- /dev/null +++ b/src/web/app/common/mixins.js @@ -0,0 +1,48 @@ +const riot = require('riot'); + +module.exports = me => { + const i = me ? me.token : null; + + require('./scripts/i')(me); + + riot.mixin('api', { + api: require('./scripts/api').bind(null, i) + }); + + riot.mixin('cropper', { + Cropper: require('cropperjs') + }); + + riot.mixin('signout', { + signout: require('./scripts/signout') + }); + + riot.mixin('messaging-stream', { + MessagingStreamConnection: require('./scripts/messaging-stream') + }); + + riot.mixin('is-promise', { + isPromise: require('./scripts/is-promise') + }); + + riot.mixin('get-post-summary', { + getPostSummary: require('./scripts/get-post-summary') + }); + + riot.mixin('date-stringify', { + dateStringify: require('./scripts/date-stringify') + }); + + riot.mixin('text', { + analyze: require('../../../common/text/index'), + compile: require('./scripts/text-compiler') + }); + + riot.mixin('get-password-strength', { + getPasswordStrength: require('syuilo-password-strength') + }); + + riot.mixin('ui-progress', { + Progress: require('./scripts/loading.ls') + }); +}; diff --git a/src/web/app/common/mixins.ls b/src/web/app/common/mixins.ls deleted file mode 100644 index c412e3b322..0000000000 --- a/src/web/app/common/mixins.ls +++ /dev/null @@ -1,37 +0,0 @@ -riot = require \riot - -module.exports = (me) ~> - i = if me? then me.token else null - - (require './scripts/i') me - - riot.mixin \api do - api: (require './scripts/api').bind null i - - riot.mixin \cropper do - Cropper: require \cropperjs - - riot.mixin \signout do - signout: require './scripts/signout' - - riot.mixin \messaging-stream do - MessagingStreamConnection: require './scripts/messaging-stream' - - riot.mixin \is-promise do - is-promise: require './scripts/is-promise' - - riot.mixin \get-post-summary do - get-post-summary: require './scripts/get-post-summary' - - riot.mixin \date-stringify do - date-stringify: require './scripts/date-stringify' - - riot.mixin \text do - analyze: require '../../../common/text/index' - compile: require './scripts/text-compiler' - - riot.mixin \get-password-strength do - get-password-strength: require 'syuilo-password-strength' - - riot.mixin \ui-progress do - Progress: require './scripts/loading.ls'