summaryrefslogtreecommitdiff
path: root/src/web/app/common/scripts
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2016-12-30 11:57:17 +0900
committersyuilo <syuilotan@yahoo.co.jp>2016-12-30 11:57:17 +0900
commitf844a47f1deb885af733220bdd018fb3966c4039 (patch)
treef1a1c46d7cdae8556a6b6104b3e9bf21bd3c82af /src/web/app/common/scripts
parent#4 (diff)
downloadsharkey-f844a47f1deb885af733220bdd018fb3966c4039.tar.gz
sharkey-f844a47f1deb885af733220bdd018fb3966c4039.tar.bz2
sharkey-f844a47f1deb885af733220bdd018fb3966c4039.zip
Add nya filter
Diffstat (limited to 'src/web/app/common/scripts')
-rw-r--r--src/web/app/common/scripts/generate-default-userdata.ls1
-rw-r--r--src/web/app/common/scripts/i.ls2
-rw-r--r--src/web/app/common/scripts/text-compiler.js13
3 files changed, 15 insertions, 1 deletions
diff --git a/src/web/app/common/scripts/generate-default-userdata.ls b/src/web/app/common/scripts/generate-default-userdata.ls
index de03e96151..c13d221bb9 100644
--- a/src/web/app/common/scripts/generate-default-userdata.ls
+++ b/src/web/app/common/scripts/generate-default-userdata.ls
@@ -22,6 +22,7 @@ module.exports = ~>
data =
cache: true
debug: false
+ nya: true
home: home-data
return data
diff --git a/src/web/app/common/scripts/i.ls b/src/web/app/common/scripts/i.ls
index 5f3c016f8a..888ef194d0 100644
--- a/src/web/app/common/scripts/i.ls
+++ b/src/web/app/common/scripts/i.ls
@@ -14,3 +14,5 @@ module.exports = (me) ->
if data?
Object.assign me, data
me.trigger \updated
+
+ me: me
diff --git a/src/web/app/common/scripts/text-compiler.js b/src/web/app/common/scripts/text-compiler.js
index 9915e3335f..41f4966682 100644
--- a/src/web/app/common/scripts/text-compiler.js
+++ b/src/web/app/common/scripts/text-compiler.js
@@ -1,3 +1,5 @@
+const riot = require('riot');
+
module.exports = function(tokens, canBreak, escape) {
if (canBreak == null) {
canBreak = true;
@@ -5,7 +7,10 @@ module.exports = function(tokens, canBreak, escape) {
if (escape == null) {
escape = true;
}
- return tokens.map(function(token) {
+
+ const me = riot.mixin('i').me;
+
+ let text = tokens.map(function(token) {
switch (token.type) {
case 'text':
if (escape) {
@@ -27,4 +32,10 @@ module.exports = function(tokens, canBreak, escape) {
return '<a>' + token.content + '</a>';
}
}).join('');
+
+ if (me && me.data && me.data.nya) {
+ text = text.replace(/な/g, 'にゃ');
+ }
+
+ return text;
}