added some notifications

This commit is contained in:
DennisSchiefer 2012-07-04 16:36:10 +01:00
parent 35bb9efa51
commit 770f3b5979
2 changed files with 22 additions and 19 deletions

View File

@ -23,23 +23,25 @@ OSRM.GUI.extend( {
// notifications // notifications
notifications: [ notifications: [
{ time: 7000,
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.",
_classes: ["Routing"],
_funcs: ["getRoute_Dragging"]
},
{ time: 4000, { time: 4000,
header: "[Tooltip] Clicking and Dragging 2", header: "[Tooltip] Localization",
body: "You can simply click on the map to set source and target markers. " + body: "You can use the pulldown menu in the upper left corner to select your favorite language." +
"Then you can continue and drag the markers over the map or create. " +
"<br/><br/>" + "<br/><br/>" +
"You can even create additional markers by dragging them off of the main route." + "If you cannot find your preferred language, you can help us to provide additionals translations!",
"Markers can be simply deleted by clicking on them.", _classes: [],
_funcs: []
},
{ time: 6000,
header: "[Tooltip] Clicking to set markers",
body: "You can simply click on the map to set a source or target marker. " +
"When you click on a marker again, it will be deleted.",
_classes: ["Map"],
_funcs: ["click"]
},
{ time: 8000,
header: "[Tooltip] Dragging markers",
body: "You can drag a marker over the map and get instantanous route updates. " +
"You can even create additional markers by dragging them off of the main route.",
_classes: ["Routing"], _classes: ["Routing"],
_funcs: ["getRoute_Dragging"] _funcs: ["getRoute_Dragging"]
} }
@ -58,17 +60,17 @@ init: function() {
notifications[i].old_functions = []; notifications[i].old_functions = [];
for(var j=0, jEnd=notifications[i]._classes.length; j<jEnd;j++) { for(var j=0, jEnd=notifications[i]._classes.length; j<jEnd;j++) {
notifications[i].old_functions[j] = OSRM[notifications[i]._classes[j]][notifications[i]._funcs[j]]; notifications[i].old_functions[j] = OSRM[notifications[i]._classes[j]][notifications[i]._funcs[j]];
OSRM[notifications[i]._classes[j]][notifications[i]._funcs[j]] = function(id,id2){ return function(){ OSRM.GUI.notification_wrapper(id,id2);}; }(i,j); OSRM[notifications[i]._classes[j]][notifications[i]._funcs[j]] = function(id,id2){ return function(params){ OSRM.GUI.notification_wrapper(id,id2,params);}; }(i,j);
} }
} }
}, },
// wrapper function to clear timeouts // wrapper function to clear timeouts
notification_wrapper: function(id, id2) { notification_wrapper: function(id, id2, params) {
var notifications = OSRM.GUI.notifications; var notifications = OSRM.GUI.notifications;
clearTimeout( notifications[id].timer ); clearTimeout( notifications[id].timer );
notifications[id].old_functions[id2](); notifications[id].old_functions[id2](params);
for(var j=0, jEnd=notifications[id]._classes.length; j<jEnd;j++) { for(var j=0, jEnd=notifications[id]._classes.length; j<jEnd;j++) {
OSRM[notifications[id]._classes[j]][notifications[id]._funcs[j]] = notifications[id].old_functions[j]; OSRM[notifications[id]._classes[j]][notifications[id]._funcs[j]] = notifications[id].old_functions[j];
} }

View File

@ -305,6 +305,7 @@ OSRM.xdenotify = function() {
document.getElementById('important-notification-blanket').style.display = "none"; document.getElementById('important-notification-blanket').style.display = "none";
}; };
// normal notification box // normal notification box
OSRM.notify = function( header, text ){ OSRM.notify = function( header, text ){
document.getElementById('notification-wrapper').style.display = "block"; document.getElementById('notification-wrapper').style.display = "block";