mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-15 18:56:59 +00:00
move pronouns JS
This commit is contained in:
parent
a6f068a93b
commit
994c6d3cde
2 changed files with 31 additions and 24 deletions
|
@ -62,30 +62,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<input id="pronouns-custom" name="pronouns" value="{{.SignedUser.Pronouns}}" maxlength="50">
|
||||
<script>
|
||||
(() => {
|
||||
const pronounsDropdown = document.getElementById('pronouns-dropdown')
|
||||
const pronounsCustom = document.getElementById('pronouns-custom')
|
||||
const pronounsInput = pronounsDropdown.querySelector('input')
|
||||
pronounsCustom.removeAttribute('name')
|
||||
pronounsDropdown.style.display = ''
|
||||
function onPronounsDropdownUpdate() {
|
||||
const isCustom = !(pronounsInput.value == 'he/him' || pronounsInput.value == 'she/her' || pronounsInput.value == 'they/them' || pronounsInput.value == 'it/its')
|
||||
if (isCustom) {
|
||||
pronounsCustom.value = pronounsInput.value
|
||||
pronounsCustom.style.display = ''
|
||||
} else {
|
||||
pronounsCustom.style.display = 'none'
|
||||
}
|
||||
}
|
||||
function onPronounsCustomUpdate() {
|
||||
pronounsInput.value = pronounsCustom.value
|
||||
}
|
||||
onPronounsDropdownUpdate()
|
||||
pronounsInput.addEventListener('change', onPronounsDropdownUpdate)
|
||||
pronounsCustom.addEventListener('input', onPronounsCustomUpdate)
|
||||
})()
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue