Cut Down Number Of Pages
1.1
This mod will replace the number of pages like
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 »
on the message-index and in threads by
1 ... 6 7 8 9 [10] 11 12 13 14 ... 27
for an example see http://boardmod.xnull.com/YaBB/YaBB.pl
version 1.1:
- several bugs fixed
[CV]XXL
http://boardmod.xnull.com
Sources\Display.pl
# Build the page links list.
$max = $mreplies + 1;
$start = $INFO{'start'} || 0;
$start = $start > $mreplies ? $mreplies : $start;
$start = ( int( $start / $maxmessagedisplay ) ) * $maxmessagedisplay;
$tmpa = $start - $maxmessagedisplay;
$pageindex .= $start == 0 ? qq~ ~ : qq~« ~;
$tmpa = 1;
for( $counter = 0; $counter < $max; $counter += $maxmessagedisplay ) {
$pageindex .= $start == $counter ? qq~$tmpa ~ : qq~$tmpa ~;
$tmpa++;
}
$tmpa = $start + $maxmessagedisplay;
$tmpa = $tmpa > $mreplies ? $mreplies : $tmpa;
if($start != $counter-$maxmessagedisplay) {
$pageindex .= $tmpa > $counter-$maxmessagedisplay ? qq~ ~ : qq~» ~;
}
# Build the page links list.
# [CV]XXL's Cut Down Page List Mod
# Don't try to understand this, you won't get it ;)
$postdisplaynum = 5; # max number of pages to display
$max = $mreplies + 1;
$start = $INFO{'start'} || 0;
$start = $start > $mreplies ? $mreplies : $start;
$start = ( int( $start / $maxmessagedisplay ) ) * $maxmessagedisplay;
$tmpa = 1;
$tmpx = int( $max / $maxmessagedisplay );
if ($start >= (($postdisplaynum-1) * $maxmessagedisplay)) { $startpage = $start - (($postdisplaynum-1) * $maxmessagedisplay); $tmpa = int( $startpage / $maxmessagedisplay ) + 1; }
if ($max >= $start + ($postdisplaynum * $maxmessagedisplay)) { $endpage = $start + ($postdisplaynum * $maxmessagedisplay); } else { $endpage = $max }
if ($startpage > 0) { $pageindex = qq~1 ... ~; }
if ($startpage == $maxmessagedisplay) { $pageindex = qq~1 ~;}
for( $counter = $startpage; $counter < $endpage; $counter += $maxmessagedisplay ) {
$pageindex .= $start == $counter ? qq~$tmpa ~ : qq~$tmpa ~;
$tmpa++;
}
$tmpx = $max - $maxmessagedisplay;
$outerpn = int($tmpx / $maxmessagedisplay) + 0;
$lastpn = int($mreplies / $maxmessagedisplay) + 1;
$lastptn = ($lastpn - 1) * $maxmessagedisplay;
if ($endpage < $max - ($maxmessagedisplay) ) {$pageindexadd = qq~ ... ~;}
if ($endpage != $max) {$pageindexadd .= qq~ $lastpn~;}
$pageindex .= $pageindexadd;
# End Of [CV]XXL's Modification
Sources\MessageIndex.pl
# Construct the page links for this board.
$tmpa = $start - $maxindex;
$pageindex .= $start == 0 ? qq~ ~ : qq~« ~;
$tmpa = 1;
for( $counter = 0; $counter < $threadcount; $counter += $maxindex ) {
$pageindex .= $start == $counter ? qq~$tmpa ~ : qq~$tmpa ~;
++$tmpa;
}
$tmpa = $start + $maxindex;
$tmpa = $tmpa > $threadcount ? $threadcount : $tmpa;
if($start != $counter-$threadcount) {
$pageindex .= $tmpa > $counter-$maxindex ? qq~ ~ : qq~» ~;
}
# Construct the page links for this board.
# [CV]XXL's Cut Down Page List Mod
# Don't try to understand this, you won't get it ;)
$indexdisplaynum = 5; # max number of pages to display
$tmpa = 1;
$tmpx = int( $threadcount / $maxindex );
if ($start >= (($indexdisplaynum-1) * $maxindex)) { $startpage = $start - (($indexdisplaynum-1) * $maxindex); $tmpa = int( $startpage / $maxindex ) + 1; }
if ($threadcount >= $start + ($indexdisplaynum * $maxindex)) { $endpage = $start + ($indexdisplaynum * $maxindex); } else { $endpage = $threadcount }
if ($startpage > 0) { $pageindex = qq~1 ... ~; }
if ($startpage == $maxindex) { $pageindex = qq~1 ~;}
for( $counter = $startpage; $counter < $endpage; $counter += $maxindex ) {
$pageindex .= $start == $counter ? qq~$tmpa ~ : qq~$tmpa ~;
++$tmpa;
}
$tmpx = $threadcount - 1 - $maxindex;
$outerpn = int($tmpx / $maxindex);
$lastpn = int(($threadcount - 1) / $maxindex) + 1;
$lastptn = ($lastpn - 1) * $maxindex;
if ($endpage < $threadcount - $maxindex ) {$pageindexadd = qq~ ... ~;}
if ($endpage != $threadcount) {$pageindexadd .= qq~ $lastpn~;}
$pageindex .= $pageindexadd;
# End Of [CV]XXL's Modification