diff options
author | Joey Hess <joey@kitenet.net> | 2012-07-30 22:24:19 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-07-30 22:24:19 -0400 |
commit | 6e40aed948c44348c977bb7ed7a9a6a84b9972ba (patch) | |
tree | 0e772d358481469c23bba935d0ed9ede3b197436 /templates | |
parent | 2821f9f976b104bcb107f44a13ae7f2eb61f2d7a (diff) |
fix noscript mode to not allocate notification ids on each refresh
Now the javascript does an ajax call at the start to request the url
to use to poll, and the notification id is generated then, once we know
javascript is working.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/dashboard.hamlet | 10 | ||||
-rw-r--r-- | templates/longpolling.julius | 7 |
2 files changed, 15 insertions, 2 deletions
diff --git a/templates/dashboard.hamlet b/templates/dashboard.hamlet new file mode 100644 index 000000000..7bcfce962 --- /dev/null +++ b/templates/dashboard.hamlet @@ -0,0 +1,10 @@ +^{content} +$if warnNoScript + <noscript> + <div .navbar .navbar-fixed-bottom> + <div .navbar-inner> + <div .container> + Javascript is disabled; cannot update in real-time. + <div .btn-group> + <a .btn .btn-primary href="@{NoScriptAutoR}">Auto-refresh every 3 seconds # + <a .btn .btn-primary href="@{NoScriptR}">Manually refresh diff --git a/templates/longpolling.julius b/templates/longpolling.julius index 67fe059cf..affa50cc8 100644 --- a/templates/longpolling.julius +++ b/templates/longpolling.julius @@ -1,9 +1,12 @@ function longpoll_#{ident}() { - longpoll('@{gethtml}', '#{ident}' + longpoll(longpoll_#{ident}_url, '#{ident}' , function() { setTimeout(longpoll_#{ident}, #{delay}); } , function() { webapp_disconnected(); } ); } $(function() { - setTimeout(longpoll_#{ident}, #{startdelay}); + $.get("@{geturl}", function(url){ + longpoll_#{ident}_url = url; + setTimeout(longpoll_#{ident}, #{startdelay}); + }); }); |