diff --git a/wiki-map.pl b/wiki-map.pl index c6f2c03..be7def4 100644 --- a/wiki-map.pl +++ b/wiki-map.pl @@ -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) } EOS + if($show_coords) + { + $html_builder .= < + function toggleCoords(show) { + for (var elem of document.getElementsByClassName('coords')) { + elem.style.visibility = show ? 'visible' : 'hidden'; + } + } + + + +EOS + } $html_builder .= "\n" . $grid->render; $html_builder .= "\n\n"; return $html_builder;