diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/app/desktop/views/components/post-form.vue | 12 | ||||
| -rw-r--r-- | src/client/app/desktop/views/widgets/post-form.vue | 13 | ||||
| -rw-r--r-- | src/client/app/mobile/views/components/post-form.vue | 46 |
3 files changed, 62 insertions, 9 deletions
diff --git a/src/client/app/desktop/views/components/post-form.vue b/src/client/app/desktop/views/components/post-form.vue index 8eec677b06..ad829065b0 100644 --- a/src/client/app/desktop/views/components/post-form.vue +++ b/src/client/app/desktop/views/components/post-form.vue @@ -86,11 +86,19 @@ export default Vue.extend({ }, placeholder(): string { + const x = [ + '%i18n:common.note-placeholders.a%', + '%i18n:common.note-placeholders.b%', + '%i18n:common.note-placeholders.c%', + '%i18n:common.note-placeholders.d%', + '%i18n:common.note-placeholders.e%' + ][Math.floor(Math.random() * 5)]; + return this.renote ? '%i18n:@quote-placeholder%' : this.reply ? '%i18n:@reply-placeholder%' - : '%i18n:@note-placeholder%'; + : x; }, submitText(): string { @@ -98,7 +106,7 @@ export default Vue.extend({ ? '%i18n:@renote%' : this.reply ? '%i18n:@reply%' - : '%i18n:@note%'; + : '%i18n:@submit%'; }, canPost(): boolean { diff --git a/src/client/app/desktop/views/widgets/post-form.vue b/src/client/app/desktop/views/widgets/post-form.vue index 69b21ad37a..fb4adf70b8 100644 --- a/src/client/app/desktop/views/widgets/post-form.vue +++ b/src/client/app/desktop/views/widgets/post-form.vue @@ -3,7 +3,7 @@ <template v-if="props.design == 0"> <p class="title">%fa:pencil-alt%%i18n:@title%</p> </template> - <textarea :disabled="posting" v-model="text" @keydown="onKeydown" placeholder="%i18n:@placeholder%"></textarea> + <textarea :disabled="posting" v-model="text" @keydown="onKeydown" :placeholder="placeholder"></textarea> <button @click="post" :disabled="posting">%i18n:@note%</button> </div> </template> @@ -22,6 +22,17 @@ export default define({ text: '' }; }, + computed: { + placeholder(): string { + return [ + '%i18n:common.note-placeholders.a%', + '%i18n:common.note-placeholders.b%', + '%i18n:common.note-placeholders.c%', + '%i18n:common.note-placeholders.d%', + '%i18n:common.note-placeholders.e%' + ][Math.floor(Math.random() * 5)]; + } + }, methods: { func() { if (this.props.design == 1) { diff --git a/src/client/app/mobile/views/components/post-form.vue b/src/client/app/mobile/views/components/post-form.vue index f5badb48cc..61f0462659 100644 --- a/src/client/app/mobile/views/components/post-form.vue +++ b/src/client/app/mobile/views/components/post-form.vue @@ -5,11 +5,7 @@ <div> <span class="text-count" :class="{ over: text.length > 1000 }">{{ 1000 - text.length }}</span> <span class="geo" v-if="geo">%fa:map-marker-alt%</span> - <button class="submit" :disabled="posting" @click="post"> - <template v-if="reply">%i18n:@reply%</template> - <template v-else-if="renote">%i18n:@renote%</template> - <template v-else>%i18n:@submit%</template> - </button> + <button class="submit" :disabled="posting" @click="post">{{ submitText }}</button> </div> </header> <div class="form"> @@ -20,7 +16,7 @@ <a @click="addVisibleUser">+%i18n:@add-visible-user%</a> </div> <input v-show="useCw" v-model="cw" placeholder="%i18n:@cw-placeholder%"> - <textarea v-model="text" ref="text" :disabled="posting" :placeholder="reply ? '%i18n:@reply-placeholder%' : renote ? '%i18n:@renote-placeholder%' : '%i18n:@note-placeholder%'"></textarea> + <textarea v-model="text" ref="text" :disabled="posting" :placeholder="placeholder"></textarea> <div class="attaches" v-show="files.length != 0"> <x-draggable class="files" :list="files" :options="{ animation: 150 }"> <div class="file" v-for="file in files" :key="file.id"> @@ -74,6 +70,44 @@ export default Vue.extend({ }; }, + computed: { + draftId(): string { + return this.renote + ? 'renote:' + this.renote.id + : this.reply + ? 'reply:' + this.reply.id + : 'note'; + }, + + placeholder(): string { + const x = [ + '%i18n:common.note-placeholders.a%', + '%i18n:common.note-placeholders.b%', + '%i18n:common.note-placeholders.c%', + '%i18n:common.note-placeholders.d%', + '%i18n:common.note-placeholders.e%' + ][Math.floor(Math.random() * 5)]; + + return this.renote + ? '%i18n:@quote-placeholder%' + : this.reply + ? '%i18n:@reply-placeholder%' + : x; + }, + + submitText(): string { + return this.renote + ? '%i18n:@renote%' + : this.reply + ? '%i18n:@reply%' + : '%i18n:@submit%'; + }, + + canPost(): boolean { + return !this.posting && (this.text.length != 0 || this.files.length != 0 || this.poll || this.renote); + } + }, + mounted() { if (this.reply && this.reply.user.host != null) { this.text = `@${this.reply.user.username}@${this.reply.user.host} `; |