var modalloading=false; $('#band').change(function(){ var band = $("#band option:selected").text(); if (band != "SAT") { $("#sats").prop('disabled', true); } else { $("#sats").prop('disabled', false); } }); var map; if (typeof(visitor) !== 'undefined' && visitor != true) { var grid_two = ''; var grid_four = ''; var grid_six = ''; var grid_two_confirmed = ''; var grid_four_confirmed = ''; var grid_six_confirmed = ''; } function gridPlot(form, visitor=true) { $(".ld-ext-right-plot").addClass('running'); $(".ld-ext-right-plot").prop('disabled', true); $('#plot').prop("disabled", true); // If map is already initialized var container = L.DomUtil.get('gridsquare_map'); if(container != null){ container._leaflet_id = null; container.remove(); $("#gridmapcontainer").append('
'); } if (typeof type == 'undefined') { type=''; } if (type == "activated") { ajax_url = site_url + '/activated_gridmap/getGridsjs'; } else if (type == "worked") { ajax_url = site_url + '/gridmap/getGridsjs'; } else { ajax_url = site_url + '/gridmap/getGridsjs'; } if (visitor != true) { $.ajax({ url: ajax_url, type: 'post', data: { band: $("#band").val(), mode: $("#mode").val(), qsl: $("#qsl").is(":checked"), lotw: $("#lotw").is(":checked"), eqsl: $("#eqsl").is(":checked"), qrz: $("#qrz").is(":checked"), sat: $("#sats").val(), }, success: function (data) { console.log(data); $('.cohidden').show(); $(".ld-ext-right-plot").removeClass('running'); $(".ld-ext-right-plot").prop('disabled', false); $('#plot').prop("disabled", false); grid_two = data.grid_2char; grid_four = data.grid_4char; grid_six = data.grid_6char; grid_two_confirmed = data.grid_2char_confirmed; grid_four_confirmed = data.grid_4char_confirmed; grid_six_confirmed = data.grid_6char_confirmed; plot(visitor, grid_two, grid_four, grid_six, grid_two_confirmed, grid_four_confirmed, grid_six_confirmed); }, error: function (data) { }, }); } else { plot(visitor, grid_two, grid_four, grid_six, grid_two_confirmed, grid_four_confirmed, grid_six_confirmed); }; } function plot(visitor, grid_two, grid_four, grid_six, grid_two_confirmed, grid_four_confirmed, grid_six_confirmed) { var layer = L.tileLayer(jslayer, { maxZoom: 12, attribution: jsattribution, id: 'mapbox.streets' }); map = L.map('gridsquare_map', { layers: [layer], center: [19, 0], zoom: 3, minZoom: 2, fullscreenControl: true, fullscreenControlOptions: { position: 'topleft' }, }); if (visitor != true) { var printer = L.easyPrint({ tileLayer: layer, sizeModes: ['Current'], filename: 'myMap', exportOnly: true, hideControlContainer: true }).addTo(map); } /*Legend specific*/ var legend = L.control({ position: "topright" }); legend.onAdd = function(map) { var div = L.DomUtil.create("div", "legend"); div.innerHTML += "