Permalink
Browse files

Bookmarkable automatic polling URL using location.hash

  • Loading branch information...
1 parent 3648462 commit 763109479e25d5aaf8bba4853a6f4a3b36236e46 @miyagawa miyagawa committed with steveklabnik Mar 2, 2012
Showing with 10 additions and 4 deletions.
  1. +10 −4 lib/resque/server/public/ranger.js
@@ -35,9 +35,9 @@ $(function() {
return false
})
- $('a[rel=poll]').click(function() {
- var href = $(this).attr('href')
- $(this).parent().text('Starting...')
+ var poll_start = function(el) {
+ var href = el.attr('href')
+ el.parent().text('Starting...')
$("#main").addClass('polling')
setInterval(function() {
@@ -47,8 +47,14 @@ $(function() {
}})
}, poll_interval * 1000)
+ location.hash = '#poll'
+
return false
- })
+ };
+
+ if (location.hash == '#poll') poll_start($('a[rel=poll]'))
+
+ $('a[rel=poll]').click(function() { return poll_start($(this)) })
$('ul.failed li').hover(function() {
$(this).addClass('hover');

0 comments on commit 7631094

Please sign in to comment.