Only show skip links if there is an entry earlier to look at.
This patch was pulled from the LiveJournal.com repository.
Patch by ysobel.
diffs (65 lines):
diff -r 3c51f9b475ff -r 6c42228acbae cgi-bin/LJ/S2/FriendsPage.pm
--- a/cgi-bin/LJ/S2/FriendsPage.pm Tue Dec 01 18:11:55 2009 +0000
+++ b/cgi-bin/LJ/S2/FriendsPage.pm Thu Dec 03 04:17:12 2009 +0000
@@ -117,7 +117,7 @@ sub FriendsPage
## load the itemids
my ( %friends, %friends_row, %idsbycluster );
my @items = $u->watch_items(
- itemshow => $itemshow,
+ itemshow => $itemshow + 1,
skip => $skip,
content_filter => $filter,
friends_u => \%friends,
@@ -128,6 +128,9 @@ sub FriendsPage
dateformat => 'S2',
events_date => $events_date,
);
+
+ my $is_prev_exist = scalar @items - $itemshow > 0 ? 1 : 0;
+ pop @items if $is_prev_exist;
while ($_ = each %friends) {
# we expect fgcolor/bgcolor to be in here later
@@ -237,9 +240,9 @@ sub FriendsPage
## unless we didn't even load as many as we were expecting on this
## page, then there are more (unless there are exactly the number shown
- ## on the page, but who cares about that)
+ ## on the page, but who cares about that ... well, we do now...)
# Must remember to count $hiddenentries or we'll have no skiplinks when > 1
- unless (($eventnum + $hiddenentries) != $itemshow || $skip == $maxskip) {
+ unless (($eventnum + $hiddenentries) != $itemshow || $skip == $maxskip ||
!$is_prev_exist) {
my %linkvars;
$linkvars{'show'} = $get->{'show'} if $get->{'show'} =~ /^\w+$/;
$linkvars{'date'} = $get->{'date'} if $get->{'date'};
diff -r 3c51f9b475ff -r 6c42228acbae cgi-bin/LJ/S2/RecentPage.pm
--- a/cgi-bin/LJ/S2/RecentPage.pm Tue Dec 01 18:11:55 2009 +0000
+++ b/cgi-bin/LJ/S2/RecentPage.pm Thu Dec 03 04:17:12 2009 +0000
@@ -89,7 +89,7 @@ sub RecentPage
clustersource => 'slave',
viewall => $viewall,
remote => $remote,
- itemshow => $itemshow,
+ itemshow => $itemshow + 1,
skip => $skip,
tagids => $opts->{tagids},
security => $opts->{securityfilter},
@@ -98,6 +98,9 @@ sub RecentPage
order => ( $u->is_community || $u->is_syndicated ) ? 'logtime'
: '',
err => \$err,
);
+
+ my $is_prev_exist = scalar @items - $itemshow > 0 ? 1 : 0;
+ pop @items if $is_prev_exist;
die $err if $err;
@@ -198,7 +201,7 @@ sub RecentPage
my $date_slashes = $lastdate; # "yyyy mm dd";
$date_slashes =~ s! !/!g;
$nav->{'backward_url'} = "$p->{'base_url'}/$date_slashes";
- } else {
+ } elsif ($is_prev_exist) {
my $newskip = $skip + $itemshow;
$nav->{'backward_url'} = LJ::make_link( "$p->{'base_url'}/",
{ skip => $newskip
|| "",
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog