aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Beaupré <anarcat@koumbit.org>2012-03-03 15:38:01 -0500
committerAntoine Beaupré <anarcat@koumbit.org>2012-03-03 15:38:01 -0500
commit733e9b454e6fc016a36874f81392bdf7c2017f9a (patch)
tree2f6fbd1bbc47f98af77b97a3fc91f5be545901d4
parent8bc28be4fa0a68e2c6b8831f6d2c0021b96e85f8 (diff)
downloadikiwiki-733e9b454e6fc016a36874f81392bdf7c2017f9a.tar
ikiwiki-733e9b454e6fc016a36874f81392bdf7c2017f9a.tar.gz
properly link to javascript underlay
-rw-r--r--IkiWiki/Plugin/osm.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/IkiWiki/Plugin/osm.pm b/IkiWiki/Plugin/osm.pm
index e85d4be62..d8db01dbb 100644
--- a/IkiWiki/Plugin/osm.pm
+++ b/IkiWiki/Plugin/osm.pm
@@ -529,7 +529,7 @@ sub include_javascript ($) {
}
}
if ($loader) {
- return embed_map_code() . "<script type=\"text/javascript\" charset=\"utf-8\">$loader</script>";
+ return embed_map_code($page) . "<script type=\"text/javascript\" charset=\"utf-8\">$loader</script>";
}
else {
return '';
@@ -553,16 +553,17 @@ sub cgi($) {
print ("\r\n");
print "<html><body>";
print "<div id=\"mapdiv-$map\"></div>";
- print embed_map_code($map);
+ print embed_map_code();
print "<script type=\"text/javascript\" charset=\"utf-8\">mapsetup( 'mapdiv-$map', { 'map': '$map', 'lat': urlParams['lat'], 'lon': urlParams['lon'], 'zoom': urlParams['zoom'], 'fullscreen': 1, 'editable': 1, 'format': '" . prefered_format() . "'});</script>";
print "</body></html>";
exit 0;
}
-sub embed_map_code() {
+sub embed_map_code(;$) {
+ my $page=shift;
return '<script src="http://www.openlayers.org/api/OpenLayers.js" type="text/javascript" charset="utf-8"></script>'.
- '<script src="'.urlto("ikiwiki/osm.js", $from).
+ '<script src="'.urlto("ikiwiki/osm.js", $page).
'" type="text/javascript" charset="utf-8"></script>'."\n";
}