Skip to content

Commit 92ac0e5

Browse files
miyagawasteveklabnik
authored andcommitted
Bookmarkable automatic polling URL using location.hash
1 parent 01781dc commit 92ac0e5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/resque/server/public/ranger.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ $(function() {
3535
return false
3636
})
3737

38-
$('a[rel=poll]').click(function() {
39-
var href = $(this).attr('href')
40-
$(this).parent().text('Starting...')
38+
var poll_start = function(el) {
39+
var href = el.attr('href')
40+
el.parent().text('Starting...')
4141
$("#main").addClass('polling')
4242

4343
setInterval(function() {
@@ -47,8 +47,14 @@ $(function() {
4747
}})
4848
}, poll_interval * 1000)
4949

50+
location.hash = '#poll'
51+
5052
return false
51-
})
53+
};
54+
55+
if (location.hash == '#poll') poll_start($('a[rel=poll]'))
56+
57+
$('a[rel=poll]').click(function() { return poll_start($(this)) })
5258

5359
$('ul.failed li').hover(function() {
5460
$(this).addClass('hover');

0 commit comments

Comments
 (0)