Compare commits

...

2 Commits

  1. 2
      README.md
  2. 16
      wiki-map.pl

@ -54,7 +54,7 @@ These are not settable in the script but can be added if desired.
<dt>--show-coords</dt>
<dd>
Include coordinates in the image.
Eventual goal is to have them be toggleable in the HTML output mode.
If included in the html document, a checkbox to toggle their visibility is added.
</dd>
</dl>
Output options. See above.

@ -162,9 +162,9 @@ foreach my $page (values %{$location_query_results->{query}{pages}})
my ($nw, $sw) = ($1, $2);
$location->make_tile_at($nw, $sw);
my $region_name = $parsed_template->{positional_params}[1];
$region_grids{$region_name}->add_region($location);
if($regiondir)
{
$region_grids{$region_name}->add_region($location);
my $region_name = $parsed_template->{positional_params}[1];
$region_grids{$region_name}->add_region($location);
@ -314,6 +314,20 @@ sub wrap_in_html($grid)
}
</script>
EOS
if($show_coords)
{
$html_builder .= <<EOS;
<script>
function toggleCoords(show) {
for (var elem of document.getElementsByClassName('coords')) {
elem.style.visibility = show ? 'visible' : 'hidden';
}
}
</script>
<label for="show-coords-checkbox">Show coordinates</label>
<input type="checkbox" checked id="show-coords-checkbox" onclick="toggleCoords(event.srcElement.checked)" />
EOS
}
$html_builder .= "\n" . $grid->render;
$html_builder .= "\n</body>\n</html>";
return $html_builder;

Loading…
Cancel
Save