fewd/priv/static/js/dist/libfewd.js

24 lines
818 B
JavaScript

/**
* FEWD common js lib functions
*
* @module
*/
export { auto_resize, auto_scroll_to_bottom };
function auto_resize(checkbox_element, target_element, max_height) {
// if the user has manually resized their output, we do nothing
if (checkbox_element.checked) {
let target_height = 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, target_element) {
if (checkbox_element.checked) {
// scroll to bottom
target_element.scrollTop = target_element.scrollHeight;
}
}
//# sourceMappingURL=libfewd.js.map