|
Demo
Discussion
|
Forum
Config Examples
Contributions
Vulnerabilities
|
Contributions to ELOG |
Not logged in |
|
|
|
Message ID: 36
Entry time: Tue Aug 23 12:07:51 2011
In reply to: 14
|
Author: |
Stefan Ritt |
Author Email: |
stefan.ritt@psi.ch |
Category: |
Script |
Subject: |
Re: JavaScript list auto-refresh |
Status: |
Stable |
Last Revision: |
Tue Jul 12 12:36:16 2005 by Emiliano Gabrielli |
|
|
Emiliano Gabrielli wrote: | Here is a simple piece of JS code to accomplish a smart page reload.
We don't reload if in some kind of editing mode.
You can put the code everywhere you like in the elog html page, my suggestion is to put it in Bottom Text (or Top Text):
;auto-refresh
Bottom text = [I]<script language="JavaScript">if (null==window.location.href.match('/[0-9]+$|.*(cmd|select)=.*') ) { window.setTimeout("location.reload();", 2*60*1000); now=new Date(); document.write('<br/>Last reload at '+now.getFullYear()+'/'+(now.getMonth()+1)+'/'+now.getDate()+', '+( ((h=now.getHours())<10) ? '0'+h :h)+':'+( ((m=now.getMinutes())<10) ? '0'+m :m)+':'+( ((s=now.getSeconds())<10) ? '0'+s :s)) }</script>[/I]
the timer is a product of # of minutes, #of seconds and milliseconds... 2 minutes in the above example
Revision Tue Jul 12 12:36:16 2005 wrote: |
modified regular expression in order to not activate the auto-refresh in the signle entry view
|
|
Starting with SVN revision 2422, there is a new config option
refresh = <seconds>
which lets you do the same thing. |