Code Improvements
This commit is contained in:
parent
08ee5eaf39
commit
75b705ee2c
14 changed files with 933 additions and 521 deletions
|
@ -1,20 +1,32 @@
|
|||
/**
|
||||
* JavaScript for RCC
|
||||
*
|
||||
* Copyright (c) 2016 by mmk2410
|
||||
* License: MIT License
|
||||
*/
|
||||
|
||||
window.onload = function () {
|
||||
var t = document.getElementsByTagName('textarea')[0];
|
||||
var offset = !window.opera ? (t.offsetHeight - t.clientHeight) : (t.offsetHeight + parseInt(window.getComputedStyle(t, null).getPropertyValue('border-top-width')));
|
||||
var offset = !window.opera ? (t.offsetHeight - t.clientHeight) : (
|
||||
t.offsetHeight + parseInt(
|
||||
window.getComputedStyle(t, null).getPropertyValue('border-top-width')
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* The following three code clocks are for proper resizing of the input textarea
|
||||
* The following three code clocks are for proper resizing of the input
|
||||
* textarea
|
||||
*/
|
||||
var resize = function (t) {
|
||||
t.style.height = 'auto';
|
||||
t.style.height = (t.scrollHeight + offset ) + 'px';
|
||||
}
|
||||
};
|
||||
|
||||
t.addEventListener && t.addEventListener('input', function (event) {
|
||||
resize(t);
|
||||
});
|
||||
|
||||
t['attachEvent'] && t.attachEvent('onkeyup', function () {
|
||||
t.attachEvent && t.attachEvent('onkeyup', function () {
|
||||
resize(t);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Reference in a new issue