my $state,
my $settings,
my $frame_data,
+ my $prev_frame_data,
my $next_frame_data,
my $words_data,
) = @_;
my $timer = int($context->{'timer'});
# my $words_page = int($context->{'words_page'});
- # my $prev_frame = $frame - 1;
+ my $prev_frame = $frame - 1;
my $next_frame = $frame + 1;
my $story = $settings->{'story'};
my $prev_available = (($frame > 0) && $access);
my $next_available = ($launch || $password_ok || ($next_frame <= $last_frame));
+ my $prefetch_prev = (
+ $password_ok ||
+ ($prev_frame < $last_frame) || ( # avoid unseen trigger!
+ ($prev_frame <= $last_frame) &&
+ ($ong_state >= STATE->{'ready'})
+ )
+ );
my $prefetch_next = (
$password_ok ||
($next_frame < $last_frame) || ( # avoid unseen trigger!
($ong_state > STATE->{'inactive'})
)
);
+ my $prevframe_indirect = !($prev_frame <= $last_frame);
my $nextframe_indirect = !($next_frame <= $last_frame);
my $password_query;
);
my $viewer_prev_url = merge_url(
{'path' => CGI_VIEWER_PATH()},
- {'path' => $frame-1}
+ {'path' => $prev_frame}
);
my $viewer_next_url = merge_url(
{'path' => CGI_VIEWER_PATH()},
);
my $frame_file;
my $frame_url;
+ my $frame_prev_url;
my $frame_next_url;
my $frame_normal_url;
my $frame_full_url;
{'scheme' => SCHEME(), 'host' => WEBSITE()},
{'path' => $frame_normal_url}
);
+ if ($prevframe_indirect) {
+ $frame_prev_url = merge_url(
+ {'path' => CGI_FRAME_PATH()},
+ {'path' => $prev_frame}
+ );
+ }
+ elsif ($prev_frame_data->{'frame'} ne '') {
+ $frame_prev_url = merge_url(
+ {'path' => CGI_PATH()},
+ {'path' => $prev_frame_data->{'frame'}}
+ );
+ }
+ else {
+ $frame_prev_url = merge_url(CGI_PATH(), sprintf(
+ $settings->{'frame'}, $prev_frame, $prev_frame_data->{'ext'}
+ ));
+ }
if ($nextframe_indirect) {
$frame_next_url = merge_url(
{'path' => CGI_FRAME_PATH()},
if ($frame_indirect) {
$frame_url = merge_url($frame_url , {'query' => $password_query, 'append_query' => 1, 'preserve_fragment' => 1});
}
+ if ($prevframe_indirect) {
+ $frame_prev_url= merge_url($frame_prev_url , {'query' => $password_query, 'append_query' => 1, 'preserve_fragment' => 1});
+ }
if ($nextframe_indirect) {
$frame_next_url= merge_url($frame_next_url , {'query' => $password_query, 'append_query' => 1, 'preserve_fragment' => 1});
}
my $_viewer_next_url = html_entity_encode_dec($viewer_next_url, 1);
my $_viewer_last_url = html_entity_encode_dec($viewer_last_url, 1);
my $_frame_url = html_entity_encode_dec($frame_url , 1);
+ my $_frame_prev_url = html_entity_encode_dec($frame_prev_url , 1);
my $_frame_next_url = html_entity_encode_dec($frame_next_url , 1);
my $_frame_full_url = html_entity_encode_dec($frame_full_url , 1);
print $fh ' <link rel="start" href="'.$_viewer_0_url.'">'."\n";
if ($prev_available) {
print $fh ' <link rel="prev" href="'.$_viewer_prev_url.'">'."\n";
+ if ($prefetch_prev) {
+ print $fh ' <link rel="prefetch" href="'.$_viewer_prev_url.'">'."\n";
+ print $fh ' <link rel="prefetch" href="'.$_frame_prev_url.'">'."\n";
+ }
}
if ($next_available) {
print $fh ' <link rel="next" href="'.$_viewer_next_url.'">'."\n";
$state,
$settings,
\%frame_data,
+ \%default, # prev
\%next_frame_data,
\%words_data
);
$state,
$settings,
\%frame_data,
+ \%default, # prev
\%next_frame_data,
{'posts' => 0} # words_data
);
my %http;
my %cgi;
my %frame_data;
+my %prev_frame_data;
my %next_frame_data;
my %default;
my %settings;
my $method;
my $frame;
my $frame_data_path;
+my $prev_frame_data_path;
my $next_frame_data_path;
my $password;
my $password_ok;
$state{'state'} = STATE->{'inactive'};
}
-$next_frame_data_path = join_path(PATH_SEPARATOR(), DATA_PATH(), $frame+1);
-%next_frame_data = read_data_file($next_frame_data_path);
-
-# apply defaults
-%frame_data = merge_settings(\%default, \%frame_data);
-%next_frame_data = merge_settings(\%default, \%next_frame_data);
-
$timer = int($state{'nextong'}) - $time;
$ongtime = int($state{'ongtime'});
if($ongtime == 0) {
)
) {
$access = 1;
+ if ($frame > 0) {
+ $prev_frame_data_path = join_path(PATH_SEPARATOR(), DATA_PATH(), $frame-1);
+ %prev_frame_data = read_data_file($prev_frame_data_path);
+ }
+ $next_frame_data_path = join_path(PATH_SEPARATOR(), DATA_PATH(), $frame+1);
+ %next_frame_data = read_data_file($next_frame_data_path);
+
+ %frame_data = merge_settings(\%default, \%frame_data);
+ %prev_frame_data = merge_settings(\%default, \%prev_frame_data);
+ %next_frame_data = merge_settings(\%default, \%next_frame_data);
}
else {
$access = 0;
\%state,
\%settings,
\%frame_data,
- \%next_frame_data,
+ $access ? \%prev_frame_data : \%frame_data,
+ $access ? \%next_frame_data : \%frame_data,
\%words_data,
);