Evtl kann das ja auch jemand gebrauchen.
Code: Alles auswählen
##############################################################
## MOD Title: Dynamic Textarea
## MOD Author: John Doe < smartie2004@freenet.de > (Kai Z.) N/A
## MOD Description:
## This mod resizes the textarea while typing the message,
## so there is no scrolling in larger messages.
## MOD Version: 0.0.1
##
## Installation Level: easy
## Installation Time: 2 Minutes
## Files To Edit:
## overall_header.tpl
##
##
## Included Files: N/A
##############################################################
## Author Notes:
##
## This mod based on a script by Paul Tuckey. (http://tuckey.org/)
##
## Important!
## If you are already using a script with window.onload=dothis()
## or <body onload="dothat()"> there will be possibly a conflict.
##
## Solution:
##
## change your scripts like this: <body onload="dothis();dothat()">
## regardless if they are called in the <body> tag or window.onload.
##
##
##############################################################
## MOD History:
##
## 2005-10-22 - Version 0.0.1
## - first release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND ]------------------------------------------
#
</head>
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<script type="text/javascript">
<!--
function countLines(strtocount, cols) {
var hard_lines = 5; // here you can change the height of the textarea
var last = 0;
while ( true ) {
last = strtocount.indexOf("\n", last+1);
hard_lines ++;
if ( last == -1 ) break;
}
var soft_lines = Math.round(strtocount.length / (cols-1));
var hard = eval("hard_lines " + unescape("%3e") + "soft_lines;");
if ( hard ) soft_lines = hard_lines;
return soft_lines;
}
function cleanForm() {
var the_form = document.forms[0];
for ( var x in the_form ) {
if ( ! the_form[x] ) continue;
if( typeof the_form[x].rows != "number" ) continue;
the_form[x].rows = countLines(the_form[x].value,the_form[x].cols) +1;
}
setTimeout("cleanForm();", 300);
}
// -->
</script>
#
#-----[ FIND ]------------------------------------------
#
<body
#
#-----[ IN-LINE FIND ]------------------------------------------
#
>
#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
onload="cleanForm();"
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM