From 9a43dce739e4d42cab2f98ba4bf0ce13f8ba0d7f Mon Sep 17 00:00:00 2001 From: chr Date: Mon, 12 Nov 2018 20:30:47 -0800 Subject: Bio length -> 1024 characters Increase the cybre.space profile bio text length limit to 1024 characters. Also modifies the account settings page to automatically resize the textbox to the size of the contained text, so that it's easier to type longer bios. --- app/javascript/packs/public.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'app/javascript/packs') diff --git a/app/javascript/packs/public.js b/app/javascript/packs/public.js index 8c5c15b8f..3ff665f2a 100644 --- a/app/javascript/packs/public.js +++ b/app/javascript/packs/public.js @@ -20,6 +20,12 @@ window.addEventListener('message', e => { id: data.id, height: document.getElementsByTagName('html')[0].scrollHeight, }, '*'); + + if (document.fonts && document.fonts.ready) { + document.fonts.ready.then(sizeBioText); + } else { + sizeBioText(); + } }); }); @@ -161,6 +167,12 @@ function main() { const message = (statusEl.dataset.spoiler === 'expanded') ? (messages['status.show_less'] || 'Show less') : (messages['status.show_more'] || 'Show more'); spoilerLink.textContent = (new IntlMessageFormat(message, locale)).format(); }); + + if (document.fonts && document.fonts.ready) { + document.fonts.ready.then(sizeBioText); + } else { + sizeBioText(); + } }); delegate(document, '.webapp-btn', 'click', ({ target, button }) => { @@ -291,6 +303,22 @@ function main() { } }); }); + + delegate(document, '#account_note', 'input', sizeBioText); + + function s500 izeBioText() { + const noteCounter = document.querySelector('.note-counter'); + const bioTextArea = document.querySelector('#account_note'); + + if (noteCounter) { + noteCounter.textContent = 1024 - length(bioTextArea.value); + } + + if (bioTextArea) { + bioTextArea.style.height = 'auto'; + bioTextArea.style.height = (bioTextArea.scrollHeight+3) + 'px'; + } + } } loadPolyfills() -- cgit