Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bookmarkable automatic polling URL using location.hash

  • Loading branch information...
commit 763109479e25d5aaf8bba4853a6f4a3b36236e46 1 parent 3648462
Tatsuhiko Miyagawa miyagawa authored steveklabnik committed

Showing 1 changed file with 10 additions and 4 deletions. Show diff stats Hide diff stats

  1. +10 4 lib/resque/server/public/ranger.js
14 lib/resque/server/public/ranger.js
@@ -35,9 +35,9 @@ $(function() {
35 35 return false
36 36 })
37 37
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...')
41 41 $("#main").addClass('polling')
42 42
43 43 setInterval(function() {
@@ -47,8 +47,14 @@ $(function() {
47 47 }})
48 48 }, poll_interval * 1000)
49 49
  50 + location.hash = '#poll'
  51 +
50 52 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)) })
52 58
53 59 $('ul.failed li').hover(function() {
54 60 $(this).addClass('hover');

0 comments on commit 7631094

Please sign in to comment.
Something went wrong with that request. Please try again.