This hack will change the "*** Page Will Refresh Every 60 Seconds ***" message at the bottom of the main page into a countdown timer to 0, at which point the page refreshes. I like to know how fresh the data I'm seeing is, especially if I've set a longer timer (like 10 minutes).
All the changes are in the main index.php file only. I'll describe them here, but I've also attached a patch that should work on an unmodified index.php file.
In the <head>, where it says:
<?php
if(!isset($_SESSION['prefresh']) || ($_SESSION['prefresh'] == true))
{
echo "<meta http-equiv=\"REFRESH\" content=\"".$cfg["page_refresh"].";URL=index.php\">";
}
?>
Add in the lines to make it say:
<?php
if(!isset($_SESSION['prefresh']) || ($_SESSION['prefresh'] == true))
{
echo "<meta http-equiv=\"REFRESH\" content=\"".$cfg["page_refresh"].";URL=index.php\">";
?>
<script language="JavaScript">
var var_refresh = <?php echo $cfg["page_refresh"] ?>;
function UpdateRefresh() {
span_refresh.innerHTML = String(var_refresh--);
setTimeout("UpdateRefresh();", 1000);
}
</script>
<?php
}
?>
Change the line:
<body topmargin="8" bgcolor="<?php echo $cfg["main_bgcolor"] ?>">
to:
<body onLoad="UpdateRefresh();" topmargin="8" bgcolor="<?php echo $cfg["main_bgcolor"] ?>">
And finally, change the line:
echo "*** "._PAGEWILLREFRESH." ".$cfg["page_refresh"]." "._SECONDS." ***<br>";
to:
echo "*** "._PAGEWILLREFRESH." <span id='span_refresh'>".$cfg["page_refresh"]."</span> "._SECONDS." ***<br>";
That's it, now when you load the front page it should count down from 60 (or whatever your refresh timer is) down to 0, at which point the page should refresh. It's pretty simple, though it could be made better by updating _PAGEWILLREFRESH in the language file to say "Page Will Refresh In" instead of "Page Will Refresh Every".
Enjoy!