From 6665207066684abcfb2c5ec60f689efa538b4c72 Mon Sep 17 00:00:00 2001 From: shiin Date: Tue, 15 May 2012 23:02:19 +0200 Subject: [PATCH] added basic maintenance message --- WebContent/OSRM.config.js | 1 + WebContent/main.css | 30 ++++++++++++++++++++++++++++++ WebContent/main.html | 25 +++++++++++++++++++++++++ WebContent/main.js | 14 ++++++++++++++ 4 files changed, 70 insertions(+) diff --git a/WebContent/OSRM.config.js b/WebContent/OSRM.config.js index 2aff5eaba..22cbeae83 100644 --- a/WebContent/OSRM.config.js +++ b/WebContent/OSRM.config.js @@ -19,6 +19,7 @@ or see http://www.gnu.org/licenses/agpl.txt. // [has to be loaded directly after OSRM.base] OSRM.DEFAULTS = { + MAINTENANCE: true, HOST_ROUTING_URL: 'http://router.project-osrm.org/viaroute', HOST_SHORTENER_URL: 'http://map.project-osrm.org/shorten/', HOST_TIMESTAMP_URL: 'http://router.project-osrm.org/timestamp', diff --git a/WebContent/main.css b/WebContent/main.css index e7ec3aed2..14f2317af 100644 --- a/WebContent/main.css +++ b/WebContent/main.css @@ -425,6 +425,32 @@ html, body { width:390px; height:80px; } +#notification-wrapper +{ + width:600px; + height:170px; + top: 50%; + left: 50%; + margin-top:-85px; + margin-left:-300px; +} +#notification-content +{ + width:580px; + height:150px; +} +#notification-blanket +{ + position:absolute; + top:0px; + left:0px; + width:100%; + height:100%; + background-color:#666666; + background-color:rgba(0, 0, 0, 0.25); + z-index:100; + display:none; +} /* styles for content of other gui boxes */ @@ -458,6 +484,10 @@ html, body { { float: right; } +#notification-box +{ + margin:5px 5px 5px 5px; +} /* ------------------------------------------------------------------------ */ diff --git a/WebContent/main.html b/WebContent/main.html index 11fc63f4b..ef75ec919 100644 --- a/WebContent/main.html +++ b/WebContent/main.html @@ -86,6 +86,31 @@ or see http://www.gnu.org/licenses/agpl.txt.
+ +
+
+
+ +
+
Scheduled Maintenance
+ + +
+ The OSRM Website is down for a scheduled maintenance. Please be patient while required updates are performed. + The site will be back online shortly. +
+
+ In the meantime you may want to go out an map a friendly neighborhood near you... +
+
+
+
+ [OSRM] +
+
+
+
+
diff --git a/WebContent/main.js b/WebContent/main.js index 129d1de04..e2b75e1f8 100644 --- a/WebContent/main.js +++ b/WebContent/main.js @@ -31,6 +31,10 @@ OSRM.init = function() { OSRM.Printing.init(); OSRM.Routing.init(); + // stop if in maintenance mode + if( OSRM.inMaintenance() == true ) + return; + // check if the URL contains some GET parameter, e.g. for showing a route OSRM.parseParameters(); @@ -263,5 +267,15 @@ OSRM.parseParameters = function(){ }; +// check whether to activate maintenance mode +OSRM.inMaintenance = function(){ + if( OSRM.DEFAULTS.MAINTENANCE == true ) { + document.getElementById('notification-blanket').style.display = "block"; + document.getElementById('notification-toggle').style.display = "none"; + return true; + } + return false; +}; + // onload event OSRM.Browser.onLoadHandler( OSRM.init ); \ No newline at end of file