moved localization and printing paths to (internal) variables, so it's
easier to place everything in a different directory
This commit is contained in:
parent
57040e6924
commit
a3cdba5044
@ -21,8 +21,12 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
|
|
||||||
OSRM.Localization = {
|
OSRM.Localization = {
|
||||||
|
|
||||||
|
// default directory for localization files
|
||||||
|
DIRECTORY: "localization/",
|
||||||
|
|
||||||
|
// holds currently active language
|
||||||
current_language: OSRM.DEFAULTS.LANGUAGE,
|
current_language: OSRM.DEFAULTS.LANGUAGE,
|
||||||
|
|
||||||
// initialize localization
|
// initialize localization
|
||||||
init: function() {
|
init: function() {
|
||||||
// create dropdown menu
|
// create dropdown menu
|
||||||
@ -92,7 +96,7 @@ setLanguage: function(language) {
|
|||||||
if( supported_languages[i].encoding == language) {
|
if( supported_languages[i].encoding == language) {
|
||||||
var script = document.createElement('script');
|
var script = document.createElement('script');
|
||||||
script.type = 'text/javascript';
|
script.type = 'text/javascript';
|
||||||
script.src = "localization/OSRM.Locale."+language+".js";
|
script.src = OSRM.Localization.DIRECTORY+"OSRM.Locale."+language+".js";
|
||||||
document.head.appendChild(script);
|
document.head.appendChild(script);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,10 @@ or see http://www.gnu.org/licenses/agpl.txt.
|
|||||||
|
|
||||||
OSRM.Printing = {
|
OSRM.Printing = {
|
||||||
|
|
||||||
|
// directory with printing code, and base OSRM directory relative to this directory
|
||||||
|
DIRECTORY: 'printing/',
|
||||||
|
BASE_DIRECTORY: '../',
|
||||||
|
|
||||||
// create UI for printing in mainwindow
|
// create UI for printing in mainwindow
|
||||||
init: function() {
|
init: function() {
|
||||||
var icon = document.createElement('div');
|
var icon = document.createElement('div');
|
||||||
@ -106,7 +110,7 @@ show: function(response) {
|
|||||||
body += '<tr class="'+rowstyle+'">';
|
body += '<tr class="'+rowstyle+'">';
|
||||||
|
|
||||||
body += '<td class="description-body-directions">';
|
body += '<td class="description-body-directions">';
|
||||||
body += '<img class="description-body-direction" src="../'+OSRM.RoutingDescription._getDrivingInstructionIcon(response.route_instructions[i][0])+'" alt="" />';
|
body += '<img class="description-body-direction" src="'+OSRM.Printing.BASE_DIRECTORY+OSRM.RoutingDescription._getDrivingInstructionIcon(response.route_instructions[i][0])+'" alt="" />';
|
||||||
body += "</td>";
|
body += "</td>";
|
||||||
|
|
||||||
// build route description
|
// build route description
|
||||||
@ -137,7 +141,7 @@ show: function(response) {
|
|||||||
var zoom = print_window.OSRM.drawMap( OSRM.DEFAULTS.TILE_SERVERS[tile_server_id], new L.LatLngBounds( positions ) );
|
var zoom = print_window.OSRM.drawMap( OSRM.DEFAULTS.TILE_SERVERS[tile_server_id], new L.LatLngBounds( positions ) );
|
||||||
|
|
||||||
// draw markers
|
// draw markers
|
||||||
print_window.OSRM.prefetchIcons( OSRM.G.images );
|
print_window.OSRM.prefetchIcons( OSRM.G.images, OSRM.Printing.BASE_DIRECTORY );
|
||||||
print_window.OSRM.drawMarkers( OSRM.G.markers.route );
|
print_window.OSRM.drawMarkers( OSRM.G.markers.route );
|
||||||
|
|
||||||
// draw route & query for better geometry
|
// draw route & query for better geometry
|
||||||
@ -164,7 +168,7 @@ openPrintWindow: function() {
|
|||||||
OSRM.G.printwindow.close();
|
OSRM.G.printwindow.close();
|
||||||
|
|
||||||
// generate a new window and wait till it has finished loading
|
// generate a new window and wait till it has finished loading
|
||||||
OSRM.G.printwindow = window.open("printing/printing.html","","width=540,height=500,left=100,top=100,dependent=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes");
|
OSRM.G.printwindow = window.open( OSRM.Printing.DIRECTORY + "printing.html","","width=540,height=500,left=100,top=100,dependent=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@ -182,7 +186,7 @@ printWindowLoaded: function(){
|
|||||||
];
|
];
|
||||||
var stylesheet = OSRM.CSS.getStylesheet("printing.css", print_document);
|
var stylesheet = OSRM.CSS.getStylesheet("printing.css", print_document);
|
||||||
for(var i=0; i<css_list.length; i++) {
|
for(var i=0; i<css_list.length; i++) {
|
||||||
OSRM.CSS.insert( stylesheet, css_list[i].id, "background-image:url("+ "../" + OSRM.G.images[css_list[i].image_id].getAttribute("src") + ");" );
|
OSRM.CSS.insert( stylesheet, css_list[i].id, "background-image:url("+ OSRM.Printing.BASE_DIRECTORY + OSRM.G.images[css_list[i].image_id].getAttribute("src") + ");" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// localization
|
// localization
|
||||||
|
@ -32,7 +32,7 @@ function printWindow() {
|
|||||||
|
|
||||||
//prefetch icons
|
//prefetch icons
|
||||||
OSRM.GLOBALS.icons = {};
|
OSRM.GLOBALS.icons = {};
|
||||||
OSRM.prefetchIcons = function(images_list) {
|
OSRM.prefetchIcons = function(images_list, BASE_DIRECTORY) {
|
||||||
var icon_list = [ {id:'marker-source', image_id:'marker-source'},
|
var icon_list = [ {id:'marker-source', image_id:'marker-source'},
|
||||||
{id:'marker-target', image_id:'marker-target'},
|
{id:'marker-target', image_id:'marker-target'},
|
||||||
{id:'marker-via', image_id:'marker-via'},
|
{id:'marker-via', image_id:'marker-via'},
|
||||||
@ -41,8 +41,8 @@ OSRM.prefetchIcons = function(images_list) {
|
|||||||
|
|
||||||
for(var i=0; i<icon_list.length; i++) {
|
for(var i=0; i<icon_list.length; i++) {
|
||||||
var icon = {
|
var icon = {
|
||||||
iconUrl: "../"+images_list[icon_list[i].image_id].getAttribute("src"), iconSize: new L.Point(25, 41), iconAnchor: new L.Point(13, 41),
|
iconUrl: BASE_DIRECTORY+images_list[icon_list[i].image_id].getAttribute("src"), iconSize: new L.Point(25, 41), iconAnchor: new L.Point(13, 41),
|
||||||
shadowUrl: "../"+images_list["marker-shadow"].getAttribute("src"), shadowSize: new L.Point(41, 41),
|
shadowUrl: BASE_DIRECTORY+images_list["marker-shadow"].getAttribute("src"), shadowSize: new L.Point(41, 41),
|
||||||
popupAnchor: new L.Point(0, -33)
|
popupAnchor: new L.Point(0, -33)
|
||||||
};
|
};
|
||||||
OSRM.G.icons[icon_list[i].id] = new L.SwitchableIcon(icon);
|
OSRM.G.icons[icon_list[i].id] = new L.SwitchableIcon(icon);
|
||||||
|
Loading…
Reference in New Issue
Block a user