added favicon

compute default url
This commit is contained in:
longsleep 2012-12-13 16:10:49 +00:00
parent 24033fc3ee
commit 37c0263b51
4 changed files with 36 additions and 23 deletions

BIN
client/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

View file

@ -2,6 +2,7 @@
<html class="no-js"> <html class="no-js">
<head> <head>
<title>Realtime traffic monitor</title> <title>Realtime traffic monitor</title>
<link href="favicon.ico" rel="icon" type="image/x-icon"/>
<link type="text/css" rel="stylesheet" href="css/base.css"> <link type="text/css" rel="stylesheet" href="css/base.css">
<link type="text/css" rel="stylesheet" href="css/graph.css"> <link type="text/css" rel="stylesheet" href="css/graph.css">
<link type="text/css" rel="stylesheet" href="css/legend.css"> <link type="text/css" rel="stylesheet" href="css/legend.css">

View file

@ -149,6 +149,18 @@ $(document).ready(function() {
interf = localStorage.getItem("org.longsleep.realtimetraffic.defaults.interf"); interf = localStorage.getItem("org.longsleep.realtimetraffic.defaults.interf");
} }
// compute default URL based on current URL.
if (!url) {
if (/^((http|https):\/\/)/i.test(window.location.href)) {
if (/^(https:\/\/)/i.test(window.location.href)) {
url = "wss://"+window.location.host+"/realtimetraffic";
} else {
url = "ws://"+window.location.host+"/realtimetraffic";
}
}
}
if (url) { if (url) {
input_url.val(url); input_url.val(url);
} }

View file

@ -159,7 +159,7 @@ def main(listen="127.0.0.1:8088"):
listen = "%s:%s" % (address, port) listen = "%s:%s" % (address, port)
application = tornado.web.Application([ application = tornado.web.Application([
(r'^/ws$', WSHandler), (r'^/realtimetraffic$', WSHandler),
(r'^/css/(.*)$', tornado.web.StaticFileHandler, {'path': os.path.join(CLIENT_ROOT, 'css')}), (r'^/css/(.*)$', tornado.web.StaticFileHandler, {'path': os.path.join(CLIENT_ROOT, 'css')}),
(r'^/scripts/(.*)$', tornado.web.StaticFileHandler, {'path': os.path.join(CLIENT_ROOT, 'scripts')}), (r'^/scripts/(.*)$', tornado.web.StaticFileHandler, {'path': os.path.join(CLIENT_ROOT, 'scripts')}),
(r'^/img/(.*)$', tornado.web.StaticFileHandler, {'path': os.path.join(CLIENT_ROOT, 'img')}), (r'^/img/(.*)$', tornado.web.StaticFileHandler, {'path': os.path.join(CLIENT_ROOT, 'img')}),