rDrama/files/assets/js/default.js
2021-12-10 05:58:38 +02:00

28 lines
No EOL
778 B
JavaScript

function formkey() {
return document.getElementById("formkey").innerHTML;
}
function autoExpand (field) {
xpos=window.scrollX;
ypos=window.scrollY;
field.style.height = 'inherit';
var computed = window.getComputedStyle(field);
var height = parseInt(computed.getPropertyValue('border-top-width'), 10)
+ parseInt(computed.getPropertyValue('padding-top'), 10)
+ field.scrollHeight
+ parseInt(computed.getPropertyValue('padding-bottom'), 10)
+ parseInt(computed.getPropertyValue('border-bottom-width'), 10)
+ 32;
field.style.height = height + 'px';
window.scrollTo(xpos,ypos);
};
document.addEventListener('input', function (event) {
if (event.target.tagName.toLowerCase() !== 'textarea') return;
autoExpand(event.target);
}, false);