From 6ef28214df4899043077dc3d7efa4cf1bfaf9a72 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 5 Aug 2018 19:36:19 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=B2=E3=81=A8=E3=81=A4=E3=81=AE=E6=8A=95?= =?UTF-8?q?=E7=A8=BF=E5=86=85=E3=81=A7=E4=BD=BF=E3=81=88=E3=82=8B=E3=81=9D?= =?UTF-8?q?=E3=82=8C=E3=81=9E=E3=82=8C=E3=81=AE=E5=8B=95=E3=81=8D=E3=81=AE?= =?UTF-8?q?=E3=81=82=E3=82=8BMFM=E6=A7=8B=E6=96=87=E3=81=AF3=E5=9B=9E?= =?UTF-8?q?=E3=81=BE=E3=81=A7=E3=81=AB=E5=88=B6=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../views/components/misskey-flavored-markdown.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/client/app/common/views/components/misskey-flavored-markdown.ts b/src/client/app/common/views/components/misskey-flavored-markdown.ts index 69e727d6f3..2a349c6e5f 100644 --- a/src/client/app/common/views/components/misskey-flavored-markdown.ts +++ b/src/client/app/common/views/components/misskey-flavored-markdown.ts @@ -41,6 +41,9 @@ export default Vue.component('misskey-flavored-markdown', { ast = this.ast; } + let bigCount = 0; + let motionCount = 0; + // Parse ast to DOM const els = flatten(ast.map(token => { switch (token.type) { @@ -62,12 +65,14 @@ export default Vue.component('misskey-flavored-markdown', { } case 'big': { + bigCount++; const isLong = length(token.big) > 10; + const isMany = bigCount > 3; return (createElement as any)('strong', { attrs: { - style: 'display: inline-block; font-size: 200%;' + style: `display: inline-block; font-size: ${ isMany ? '100%' : '200%' };` }, - directives: [this.$store.state.settings.disableAnimatedMfm || isLong ? {} : { + directives: [this.$store.state.settings.disableAnimatedMfm || isLong || isMany ? {} : { name: 'animate-css', value: { classes: 'tada', iteration: 'infinite' } }] @@ -75,12 +80,14 @@ export default Vue.component('misskey-flavored-markdown', { } case 'motion': { + motionCount++; const isLong = length(token.motion) > 10; + const isMany = motionCount > 3; return (createElement as any)('span', { attrs: { style: 'display: inline-block;' }, - directives: [this.$store.state.settings.disableAnimatedMfm || isLong ? {} : { + directives: [this.$store.state.settings.disableAnimatedMfm || isLong || isMany ? {} : { name: 'animate-css', value: { classes: 'rubberBand', iteration: 'infinite' } }]