[QSO] When entering a callsign the JS will check that the inputted callsign and searched callsign match

这个提交包含在:
Peter Goodhall 2021-03-31 16:51:32 +01:00
父节点 b87e3fafbd
当前提交 c8b307baf7

查看文件

@ -267,6 +267,10 @@ function reset_fields() {
$("#callsign").focusout(function() { $("#callsign").focusout(function() {
if ($(this).val().length >= 3) { if ($(this).val().length >= 3) {
// Temp store the callsign
var temp_callsign = $(this).val();
/* Find and populate DXCC */ /* Find and populate DXCC */
$('.callsign-suggest').hide(); $('.callsign-suggest').hide();
@ -287,140 +291,143 @@ $("#callsign").focusout(function() {
// Replace / in a callsign with - to stop urls breaking // Replace / in a callsign with - to stop urls breaking
$.getJSON('logbook/json/' + find_callsign.replace(/\//g, "-") + '/' + sat_type + '/' + json_band + '/' + json_mode, function(result) $.getJSON('logbook/json/' + find_callsign.replace(/\//g, "-") + '/' + sat_type + '/' + json_band + '/' + json_mode, function(result)
{ {
//$('#country').val(result); lotw_info console.log ("temp callsign" + temp_callsign);
if(result.dxcc.entity != undefined) { console.log("entered callsign" + $('#callsign').val());
$('#country').val(convert_case(result.dxcc.entity)); if($('#callsign').val = temp_callsign){
$('#callsign_info').text(convert_case(result.dxcc.entity));
if($("#sat_name" ).val() != "") { if(result.dxcc.entity != undefined) {
//logbook/jsonlookupgrid/io77/SAT/0/0 $('#country').val(convert_case(result.dxcc.entity));
$.getJSON('logbook/jsonlookupcallsign/' + find_callsign.replace(/\//g, "-") + '/SAT/0/0', function(result) $('#callsign_info').text(convert_case(result.dxcc.entity));
{
// Reset CSS values before updating
$('#callsign').removeClass("workedGrid");
$('#callsign').removeClass("newGrid");
$('#callsign').attr('title', '');
if (result.workedBefore) if($("#sat_name" ).val() != "") {
//logbook/jsonlookupgrid/io77/SAT/0/0
$.getJSON('logbook/jsonlookupcallsign/' + find_callsign.replace(/\//g, "-") + '/SAT/0/0', function(result)
{ {
$('#callsign').addClass("workedGrid"); // Reset CSS values before updating
$('#callsign').attr('title', 'Callsign was already worked in the past on this band and mode!'); $('#callsign').removeClass("workedGrid");
} $('#callsign').removeClass("newGrid");
else $('#callsign').attr('title', '');
{
$('#callsign').addClass("newGrid");
$('#callsign').attr('title', 'New Callsign!');
}
})
} else {
$.getJSON('logbook/jsonlookupcallsign/' + find_callsign.replace(/\//g, "-") + '/0/' + $("#band").val() +'/' + $("#mode").val(), function(result)
{
// Reset CSS values before updating
$('#callsign').removeClass("workedGrid");
$('#callsign').removeClass("newGrid");
$('#callsign').attr('title', '');
if (result.workedBefore) if (result.workedBefore)
{
$('#callsign').addClass("workedGrid");
$('#callsign').attr('title', 'Callsign was already worked in the past on this band and mode!');
}
else
{
$('#callsign').addClass("newGrid");
$('#callsign').attr('title', 'New Callsign!');
}
})
} else {
$.getJSON('logbook/jsonlookupcallsign/' + find_callsign.replace(/\//g, "-") + '/0/' + $("#band").val() +'/' + $("#mode").val(), function(result)
{ {
$('#callsign').addClass("workedGrid"); // Reset CSS values before updating
$('#callsign').attr('title', 'Callsign was already worked in the past on this band and mode!'); $('#callsign').removeClass("workedGrid");
} $('#callsign').removeClass("newGrid");
else $('#callsign').attr('title', '');
{
$('#callsign').addClass("newGrid"); if (result.workedBefore)
$('#callsign').attr('title', 'New Callsign!'); {
} $('#callsign').addClass("workedGrid");
}) $('#callsign').attr('title', 'Callsign was already worked in the past on this band and mode!');
}
else
{
$('#callsign').addClass("newGrid");
$('#callsign').attr('title', 'New Callsign!');
}
})
}
changebadge(result.dxcc.entity);
} }
changebadge(result.dxcc.entity); if(result.lotw_member == "active") {
} $('#lotw_info').text("LoTW");
}
if(result.lotw_member == "active") { $('#dxcc_id').val(result.dxcc.adif);
$('#lotw_info').text("LoTW"); $('#cqz').val(result.dxcc.cqz);
} $('#ituz').val(result.dxcc.ituz);
$('#dxcc_id').val(result.dxcc.adif); var redIcon = L.icon({
$('#cqz').val(result.dxcc.cqz); iconUrl: icon_dot_url,
$('#ituz').val(result.dxcc.ituz); iconSize: [18, 18], // size of the icon
});
// Set Map to Lat/Long
markers.clearLayers();
mymap.setZoom(8);
if (typeof result.latlng !== "undefined" && result.latlng !== false) {
var marker = L.marker([result.latlng[0], result.latlng[1]], {icon: redIcon});
mymap.panTo([result.latlng[0], result.latlng[1]]);
} else {
var marker = L.marker([result.dxcc.lat, result.dxcc.long], {icon: redIcon});
mymap.panTo([result.dxcc.lat, result.dxcc.long]);
}
markers.addLayer(marker).addTo(mymap);
var redIcon = L.icon({ /* Find Locator if the field is empty */
iconUrl: icon_dot_url, if($('#locator').val() == "") {
iconSize: [18, 18], // size of the icon $('#locator').val(result.callsign_qra);
}); $('#locator_info').html(result.bearing);
// Set Map to Lat/Long if (result.callsign_qra != "")
markers.clearLayers();
mymap.setZoom(8);
if (typeof result.latlng !== "undefined" && result.latlng !== false) {
var marker = L.marker([result.latlng[0], result.latlng[1]], {icon: redIcon});
mymap.panTo([result.latlng[0], result.latlng[1]]);
} else {
var marker = L.marker([result.dxcc.lat, result.dxcc.long], {icon: redIcon});
mymap.panTo([result.dxcc.lat, result.dxcc.long]);
}
markers.addLayer(marker).addTo(mymap);
/* Find Locator if the field is empty */
if($('#locator').val() == "") {
$('#locator').val(result.callsign_qra);
$('#locator_info').html(result.bearing);
if (result.callsign_qra != "")
{
if (result.workedBefore)
{ {
$('#locator').addClass("workedGrid"); if (result.workedBefore)
$('#locator').attr('title', 'Grid was already worked in the past'); {
$('#locator').addClass("workedGrid");
$('#locator').attr('title', 'Grid was already worked in the past');
}
else
{
$('#locator').addClass("newGrid");
$('#locator').attr('title', 'New grid!');
}
} }
else else
{ {
$('#locator').addClass("newGrid"); $('#locator').removeClass("workedGrid");
$('#locator').attr('title', 'New grid!'); $('#locator').removeClass("newGrid");
$('#locator').attr('title', '');
} }
}
else
{
$('#locator').removeClass("workedGrid");
$('#locator').removeClass("newGrid");
$('#locator').attr('title', '');
} }
} /* Find Operators Name */
if($('#qsl_via').val() == "") {
$('#qsl_via').val(result.qsl_manager);
}
/* Find Operators Name */ /* Find Operators Name */
if($('#qsl_via').val() == "") { if($('#name').val() == "") {
$('#qsl_via').val(result.qsl_manager); $('#name').val(result.callsign_name);
} }
/* Find Operators Name */ if($('#qth').val() == "") {
if($('#name').val() == "") { $('#qth').val(result.callsign_qth);
$('#name').val(result.callsign_name); }
}
if($('#qth').val() == "") { /*
$('#qth').val(result.callsign_qth); * Update state with returned value
} */
if($("#input_usa_state").val() == "") {
/* $("#input_usa_state").val(result.callsign_state).trigger('change');
* Update state with returned value }
*/
if($("#input_usa_state").val() == "") {
$("#input_usa_state").val(result.callsign_state).trigger('change');
}
if($('#iota_ref').val() == "") { if($('#iota_ref').val() == "") {
$('#iota_ref').val(result.callsign_iota); $('#iota_ref').val(result.callsign_iota);
}
// Hide the last QSO table
$('#qso-last-table').hide();
$('#partial_view').show();
/* display past QSOs */
$('#partial_view').html(result.partial);
} }
// Hide the last QSO table
$('#qso-last-table').hide();
$('#partial_view').show();
/* display past QSOs */
$('#partial_view').html(result.partial);
}); });
} else { } else {
/* Reset fields ... */ /* Reset fields ... */