Seite 1 von 1

[Beta] Dynamic Textarea

Verfasst: 24.10.2005 17:31
von John Doe
Da mich das Scrollen in längeren Postings in der Textarea genervt hab, hab ich für mich was zusammengebastelt.
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

Verfasst: 25.10.2005 17:06
von JRK
Hast du mal n Demolink, oder wenn du das nicht willst nur n Screen dazu?
Kann mir leider nix drunter vorstellen.

Verfasst: 25.10.2005 19:49
von John Doe
Hab mal ein kleines Demovideo (200k) bei Rapidshare upgeloadet.

http://rapidshare.de/files/6749365/screen.avi.html

Auf den Free-download button klicken, ein paar Sekunden warten-downloaden.

Hab in der Demo einfach ein paar Returns eingegeben, anschliessend wieder
entfernt.

Falls noch Unklarheiten kann ich auch ein paar Scrrenshots machen.

Verfasst: 25.10.2005 21:13
von JRK
Nein keine weiteren Screens nötig, vielen Dank für den schönen Mod

Verfasst: 26.10.2005 16:46
von DsMagic
Hi , hast du Video auch in einem anderen format als avi. ???
Edit : Hat sich erledigt !!! Und danke für den mod .