added notifications
This commit is contained in:
parent
c07f87edca
commit
c38c0b6f03
@ -99,6 +99,7 @@ onDrag: function(e) {
|
|||||||
OSRM.Geocoder.updateLocation( this.parent.label );
|
OSRM.Geocoder.updateLocation( this.parent.label );
|
||||||
},
|
},
|
||||||
onDragStart: function(e) {
|
onDragStart: function(e) {
|
||||||
|
OSRM.GUI.clear_timeout(0);
|
||||||
OSRM.G.dragging = true;
|
OSRM.G.dragging = true;
|
||||||
this.switchIcon(this.options.dragicon);
|
this.switchIcon(this.options.dragicon);
|
||||||
|
|
||||||
|
56
WebContent/gui/OSRM.Timers.js
Normal file
56
WebContent/gui/OSRM.Timers.js
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU AFFERO General Public License as published by
|
||||||
|
the Free Software Foundation; either version 3 of the License, or
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
or see http://www.gnu.org/licenses/agpl.txt.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// OSRM Timers
|
||||||
|
// [handles notification timers]
|
||||||
|
|
||||||
|
|
||||||
|
OSRM.GUI.extend( {
|
||||||
|
|
||||||
|
// notifications
|
||||||
|
notifications: [
|
||||||
|
{ time:30000,
|
||||||
|
header: "[Tooltip] Clicking and Dragging",
|
||||||
|
body: "You can simply click on the map to set source and target markers. " +
|
||||||
|
"Then you can continue and drag the markers over the map or create. " +
|
||||||
|
"<br/><br/>" +
|
||||||
|
"You can even create additional markers by dragging them off of the main route." +
|
||||||
|
"Markers can be simply deleted by clicking on them."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
// init
|
||||||
|
init: function() {
|
||||||
|
// init variables
|
||||||
|
var notifications = OSRM.GUI.notifications;
|
||||||
|
OSRM.G.notification_timers = new Array( notifications.length );
|
||||||
|
|
||||||
|
// init timers
|
||||||
|
for( var i=0, iEnd=notifications.length; i<iEnd; ++i)
|
||||||
|
OSRM.G.notification_timers[i] = setTimeout( function(id){ return function(){ OSRM.GUI.timeout(id);}; }(i), notifications[i].time);
|
||||||
|
},
|
||||||
|
|
||||||
|
//
|
||||||
|
timeout: function(id) {
|
||||||
|
OSRM.notify( OSRM.GUI.notifications[id].header, OSRM.GUI.notifications[id].body, true );
|
||||||
|
},
|
||||||
|
|
||||||
|
clear_timeout: function(id) {
|
||||||
|
clearTimeout( OSRM.G.notification_timers[id] );
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
@ -64,6 +64,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
<script src="gui/OSRM.GUIBoxHandle.js" type="text/javascript"></script>
|
<script src="gui/OSRM.GUIBoxHandle.js" type="text/javascript"></script>
|
||||||
<script src="gui/OSRM.Selector.js" type="text/javascript"></script>
|
<script src="gui/OSRM.Selector.js" type="text/javascript"></script>
|
||||||
<script src="gui/OSRM.MainGUI.js" type="text/javascript"></script>
|
<script src="gui/OSRM.MainGUI.js" type="text/javascript"></script>
|
||||||
|
<script src="gui/OSRM.Timers.js" type="text/javascript"></script>
|
||||||
<script src="routing/OSRM.Routing.js" type="text/javascript"></script>
|
<script src="routing/OSRM.Routing.js" type="text/javascript"></script>
|
||||||
<script src="routing/OSRM.RoutingDescription.js" type="text/javascript"></script>
|
<script src="routing/OSRM.RoutingDescription.js" type="text/javascript"></script>
|
||||||
<script src="routing/OSRM.RoutingGeometry.js" type="text/javascript"></script>
|
<script src="routing/OSRM.RoutingGeometry.js" type="text/javascript"></script>
|
||||||
|
@ -270,14 +270,27 @@ OSRM.parseParameters = function(){
|
|||||||
// check whether to activate maintenance mode
|
// check whether to activate maintenance mode
|
||||||
OSRM.inMaintenance = function(){
|
OSRM.inMaintenance = function(){
|
||||||
if( OSRM.DEFAULTS.MAINTENANCE == true ) {
|
if( OSRM.DEFAULTS.MAINTENANCE == true ) {
|
||||||
document.getElementById('notification-blanket').style.display = "block";
|
OSRM.notify( OSRM.DEFAULTS.MAINTENANCE_HEADER, OSRM.DEFAULTS.MAINTENANCE_TEXT, false);
|
||||||
document.getElementById('notification-label').innerHTML = OSRM.DEFAULTS.MAINTENANCE_HEADER;
|
|
||||||
document.getElementById('notification-box').innerHTML = OSRM.DEFAULTS.MAINTENANCE_TEXT;
|
|
||||||
document.getElementById('notification-toggle').style.display = "none";
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//general notification box
|
||||||
|
OSRM.notify = function( header, text, closable ){
|
||||||
|
document.getElementById('notification-blanket').style.display = "block";
|
||||||
|
document.getElementById('notification-label').innerHTML = header;
|
||||||
|
document.getElementById('notification-box').innerHTML = text;
|
||||||
|
if( closable )
|
||||||
|
document.getElementById('notification-toggle').onclick = OSRM.denotify;
|
||||||
|
else
|
||||||
|
document.getElementById('notification-toggle').style.display = "none";
|
||||||
|
},
|
||||||
|
OSRM.denotify = function() {
|
||||||
|
document.getElementById('notification-blanket').style.display = "none";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// onload event
|
// onload event
|
||||||
OSRM.Browser.onLoadHandler( OSRM.init );
|
OSRM.Browser.onLoadHandler( OSRM.init );
|
Loading…
Reference in New Issue
Block a user