mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Merge pull request #2519 from phl0/legendClose
Add function to hide legend on gridmap
This commit is contained in:
@@ -1398,3 +1398,7 @@ svg text.month { fill: #AAA; }
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.legendClose {
|
||||
float: right;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,9 @@ function plot(visitor, grid_two, grid_four, grid_six, grid_two_confirmed, grid_f
|
||||
if (grids != '') {
|
||||
legend.onAdd = function(map) {
|
||||
let div = L.DomUtil.create("div", "legend");
|
||||
html = "<table border=\"0\">";
|
||||
div.setAttribute('id', 'gridmapLegend');
|
||||
html = '<div align="right" class="legendClose"><small><a href="javascript: hideLegend();">X</a></small></div>';
|
||||
html += "<table border=\"0\">";
|
||||
html += '<i style="background: green"></i><span>' + gridsquares_gridsquares_confirmed + ' ('+grid_four_confirmed.length+')</span><br>';
|
||||
html += '<i style="background: red"></i><span>' + gridsquares_gridsquares_not_confirmed + ' ('+(grid_four.length - grid_four_confirmed.length)+')</span><br>';
|
||||
html += '<tr><td><i style="background: #ffd757"></i><span>' + gridsquares_gridsquares_total_worked + ' ('+(Math.round((grid_four.length / grid_max) * 10000) / 100)+'%):</span></td><td style=\"padding-left: 1em; text-align: right;\"><span>'+(grid_four.length)+' / '+grid_max+'</span></td></tr>';
|
||||
@@ -174,6 +176,8 @@ function plot(visitor, grid_two, grid_four, grid_six, grid_two_confirmed, grid_f
|
||||
} else {
|
||||
legend.onAdd = function(map) {
|
||||
let div = L.DomUtil.create("div", "legend");
|
||||
div.setAttribute('id', 'gridmapLegend');
|
||||
div.innerHTML += '<div align="right" class="legendClose"><small><a href="javascript: hideLegend();">X</a></small></div>';
|
||||
div.innerHTML += "<h4>" + gridsquares_gridsquares + "</h4>";
|
||||
div.innerHTML += '<i style="background: green"></i><span>' + gridsquares_gridsquares_confirmed + ' ('+grid_four_confirmed.length+')</span><br>';
|
||||
div.innerHTML += '<i style="background: red"></i><span>' + gridsquares_gridsquares_not_confirmed + ' ('+(grid_four.length - grid_four_confirmed.length)+')</span><br>';
|
||||
@@ -283,6 +287,11 @@ function clearMarkers() {
|
||||
$(".ld-ext-right-clear").prop('disabled', false);
|
||||
}
|
||||
|
||||
function hideLegend() {
|
||||
clearMarkers();
|
||||
$("#gridmapLegend").hide();
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
gridPlot(this.form, visitor);
|
||||
$(window).resize(function () {
|
||||
|
||||
Reference in New Issue
Block a user