From a0ceee732ec2e2bac70a0bc9da7275cc6e2eee10 Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Thu, 26 Apr 2012 12:48:01 +0100 Subject: [PATCH] added relative root url for Leaflet --- WebContent/base/leaflet/L.Bugfixes.js | 6 ++++++ WebContent/main.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/WebContent/base/leaflet/L.Bugfixes.js b/WebContent/base/leaflet/L.Bugfixes.js index e1979df15..6d0b0a67b 100644 --- a/WebContent/base/leaflet/L.Bugfixes.js +++ b/WebContent/base/leaflet/L.Bugfixes.js @@ -19,6 +19,12 @@ or see http://www.gnu.org/licenses/agpl.txt. // [assorted bugfixes to Leaflet functions we use] +// find relative leaflet URL +var i = 0; +while( L.ROOT_URL[i] == document.URL[i] ) { i++; } +L.RELATIVE_ROOT_URL = L.ROOT_URL.slice(i); + + // return closest point on segment or distance to that point L.LineUtil._sqClosestPointOnSegment = function (p, p1, p2, sqDist) { var x = p1.x, diff --git a/WebContent/main.js b/WebContent/main.js index 0631c3743..313c5a39e 100644 --- a/WebContent/main.js +++ b/WebContent/main.js @@ -42,7 +42,7 @@ OSRM.init = function() { // prefetch images OSRM.GLOBALS.images = {}; OSRM.prefetchImages = function() { - var image_list = [ {id:'marker-shadow', url:L.ROOT_URL + 'images/marker-shadow.png'}, + var image_list = [ {id:'marker-shadow', url:L.RELATIVE_ROOT_URL + 'images/marker-shadow.png'}, {id:'marker-source', url:'images/marker-source.png'}, {id:'marker-target', url:'images/marker-target.png'}, {id:'marker-via', url:'images/marker-via.png'},