]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/osm.pm
New upstream version 3.20180228
[git.ikiwiki.info.git] / IkiWiki / Plugin / osm.pm
index c9650d014aa1348f9c83efb77e87c76f20620452..a5af4ed21b1acb89d89d87083643cca729c6be36 100644 (file)
@@ -14,7 +14,7 @@ sub import {
        hook(type => "format", id => "osm", call => \&format);
        hook(type => "preprocess", id => "osm", call => \&preprocess);
        hook(type => "preprocess", id => "waypoint", call => \&process_waypoint);
-       hook(type => "savestate", id => "waypoint", call => \&savestate);
+       hook(type => "changes", id => "waypoint", call => \&changes);
        hook(type => "cgi", id => "osm", call => \&cgi);
 }
 
@@ -280,7 +280,7 @@ sub scrub_lonlat($$$) {
        return ($lon, $lat);
 }
 
-sub savestate {
+sub changes {
        my %waypoints = ();
        my %linestrings = ();
 
@@ -507,7 +507,7 @@ sub include_javascript ($) {
                }
        }
        if ($loader) {
-               return embed_map_code($page) . "<script type=\"text/javascript\" charset=\"utf-8\">$loader</script>";
+               return embed_map_code($page) . "<script type=\"text/javascript\">$loader</script>";
        }
        else {
                return '';
@@ -534,7 +534,7 @@ sub cgi($) {
        print "<html><body>";
        print "<div id=\"mapdiv-$map\"></div>";
        print embed_map_code();
-       print "<script type=\"text/javascript\" charset=\"utf-8\">";
+       print "<script type=\"text/javascript\">";
        print map_setup_code($map, $map,
                lat => "urlParams['lat']",
                lon => "urlParams['lon']",
@@ -589,6 +589,7 @@ sub map_setup_code($;@) {
        }
         $options{'layers'} = $config{osm_layers};
 
+       $name=~s/'//g; # $name comes from user input
        return "mapsetup('mapdiv-$name', " . to_json(\%options) . ");";
 }