From ee82378271b2fa4b4ca412c36355b82b4ce333e9 Mon Sep 17 00:00:00 2001 From: Andrea Vos Date: Mon, 7 Dec 2020 19:10:14 +0100 Subject: [PATCH] [sources] encode filter in url hash --- locale/en/pronouns/pronouns.tsv | 2 +- routes/nouns.vue | 28 +++++++++++++--------------- routes/sources.vue | 24 ++++++++++++++++++++---- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/locale/en/pronouns/pronouns.tsv b/locale/en/pronouns/pronouns.tsv index 50ab14bb9..099392bb0 100644 --- a/locale/en/pronouns/pronouns.tsv +++ b/locale/en/pronouns/pronouns.tsv @@ -6,7 +6,7 @@ they/them/themself Singular “they” TRUE they them their theirs themself TRUE it,it/its Personal “it” TRUE it it its its itself FALSE FALSE TRUE Although “it” is normally used for objects, not people, some actually do like being called that way. If someone wants you to call it “it”, it's not offensive – it's actually respectful. But remember that it/its pronouns have a history of transphobic use, so only with people who explicitly wish it. one,one/one's Specific “one” TRUE one one one's one's oneself FALSE FALSE TRUE “One” is used in formal English when talking about a general or a hypothetical person. Recently people started using “one” also as their personal pronoun. ae,æ,ae/aer,æ/ær Neopronoun “ae” / “æ” FALSE ae|ei aer|ɛɹ aer|ɛɹ aers|ɛɹz aerself|ɛɹsɛlf FALSE FALSE TRUE Created by David Lindsay for a 1920 novel A Voyage to Arcturus, where it's used by an alien, third-sex species. "" -co,co/cos Neopronoun “co/cos” FALSE co|ko co|ko cos|koz co's|koz coself|kosɛlf FALSE FALSE TRUE Created by Mary Orovan in 1970, derived from the Indo-European _*ko_. +co,co/cos Neopronoun “co/cos” FALSE co|ko co|ko cos|koz co's|koz coself|kosɛlf FALSE FALSE TRUE Created by Mary Orovan in 1970, derived from the Indo-European *ko. e,e/em/eir Spivak pronouns FALSE e|i em|ɛm eir|ɛɹ eirs|ɛɹz emself|ɛmsɛlf FALSE FALSE TRUE Coined by Michael Spivak in 1990 for his manual The Joy of TeX to avoid gendering people in the examples. "" e/em/es Neopronoun “e/em/es” FALSE e|i em|ɛm es|iz ems|ɛmz emself|ɛmsɛlf FALSE FALSE TRUE First created in 1890 by James Rogers based on {/he=he} and {/them=them} pronoun sets. Since then multiple versions were created, differing in declension and capitalisation. ey,ey/em Elverson pronouns FALSE ey|eɪ em|ɛm eir|ɛɹ eirs|ɛɹz emself|ɛmsɛlf FALSE FALSE TRUE {https://research.cristanwilliams.com/2012/02/24/1975-transgender-cross-gender/=Coined by Christine M. Elverson} in 1975 for a contest to create an alternative to the singular {/they=they}. Those forms are created by dropping “th” from “they”. "" diff --git a/routes/nouns.vue b/routes/nouns.vue index 943533bda..7680cde12 100644 --- a/routes/nouns.vue +++ b/routes/nouns.vue @@ -38,23 +38,21 @@ export default { components: { NounsNav, NounsExtra }, mounted() { - if (process.client) { - if (window.location.hash) { - const anchor = decodeURIComponent(window.location.hash.substr(1)); - this.$nextTick(_ => { - const $anchor = document.getElementById(anchor); - if ($anchor) { - $anchor.scrollIntoView(); + if (process.client && window.location.hash) { + const anchor = decodeURIComponent(window.location.hash.substr(1)); + this.$nextTick(_ => { + const $anchor = document.getElementById(anchor); + if ($anchor) { + $anchor.scrollIntoView(); + } else { + if (this.$refs.dictionarywrapper) { + this.$refs.dictionarywrapper.open = true; + this.$refs.collapsabledictionary.setFilter(anchor); } else { - if (this.$refs.dictionarywrapper) { - this.$refs.dictionarywrapper.open = true; - this.$refs.collapsabledictionary.setFilter(anchor); - } else { - this.$refs.dictionary.setFilter(anchor); - } + this.$refs.dictionary.setFilter(anchor); } - }) - } + } + }); } }, head() { diff --git a/routes/sources.vue b/routes/sources.vue index 6231fa837..698b7fe88 100644 --- a/routes/sources.vue +++ b/routes/sources.vue @@ -161,10 +161,15 @@ }, mounted() { if (process.client && window.location.hash) { - const $hashEl = this.$el.querySelector(window.location.hash); - if ($hashEl) { - $hashEl.scrollIntoView(); - } + const anchor = decodeURIComponent(window.location.hash.substr(1)); + this.$nextTick(_ => { + const $anchor = document.getElementById(anchor); + if ($anchor) { + $anchor.scrollIntoView(); + } else { + this.filter = anchor; + } + }) } }, head() { @@ -189,5 +194,16 @@ this.$nextTick(() => this.$refs.form.edit(source)); } }, + watch: { + filter() { + if (process.client) { + if (this.filter) { + window.location.hash = this.filter; + } else { + history.pushState('', document.title, window.location.pathname + window.location.search); + } + } + } + }, }