This mod limits the height of the code boxs which are used by the [ code ] tag and adds scrollbars if necessary. It also displays linebreaks and tabs properly, the code text is no longer wrapped if a line is too long. Instead a scrollbar is used.
This will improve the readability of the code boxes and long threads.
If you're looking for an example, check out forum.boardmod.org
Version History:
v2.1a:
- made compatible with SP1.3.2 and SP1.4
v2.1:
- fixed turning into normal space when using the preview button (note: this bug has nothing todo with this mod, it's a general yabb bug)
v2.0:
- completely rewritten, now supports all browsers, now IE will no longer wrap long lines too
- fixed display of <TAB> characters (not only inside [ code ] tags!)
v1.1:
- use white-space:wrap for Safari
- removed modification of language file, no longer needed
v1.0:
- initial release
Here are some examples:
this is a small code box
yes it is... ;-)
this is a medium code box
ok let's make this line a little bit longer 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 0...
this is a large code box
ok let's make this line a little bit longer 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 01 2 3 4 5 6 7 8 9 0...
Some code showing the fixed <TAB>s...
sub LastPost {
fopen(FILE, "$vardir/cat.txt");
@categories = <FILE>;
fclose(FILE);
# Load Censor List
&LoadCensorList;
%data= ();
foreach $curcat (@categories) {
$curcat =~ s/[\n\r]//g;
fopen(CAT, "$boardsdir/$curcat.cat");
$curcatname = <CAT>;
$curcataccess = <CAT>;
@catboards = <CAT>;
fclose(CAT);
chomp $curcatname;
chomp $curcataccess;
%membergroups = ();
foreach(split(/\,/,$curcataccess)) {
$membergroups{$_} = $_;
}
if($curcataccess) {
if($settings[7] ne 'Administrator' && !exists $membergroups{$settings[7]}) { next; }
}
foreach $curboard (@catboards ) {
chomp $curboard;
fopen(BOARDDATA, "$boardsdir/$curboard.txt");
$message = <BOARDDATA>;
fclose(BOARDDATA);
($mnum, $msub, $dummy, $dummy, $datetime, $mreplies) = split(/\|/, $message);
$mydatetime = &timeformat($datetime);
foreach (@censored) {
($tmpa,$tmpb) = @{$_};
$message =~ s~\Q$tmpa\E~$tmpb~gi;
$msub =~ s~\Q$tmpa\E~$tmpb~gi;
}
if($recentsender eq "admin") {
$post = qq~"<a ies">$msub</a>" « $mydatetime »\n~;
} else {
$post = qq~<BR>$txt{'235'}: <a </B></a> ($mydatetime)<BR>$txt{'791'} <A href="$scripturl?action=recent">$txt{'792'}</a> $txt{'793'}~;
}
$totaltime = stringtotime($datetime);
$data{$totaltime}= $post;
}
}
@num = sort {$b <=> $a } keys %data;
$yymain .= "$data{$num[0]}";
}