2023-06-19 09:29:46 +00:00
$ ( '#band' ) . change ( function ( ) {
var band = $ ( "#band option:selected" ) . text ( ) ;
if ( band != "SAT" ) {
$ ( "#sats" ) . prop ( 'disabled' , true ) ;
} else {
$ ( "#sats" ) . prop ( 'disabled' , false ) ;
}
} ) ;
2023-06-18 20:01:59 +00:00
var map ;
var grid _two = '' ;
var grid _four = '' ;
var grid _six = '' ;
var grid _two _confirmed = '' ;
var grid _four _confirmed = '' ;
var grid _six _confirmed = '' ;
function gridPlot ( form ) {
2023-06-20 16:39:37 +00:00
$ ( ".ld-ext-right" ) . addClass ( 'running' ) ;
$ ( ".ld-ext-right" ) . prop ( 'disabled' , true ) ;
2023-06-18 20:01:59 +00:00
$ ( '#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 ( '<div id="gridsquare_map" style="width: 100%; height: 800px"></div>' ) ;
}
$ . ajax ( {
url : site _url + '/gridmap/getGridsjs' ,
type : 'post' ,
data : {
band : $ ( "#band" ) . val ( ) ,
mode : $ ( "#mode" ) . val ( ) ,
qsl : $ ( "#qsl" ) . is ( ":checked" ) ,
lotw : $ ( "#lotw" ) . is ( ":checked" ) ,
2023-06-19 09:29:46 +00:00
eqsl : $ ( "#eqsl" ) . is ( ":checked" ) ,
sat : $ ( "#sats" ) . val ( ) ,
2023-06-18 20:01:59 +00:00
} ,
success : function ( data ) {
2023-07-02 14:50:06 +00:00
$ ( '.cohidden' ) . show ( ) ;
2023-06-20 16:39:37 +00:00
$ ( ".ld-ext-right" ) . removeClass ( 'running' ) ;
$ ( ".ld-ext-right" ) . prop ( 'disabled' , false ) ;
2023-06-18 20:01:59 +00:00
$ ( '#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 ;
2023-06-20 16:39:37 +00:00
var layer = L . tileLayer ( jslayer , {
2023-06-18 20:01:59 +00:00
maxZoom : 9 ,
2023-06-20 16:39:37 +00:00
attribution : jsattribution ,
2023-06-18 20:01:59 +00:00
id : 'mapbox.streets'
} ) ;
map = L . map ( 'gridsquare_map' , {
layers : [ layer ] ,
center : [ 19 , 0 ] ,
zoom : 3 ,
minZoom : 2 ,
fullscreenControl : true ,
fullscreenControlOptions : {
position : 'topleft'
} ,
} ) ;
var printer = L . easyPrint ( {
tileLayer : layer ,
sizeModes : [ 'Current' ] ,
filename : 'myMap' ,
exportOnly : true ,
hideControlContainer : true
} ) . addTo ( map ) ;
2023-06-19 09:03:29 +00:00
/*Legend specific*/
var legend = L . control ( { position : "topright" } ) ;
legend . onAdd = function ( map ) {
var div = L . DomUtil . create ( "div" , "legend" ) ;
2023-06-20 19:09:13 +00:00
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>' ;
div . innerHTML += '<i></i><span>' + gridsquares _gridsquares _total _worked + ' (' + grid _four . length + ')</span><br>' ;
2023-06-19 09:03:29 +00:00
return div ;
} ;
legend . addTo ( map ) ;
2023-06-18 20:01:59 +00:00
var maidenhead = L . maidenhead ( ) . addTo ( map ) ;
2023-07-02 14:50:06 +00:00
map . on ( 'mousemove' , onMapMove ) ;
2023-07-12 12:28:08 +00:00
map . on ( 'click' , onMapClick ) ;
2023-06-18 20:01:59 +00:00
} ,
error : function ( data ) {
} ,
} ) ;
}
function spawnGridsquareModal ( loc _4char ) {
$ . ajax ( {
url : base _url + 'index.php/awards/qso_details_ajax' ,
type : 'post' ,
data : {
'Searchphrase' : loc _4char ,
'Band' : $ ( "#band" ) . val ( ) ,
'Mode' : $ ( "#mode" ) . val ( ) ,
'Type' : 'VUCC'
} ,
success : function ( html ) {
BootstrapDialog . show ( {
title : 'QSO Data' ,
cssClass : 'qso-dialog' ,
size : BootstrapDialog . SIZE _WIDE ,
nl2br : false ,
message : html ,
onshown : function ( dialog ) {
2023-07-12 12:28:08 +00:00
2023-06-18 20:01:59 +00:00
$ ( '[data-toggle="tooltip"]' ) . tooltip ( ) ;
$ ( '.contacttable' ) . DataTable ( {
"pageLength" : 25 ,
responsive : false ,
ordering : false ,
"scrollY" : "550px" ,
"scrollCollapse" : true ,
"paging" : false ,
"scrollX" : true ,
dom : 'Bfrtip' ,
buttons : [
'csv'
]
} ) ;
2023-06-20 19:09:13 +00:00
// change color of csv-button if dark mode is chosen
if ( isDarkModeTheme ( ) ) {
$ ( ".buttons-csv" ) . css ( "color" , "white" ) ;
}
2023-06-18 20:01:59 +00:00
} ,
buttons : [ {
label : 'Close' ,
action : function ( dialogItself ) {
dialogItself . close ( ) ;
}
} ]
} ) ;
}
} ) ;
2023-07-04 09:10:16 +00:00
}
$ ( document ) . ready ( function ( ) {
gridPlot ( this . form ) ;
2023-07-12 12:28:08 +00:00
} )