2020-07-22 13:19:23 -07:00
|
|
|
<template>
|
2020-11-10 15:47:44 -08:00
|
|
|
<NotFound v-if="!selectedPronoun"/>
|
2020-11-29 02:03:01 -08:00
|
|
|
<div v-else>
|
2021-08-18 08:01:20 -07:00
|
|
|
<h2 class="d-flex justify-content-between">
|
|
|
|
<span>
|
|
|
|
<Icon v="tag"/>
|
2021-12-02 08:18:25 -08:00
|
|
|
<T>pronouns.intro</T><T>quotation.colon</T>
|
2021-08-18 08:01:20 -07:00
|
|
|
</span>
|
|
|
|
<div v-if="nameOptions.length > 1" class="btn-group" role="group">
|
|
|
|
<button :class="['btn btn-sm', counterSpeed === 0 ? 'btn-primary' : 'btn-outline-primary']" @click="counterPause"><Icon v="pause"/></button>
|
|
|
|
<button :class="['btn btn-sm', counterSpeed === 3000 ? 'btn-primary' : 'btn-outline-primary']" @click="counterSlow"><Icon v="play"/></button>
|
|
|
|
<button :class="['btn btn-sm', counterSpeed === 1000 ? 'btn-primary' : 'btn-outline-primary']" @click="counterFast"><Icon v="forward"/></button>
|
|
|
|
</div>
|
2020-09-11 03:17:29 -07:00
|
|
|
</h2>
|
2020-07-22 13:19:23 -07:00
|
|
|
|
|
|
|
<section>
|
|
|
|
<div class="alert alert-primary">
|
|
|
|
<h2 class="text-center mb-0">
|
2020-12-10 07:23:39 -08:00
|
|
|
<template v-if="nameOptions.length === 1">
|
2021-11-15 12:11:25 -08:00
|
|
|
<Twemoji><strong>{{ selectedPronoun.name(glue) }}</strong><small v-if="selectedPronoun.smallForm">/{{selectedPronoun.morphemes[selectedPronoun.smallForm]}}</small></Twemoji>
|
2020-12-10 07:23:39 -08:00
|
|
|
</template>
|
2020-10-12 14:41:32 -07:00
|
|
|
<template v-else>
|
|
|
|
<template v-for="(nameOption, i) in nameOptions">
|
|
|
|
<nuxt-link :to="'/' + addSlash(nameOption)">
|
2021-11-15 12:11:25 -08:00
|
|
|
<Twemoji>
|
|
|
|
<strong>
|
|
|
|
<Spelling :text="nameOption" escape/>
|
|
|
|
</strong>
|
|
|
|
</Twemoji>
|
2020-10-12 14:41:32 -07:00
|
|
|
</nuxt-link>
|
2021-03-19 12:34:34 -07:00
|
|
|
<span v-if="i < nameOptions.length - 1"><Spelling :text="glue"/></span>
|
2020-10-12 14:41:32 -07:00
|
|
|
</template>
|
|
|
|
</template>
|
2020-07-22 13:19:23 -07:00
|
|
|
</h2>
|
2020-11-10 15:47:44 -08:00
|
|
|
<p class="h6 small text-center mb-0 mt-2" v-if="selectedPronoun.description">
|
2020-07-22 13:19:23 -07:00
|
|
|
<em>
|
2021-11-15 12:11:25 -08:00
|
|
|
(<Twemoji><LinkedText escape :text="Array.isArray(selectedPronoun.description)
|
2020-11-10 15:47:44 -08:00
|
|
|
? ($t('pronouns.alt.header') + ': ' + selectedPronoun.description.join(glue))
|
2021-11-15 12:11:25 -08:00
|
|
|
: selectedPronoun.description"/></Twemoji>)
|
2020-07-22 13:19:23 -07:00
|
|
|
</em>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<h2 class="h4">
|
|
|
|
<Icon v="file-signature"/>
|
2021-12-02 08:18:25 -08:00
|
|
|
<T>pronouns.examples</T><T>quotation.colon</T>
|
2020-07-22 13:19:23 -07:00
|
|
|
</h2>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li v-for="example in examples" class="my-1">
|
2020-11-28 07:52:48 -08:00
|
|
|
<Example :example="example" :pronoun="selectedPronoun" :counter="counter" pronunciation/>
|
2020-07-24 11:52:01 -07:00
|
|
|
</li>
|
2020-07-22 13:19:23 -07:00
|
|
|
</ul>
|
|
|
|
</section>
|
|
|
|
|
2020-11-10 15:47:44 -08:00
|
|
|
<section v-if="selectedPronoun.history">
|
2021-05-13 12:36:42 -07:00
|
|
|
<template v-for="part in selectedPronoun.history.replace('\\@', '###').split('@')">
|
2020-12-25 07:05:28 -08:00
|
|
|
<div v-if="part === '__generator__'" class="alert alert-warning">
|
|
|
|
<Icon v="exclamation-triangle"/>
|
|
|
|
<T>pronouns.generated</T>
|
|
|
|
</div>
|
|
|
|
<div v-else class="alert alert-info">
|
|
|
|
<Icon v="info-circle"/>
|
2021-05-13 12:36:42 -07:00
|
|
|
<LinkedText :text="part.replace('###', '@')"/>
|
2020-12-25 07:05:28 -08:00
|
|
|
</div>
|
|
|
|
</template>
|
2020-07-24 11:21:30 -07:00
|
|
|
</section>
|
|
|
|
|
2020-12-25 07:05:28 -08:00
|
|
|
<GrammarTables :selectedPronoun="selectedPronoun" :counter="counter"/>
|
|
|
|
|
2021-12-23 03:36:54 -08:00
|
|
|
<PronounGroup :pronounGroup="pronounGroup"/>
|
2020-10-05 05:57:17 -07:00
|
|
|
|
2021-09-28 12:34:25 -07:00
|
|
|
<Avoiding v-if="isNull"/>
|
|
|
|
|
2020-07-24 05:14:37 -07:00
|
|
|
<section>
|
2020-11-10 15:47:44 -08:00
|
|
|
<Share :title="`${$t('pronouns.intro')}: ${selectedPronoun.name(glue)}`"/>
|
2020-07-24 05:14:37 -07:00
|
|
|
</section>
|
|
|
|
|
2020-12-06 07:12:32 -08:00
|
|
|
<section v-if="Object.values(groupedSources).filter(x => !!x).length">
|
2020-12-10 07:23:39 -08:00
|
|
|
<Literature :pronoun="selectedPronoun" :sources="groupedSources"/>
|
2020-07-22 13:19:23 -07:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<Separator icon="info"/>
|
|
|
|
<section class="mb-0">
|
|
|
|
<h2 class="h4">
|
|
|
|
<Icon v="info-circle"/>
|
2020-11-20 05:41:00 -08:00
|
|
|
<T>home.whatisit</T>
|
2020-07-22 13:19:23 -07:00
|
|
|
</h2>
|
2020-09-28 08:51:26 -07:00
|
|
|
<T>home.about</T>
|
2020-07-22 13:19:23 -07:00
|
|
|
<Homepage align="center"/>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-11-10 15:47:44 -08:00
|
|
|
import { examples, pronouns, getSources, pronounLibrary } from "~/src/data";
|
2020-11-15 05:13:14 -08:00
|
|
|
import {buildPronoun} from "../src/buildPronoun";
|
|
|
|
import {head} from "../src/helpers";
|
2020-11-10 15:47:44 -08:00
|
|
|
import GrammarTables from "../data/pronouns/GrammarTables";
|
2020-10-12 12:26:50 -07:00
|
|
|
import LinkedText from "../components/LinkedText";
|
2020-12-04 13:09:57 -08:00
|
|
|
import {SourceLibrary} from "../src/classes";
|
2020-07-22 13:19:23 -07:00
|
|
|
|
|
|
|
export default {
|
2020-10-12 12:26:50 -07:00
|
|
|
components: {LinkedText, GrammarTables },
|
2020-07-22 13:19:23 -07:00
|
|
|
data() {
|
2021-09-28 12:34:25 -07:00
|
|
|
const key = decodeURIComponent(this.$route.path.substr(1).replace(/\/$/, ''));
|
2020-11-10 15:47:44 -08:00
|
|
|
const selectedPronoun = this.config.pronouns.enabled
|
2021-09-28 12:34:25 -07:00
|
|
|
? buildPronoun(pronouns, key)
|
2020-10-28 08:22:29 -07:00
|
|
|
: null;
|
|
|
|
|
2020-07-22 13:19:23 -07:00
|
|
|
return {
|
2020-10-05 05:57:17 -07:00
|
|
|
examples,
|
2020-11-10 15:47:44 -08:00
|
|
|
pronouns,
|
|
|
|
glue: ' ' + this.$t('pronouns.or') + ' ',
|
2020-07-22 13:19:23 -07:00
|
|
|
|
2020-11-10 15:47:44 -08:00
|
|
|
selectedPronoun,
|
|
|
|
nameOptions: selectedPronoun ? selectedPronoun.nameOptions() : [],
|
|
|
|
pronounGroup: pronounLibrary.find(selectedPronoun),
|
2020-07-26 04:14:25 -07:00
|
|
|
|
|
|
|
counter: 0,
|
2021-08-18 08:01:20 -07:00
|
|
|
counterHandle: null,
|
|
|
|
counterSpeed: 1000,
|
2021-09-28 12:34:25 -07:00
|
|
|
|
|
|
|
isNull: key.startsWith(':'),
|
2020-07-26 04:14:25 -07:00
|
|
|
}
|
|
|
|
},
|
2020-12-04 13:09:57 -08:00
|
|
|
async asyncData({app}) {
|
|
|
|
return {
|
|
|
|
sources: await app.$axios.$get(`/sources`),
|
|
|
|
}
|
|
|
|
},
|
2020-07-26 04:14:25 -07:00
|
|
|
mounted() {
|
|
|
|
if (process.client) {
|
2021-08-18 08:01:20 -07:00
|
|
|
this.counterSlow();
|
2020-07-22 13:19:23 -07:00
|
|
|
}
|
|
|
|
},
|
|
|
|
head() {
|
2020-11-10 15:47:44 -08:00
|
|
|
return this.selectedPronoun ? head({
|
|
|
|
title: `${this.$t('pronouns.intro')}: ${this.selectedPronoun.name(this.glue)}`,
|
2021-12-23 08:56:27 -08:00
|
|
|
description: [
|
|
|
|
this.$t('pronouns.examples', {}, false),
|
|
|
|
this.$t('pronouns.grammarTable', {}, false),
|
|
|
|
this.$t('sources.headerLong', {}, false),
|
|
|
|
].filter(x => !!x).join(', '),
|
2020-10-31 13:33:59 -07:00
|
|
|
banner: `api/banner${this.$route.path.replace(/\/$/, '')}.png`,
|
2020-09-23 12:29:55 -07:00
|
|
|
}) : {};
|
2020-07-22 13:19:23 -07:00
|
|
|
},
|
2020-10-05 05:57:17 -07:00
|
|
|
methods: {
|
|
|
|
addSlash(link) {
|
2020-12-23 05:40:42 -08:00
|
|
|
return link + (['*', `'`].includes(link.substr(link.length - 1)) ? '/' : '');
|
2020-10-05 05:57:17 -07:00
|
|
|
},
|
2021-08-18 08:01:20 -07:00
|
|
|
counterClear() {
|
|
|
|
if (this.counterHandle) {
|
|
|
|
clearInterval(this.counterHandle);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
counterPause() {
|
|
|
|
this.counterSpeed = 0;
|
|
|
|
this.counterClear();
|
|
|
|
},
|
|
|
|
counterSlow() {
|
|
|
|
this.counterSpeed = 3000;
|
|
|
|
this.counterClear();
|
|
|
|
this.counter++;
|
|
|
|
this.counterHandle = setInterval(_ => this.counter++, this.counterSpeed);
|
|
|
|
},
|
|
|
|
counterFast() {
|
|
|
|
this.counterSpeed = 1000;
|
|
|
|
this.counterClear();
|
|
|
|
this.counter++;
|
|
|
|
this.counterHandle = setInterval(_ => this.counter++, this.counterSpeed);
|
|
|
|
},
|
2020-10-05 05:57:17 -07:00
|
|
|
},
|
2020-07-26 06:27:36 -07:00
|
|
|
computed: {
|
2020-12-04 13:09:57 -08:00
|
|
|
sourceLibrary() {
|
|
|
|
return new SourceLibrary(this.sources);
|
2020-07-26 06:27:36 -07:00
|
|
|
},
|
2020-12-06 07:12:32 -08:00
|
|
|
groupedSources() {
|
|
|
|
let key = this.selectedPronoun.canonicalName;
|
|
|
|
if (this.config.sources.mergePronouns[key] !== undefined) {
|
|
|
|
key = this.config.sources.mergePronouns[key];
|
|
|
|
}
|
|
|
|
return this.sourceLibrary.getForPronounExtended(key);
|
|
|
|
},
|
2020-07-26 06:27:36 -07:00
|
|
|
},
|
2020-07-22 13:19:23 -07:00
|
|
|
}
|
|
|
|
</script>
|