dannyman.toldme.com


JIRA, Technical

Embed Page Refresh

Feature request that certain JIRA dashboards should reload more frequently than every fifteen minutes. So, I cooked up some JavaScript to hide in the announcement banner:

<script type="text/javascript">
 
function gup( name ){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
 if( results == null )    return "";
else    return results[1];}
 
function reload() {
 window.location = window.location
}
 
var refresh = gup('refresh');
if ( refresh > 0 )    window.setInterval(reload, refresh*1000);
</script>

Now users can add refresh=nn and the page will reload every nn seconds. This ought to work in most cases where you can sneak some HTML into a Web App.

Function gup stolen from http://stackoverflow.com/questions/979975/how-to-get-the-value-from-url-parameter.

Read More

Next:
Previous:
Categories: JIRA, Technical

Discover more from dannyman.toldme.com

Subscribe now to keep reading and get access to the full archive.

Continue reading