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.
This commit is contained in:
parent
2821f9f976
commit
6e40aed948
4 changed files with 65 additions and 38 deletions
10
templates/dashboard.hamlet
Normal file
10
templates/dashboard.hamlet
Normal file
|
@ -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
|
|
@ -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});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue