Merge pull request #1222 from AndreasK79/contest_serial_logic_fix
[Contesting] Pushed fix so that serial is not set when serial is not …
这个提交包含在:
当前提交
9548386868
共有 1 个文件被更改,包括 150 次插入 和 132 次删除
|
|
@ -1,10 +1,7 @@
|
|||
// Callsign always has focus on load
|
||||
$("#callsign").focus();
|
||||
|
||||
// Init serial sent as 1 when loading page
|
||||
$("#exch_serial_s").val(1);
|
||||
|
||||
$( document ).ready(function() {
|
||||
$(document).ready(function () {
|
||||
restoreContestSession();
|
||||
setRst($("#mode").val());
|
||||
});
|
||||
|
|
@ -26,6 +23,7 @@ function reset_contest_session() {
|
|||
$("#callsign").focus();
|
||||
setRst($("#mode").val());
|
||||
$("#exchangetype").val("None");
|
||||
setExchangetype("None");
|
||||
$("#contestname").val("Other").change();
|
||||
$(".contest_qso_table_contents").empty();
|
||||
|
||||
|
|
@ -41,17 +39,17 @@ function reset_contest_session() {
|
|||
}
|
||||
|
||||
// Storing the contestid in contest session
|
||||
$('#contestname').change(function() {
|
||||
$('#contestname').change(function () {
|
||||
localStorage.setItem("contestid", $("#contestname").val());
|
||||
});
|
||||
|
||||
// Storing the exchange type in contest session
|
||||
$('#exchangetype').change(function() {
|
||||
$('#exchangetype').change(function () {
|
||||
localStorage.setItem("exchangetype", $('#exchangetype').val());
|
||||
});
|
||||
|
||||
// realtime clock
|
||||
$(function($) {
|
||||
$(function ($) {
|
||||
var options = {
|
||||
utc: true,
|
||||
format: '%H:%M:%S'
|
||||
|
|
@ -59,7 +57,7 @@ $(function($) {
|
|||
$('.input_time').jclock(options);
|
||||
});
|
||||
|
||||
$(function($) {
|
||||
$(function ($) {
|
||||
var options = {
|
||||
utc: true,
|
||||
format: '%d-%m-%Y'
|
||||
|
|
@ -68,25 +66,25 @@ $(function($) {
|
|||
});
|
||||
|
||||
// We don't want spaces to be written in callsign
|
||||
$(function() {
|
||||
$('#callsign').on('keypress', function(e) {
|
||||
if (e.which == 32){
|
||||
$(function () {
|
||||
$('#callsign').on('keypress', function (e) {
|
||||
if (e.which == 32) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// We don't want spaces to be written in exchange
|
||||
$(function() {
|
||||
$('#exch_recv').on('keypress', function(e) {
|
||||
if (e.which == 32){
|
||||
$(function () {
|
||||
$('#exch_recv').on('keypress', function (e) {
|
||||
if (e.which == 32) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Here we capture keystrokes to execute functions
|
||||
document.onkeyup = function(e) {
|
||||
document.onkeyup = function (e) {
|
||||
// ALT-W wipe
|
||||
if (e.altKey && e.which == 87) {
|
||||
reset_log_fields();
|
||||
|
|
@ -94,7 +92,7 @@ document.onkeyup = function(e) {
|
|||
} else if ((e.keyCode == 10 || e.keyCode == 13) && (e.ctrlKey || e.metaKey)) {
|
||||
logQso();
|
||||
// Enter in sent exchange logs QSO
|
||||
} else if((e.which == 13) && ($(document.activeElement).attr("id") == "exch_recv")) {
|
||||
} else if ((e.which == 13) && ($(document.activeElement).attr("id") == "exch_recv")) {
|
||||
logQso();
|
||||
} else if (e.which == 27) {
|
||||
reset_log_fields();
|
||||
|
|
@ -158,10 +156,10 @@ document.onkeyup = function(e) {
|
|||
};
|
||||
|
||||
// On Key up check and suggest callsigns
|
||||
$("#callsign").keyup(function() {
|
||||
$("#callsign").keyup(function () {
|
||||
var call = $(this).val();
|
||||
if (call.length >= 3) {
|
||||
$.get('lookup/scp/' + call.toUpperCase(), function(result) {
|
||||
$.get('lookup/scp/' + call.toUpperCase(), function (result) {
|
||||
$('.callsign-suggestions').text(result);
|
||||
highlight(call.toUpperCase());
|
||||
});
|
||||
|
|
@ -183,7 +181,7 @@ function reset_log_fields() {
|
|||
setRst($("#mode").val());
|
||||
}
|
||||
|
||||
RegExp.escape = function(text) {
|
||||
RegExp.escape = function (text) {
|
||||
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
||||
}
|
||||
|
||||
|
|
@ -192,7 +190,7 @@ function highlight(term, base) {
|
|||
base = base || document.body;
|
||||
var re = new RegExp("(" + RegExp.escape(term) + ")", "gi");
|
||||
var replacement = "<span class=\"text-primary\">" + term + "</span>";
|
||||
$(".callsign-suggestions", base).contents().each( function(i, el) {
|
||||
$(".callsign-suggestions", base).contents().each(function (i, el) {
|
||||
if (el.nodeType === 3) {
|
||||
var data = el.data;
|
||||
if (data = data.replace(re, replacement)) {
|
||||
|
|
@ -204,17 +202,16 @@ function highlight(term, base) {
|
|||
}
|
||||
|
||||
// Only set the frequency when not set by userdata/PHP.
|
||||
if ($('#frequency').val() == "")
|
||||
{
|
||||
$.get('qso/band_to_freq/' + $('#band').val() + '/' + $('.mode').val(), function(result) {
|
||||
if ($('#frequency').val() == "") {
|
||||
$.get('qso/band_to_freq/' + $('#band').val() + '/' + $('.mode').val(), function (result) {
|
||||
$('#frequency').val(result);
|
||||
$('#frequency_rx').val("");
|
||||
});
|
||||
}
|
||||
|
||||
/* on mode change */
|
||||
$('#mode').change(function() {
|
||||
$.get('qso/band_to_freq/' + $('#band').val() + '/' + $('.mode').val(), function(result) {
|
||||
$('#mode').change(function () {
|
||||
$.get('qso/band_to_freq/' + $('#band').val() + '/' + $('.mode').val(), function (result) {
|
||||
$('#frequency').val(result);
|
||||
$('#frequency_rx').val("");
|
||||
});
|
||||
|
|
@ -223,20 +220,21 @@ $('#mode').change(function() {
|
|||
|
||||
/* Calculate Frequency */
|
||||
/* on band change */
|
||||
$('#band').change(function() {
|
||||
$.get('qso/band_to_freq/' + $(this).val() + '/' + $('.mode').val(), function(result) {
|
||||
$('#band').change(function () {
|
||||
$.get('qso/band_to_freq/' + $(this).val() + '/' + $('.mode').val(), function (result) {
|
||||
$('#frequency').val(result);
|
||||
$('#frequency_rx').val("");
|
||||
});
|
||||
});
|
||||
|
||||
$('#exchangetype').change(function(){
|
||||
$('#exchangetype').change(function () {
|
||||
var exchangetype = $("#exchangetype").val();
|
||||
setExchangetype(exchangetype);
|
||||
});
|
||||
|
||||
function setExchangetype(exchangetype) {
|
||||
if (exchangetype == 'None') {
|
||||
$("#exch_serial_s").val("");
|
||||
$(".exchanger").hide();
|
||||
$(".exchanges").hide();
|
||||
$(".serials").hide();
|
||||
|
|
@ -245,6 +243,7 @@ function setExchangetype(exchangetype) {
|
|||
$(".gridsquares").hide();
|
||||
}
|
||||
else if (exchangetype == 'Exchange') {
|
||||
$("#exch_serial_s").val("");
|
||||
$(".exchanger").show();
|
||||
$(".exchanges").show();
|
||||
$(".serials").hide();
|
||||
|
|
@ -253,6 +252,12 @@ function setExchangetype(exchangetype) {
|
|||
$(".gridsquares").hide();
|
||||
}
|
||||
else if (exchangetype == 'Serial') {
|
||||
var serialsent = localStorage.getItem("serialsent");
|
||||
if (serialsent != null) {
|
||||
$("#exch_serial_s").val(serialsent);
|
||||
} else {
|
||||
$("#exch_serial_s").val(1);
|
||||
}
|
||||
$(".exchanger").hide();
|
||||
$(".exchanges").hide();
|
||||
$(".serials").show();
|
||||
|
|
@ -261,6 +266,12 @@ function setExchangetype(exchangetype) {
|
|||
$(".gridsquares").hide();
|
||||
}
|
||||
else if (exchangetype == 'Serialexchange') {
|
||||
var serialsent = localStorage.getItem("serialsent");
|
||||
if (serialsent != null) {
|
||||
$("#exch_serial_s").val(serialsent);
|
||||
} else {
|
||||
$("#exch_serial_s").val(1);
|
||||
}
|
||||
$(".exchanger").show();
|
||||
$(".exchanges").show();
|
||||
$(".serials").show();
|
||||
|
|
@ -269,6 +280,12 @@ function setExchangetype(exchangetype) {
|
|||
$(".gridsquares").hide();
|
||||
}
|
||||
else if (exchangetype == 'Serialgridsquare') {
|
||||
var serialsent = localStorage.getItem("serialsent");
|
||||
if (serialsent != null) {
|
||||
$("#exch_serial_s").val(serialsent);
|
||||
} else {
|
||||
$("#exch_serial_s").val(1);
|
||||
}
|
||||
$(".exchanger").hide();
|
||||
$(".exchanges").hide();
|
||||
$(".serials").show();
|
||||
|
|
@ -277,6 +294,7 @@ function setExchangetype(exchangetype) {
|
|||
$(".gridsquares").show();
|
||||
}
|
||||
else if (exchangetype == 'Gridsquare') {
|
||||
$("#exch_serial_s").val("");
|
||||
$(".exchanger").hide();
|
||||
$(".exchanges").hide();
|
||||
$(".serials").hide();
|
||||
|
|
@ -305,7 +323,7 @@ function logQso() {
|
|||
}
|
||||
|
||||
var data = [[
|
||||
$("#start_date").val()+ ' ' + $("#start_time").val(),
|
||||
$("#start_date").val() + ' ' + $("#start_time").val(),
|
||||
$("#callsign").val().toUpperCase(),
|
||||
$("#band").val(),
|
||||
$("#mode").val(),
|
||||
|
|
@ -331,7 +349,7 @@ function logQso() {
|
|||
enctype: 'multipart/form-data',
|
||||
success: function (html) {
|
||||
if (localStorage.getItem("qso") == null) {
|
||||
localStorage.setItem("qso", $("#start_date").val()+ ' ' + $("#start_time").val() + ',' + $("#callsign").val().toUpperCase() + ',' + $("#contestname").val());
|
||||
localStorage.setItem("qso", $("#start_date").val() + ' ' + $("#start_time").val() + ',' + $("#callsign").val().toUpperCase() + ',' + $("#contestname").val());
|
||||
}
|
||||
|
||||
$('#name').val("");
|
||||
|
|
@ -411,11 +429,11 @@ function restoreContestSession() {
|
|||
$.ajax({
|
||||
url: base_url + 'index.php/contesting/getSessionQsos',
|
||||
type: 'post',
|
||||
data: {'qso': qsodata,},
|
||||
data: { 'qso': qsodata, },
|
||||
success: function (html) {
|
||||
var mode = '';
|
||||
|
||||
$.each(html, function(){
|
||||
$.each(html, function () {
|
||||
if (this.col_submode == null || this.col_submode == '') {
|
||||
mode = this.col_mode;
|
||||
} else {
|
||||
|
|
@ -423,18 +441,18 @@ function restoreContestSession() {
|
|||
}
|
||||
|
||||
$(".qsotable tbody").prepend('<tr>' +
|
||||
'<td>'+ this.col_time_on + '</td>' +
|
||||
'<td>'+ this.col_call + '</td>' +
|
||||
'<td>'+ this.col_band + '</td>' +
|
||||
'<td>'+ mode + '</td>' +
|
||||
'<td>'+ this.col_rst_sent + '</td>' +
|
||||
'<td>'+ this.col_rst_rcvd + '</td>' +
|
||||
'<td>'+ this.col_stx_string + '</td>' +
|
||||
'<td>'+ this.col_srx_string + '</td>' +
|
||||
'<td>'+ this.col_stx + '</td>' +
|
||||
'<td>'+ this.col_srx + '</td>' +
|
||||
'<td>'+ this.col_gridsquare + '</td>' +
|
||||
'<td>'+ this.col_vucc_grids + '</td>' +
|
||||
'<td>' + this.col_time_on + '</td>' +
|
||||
'<td>' + this.col_call + '</td>' +
|
||||
'<td>' + this.col_band + '</td>' +
|
||||
'<td>' + mode + '</td>' +
|
||||
'<td>' + this.col_rst_sent + '</td>' +
|
||||
'<td>' + this.col_rst_rcvd + '</td>' +
|
||||
'<td>' + this.col_stx_string + '</td>' +
|
||||
'<td>' + this.col_srx_string + '</td>' +
|
||||
'<td>' + this.col_stx + '</td>' +
|
||||
'<td>' + this.col_srx + '</td>' +
|
||||
'<td>' + this.col_gridsquare + '</td>' +
|
||||
'<td>' + this.col_vucc_grids + '</td>' +
|
||||
'</tr>');
|
||||
});
|
||||
if (!$.fn.DataTable.isDataTable('.qsotable')) {
|
||||
|
|
@ -445,7 +463,7 @@ function restoreContestSession() {
|
|||
"scrollCollapse": true,
|
||||
"paging": false,
|
||||
"scrollX": true,
|
||||
"order": [[ 0, "desc" ]]
|
||||
"order": [[0, "desc"]]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
正在加载…
在新工单中引用