18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/frank/template_helpers.rb', line 18
def refresh
if Frank.exporting?
nil
else
"<script type=\"text/javascript\">\n(function(){\nvar when = \#{Time.now.to_i};\n\nfunction process( raw ){\nif( parseInt(raw) > when ) {\nwindow.location.reload();\n}\n}\n\n(function (){\nvar req = (typeof XMLHttpRequest !== \"undefined\") ? new XMLHttpRequest() : new ActiveXObject(\"Microsoft.XMLHTTP\");\nreq.onreadystatechange = function (aEvt) {\nif ( req.readyState === 4 ) {\nprocess( req.responseText );\n}\n};\nreq.open('GET', '/__refresh__', true);\nreq.send( null );\nsetTimeout( arguments.callee, 1000 );\n})();\n\n})();\n</script>\n"
end
end
|