This commit is contained in:
Peter Harpending
2025-10-27 09:30:29 -07:00
parent b55b0bd056
commit 1aed42598a
9 changed files with 16 additions and 82 deletions
@@ -4,6 +4,7 @@
* @module
*/
import * as libfewd from './libfewd.js'
//------------------------------------------------------------------
// page element stuff
@@ -68,47 +69,13 @@ on_input_key
oelt.value += '\n';
// auto-resize
auto_resize_output(cb_resize, oelt, max_height);
auto_scroll_to_bottom(cb_scroll, oelt);
libfewd.auto_resize(cb_resize, oelt, max_height);
libfewd.auto_scroll_to_bottom(cb_scroll, oelt);
}
}
}
function
auto_resize_output
(checkbox_element : HTMLInputElement,
target_element : HTMLTextAreaElement,
max_height : number)
: void
{
// if the user has manually resized their output, we do nothing
if (checkbox_element.checked) {
let target_height: number = target_element.scrollHeight;
// resize it automagically up to 500px
if (target_height < max_height)
target_element.style.height = String(target_height) + 'px';
else
target_element.style.height = String(max_height) + 'px';
}
}
function
auto_scroll_to_bottom
(checkbox_element : HTMLInputElement,
target_element : HTMLTextAreaElement)
: void
{
if (checkbox_element.checked) {
// scroll to bottom
target_element.scrollTop = target_element.scrollHeight;
}
}
//------------------------------------------------------------------
// wfc api
//------------------------------------------------------------------