[Contest logging] CAT added. Split some of the JS into it's own file. Frequency is also saved.
这个提交包含在:
父节点
2229a1579b
当前提交
f784507435
共有 3 个文件被更改,包括 210 次插入 和 167 次删除
|
|
@ -90,6 +90,21 @@
|
|||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="frequency">Frequency</label>
|
||||
<input type="text" class="form-control form-control-sm" id="frequency" name="freq_display" value="<?php echo $this->session->userdata('freq'); ?>" />
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<label for="inputRadio">Radio</label>
|
||||
<select class="form-control form-control-sm radios" id="radio" name="radio">
|
||||
<option value="0" selected="selected">None</option>
|
||||
<?php foreach ($radios->result() as $row) { ?>
|
||||
<option value="<?php echo $row->id; ?>" <?php if($this->session->userdata('radio') == $row->id) { echo "selected=\"selected\""; } ?>><?php echo $row->radio; ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
|
|
|
|||
|
|
@ -918,6 +918,20 @@ $(document).on('change', 'input', function(){
|
|||
setRst($('.mode') .val());
|
||||
});
|
||||
|
||||
|
||||
|
||||
function convert_case(str) {
|
||||
var lower = str.toLowerCase();
|
||||
return lower.replace(/(^| )(\w)/g, function(x) {
|
||||
return x.toUpperCase();
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?php } ?>
|
||||
<?php if ( ($this->uri->segment(1) == "qso" && $_GET['manual'] == 0) || $this->uri->segment(1) == "contesting") { ?>
|
||||
<script>
|
||||
function setRst(mode) {
|
||||
if(mode == 'JT65' || mode == 'JT65B' || mode == 'JT6C' || mode == 'JTMS' || mode == 'ISCAT' || mode == 'MSK144' || mode == 'JTMSK' || mode == 'QRA64' || mode == 'FT8' || mode == 'FT4' || mode == 'JS8' || mode == 'JT9' || mode == 'JT9-1' || mode == 'ROS'){
|
||||
$('#rst_sent').val('-5');
|
||||
|
|
@ -933,10 +947,11 @@ $(document).on('change', 'input', function(){
|
|||
$('#rst_recv').val('59');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Javascript for controlling rig frequency. */
|
||||
<?php if ( $_GET['manual'] == 0 ) { ?>
|
||||
</script>
|
||||
<?php } ?>
|
||||
<?php if ( ($this->uri->segment(1) == "qso" && $_GET['manual'] == 0) || $this->uri->segment(1) == "contesting") { ?>
|
||||
<script>
|
||||
// Javascript for controlling rig frequency.
|
||||
var updateFromCAT = function() {
|
||||
if($('select.radios option:selected').val() != '0') {
|
||||
radioID = $('select.radios option:selected').val();
|
||||
|
|
@ -1010,16 +1025,6 @@ $(document).on('change', 'input', function(){
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
<?php } ?>
|
||||
|
||||
function convert_case(str) {
|
||||
var lower = str.toLowerCase();
|
||||
return lower.replace(/(^| )(\w)/g, function(x) {
|
||||
return x.toUpperCase();
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?php } ?>
|
||||
|
|
@ -2437,96 +2442,8 @@ function deleteQsl(id) {
|
|||
}
|
||||
</script>
|
||||
<?php if ($this->uri->segment(1) == "contesting") { ?>
|
||||
<script src="<?php echo base_url() ;?>assets/js/sections/contesting.js"></script>
|
||||
<script>
|
||||
|
||||
// Callsign always has focus on load
|
||||
$("#callsign").focus();
|
||||
|
||||
// Init serial sent as 1 when lading page
|
||||
$("#exch_sent").val(1);
|
||||
|
||||
// realtime clock
|
||||
$(function($) {
|
||||
var options = {
|
||||
utc: true,
|
||||
format: '%H:%M:%S'
|
||||
}
|
||||
$('.input_time').jclock(options);
|
||||
});
|
||||
|
||||
$(function($) {
|
||||
var options = {
|
||||
utc: true,
|
||||
format: '%d-%m-%Y'
|
||||
}
|
||||
$('.input_date').jclock(options);
|
||||
});
|
||||
|
||||
// We don't want spaces to be written in callsign
|
||||
$(function() {
|
||||
$('#callsign').on('keypress', function(e) {
|
||||
if (e.which == 32){
|
||||
//console.log('Space Detected');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// We don't want spaces to be written in exchange
|
||||
$(function() {
|
||||
$('#exch_recv').on('keypress', function(e) {
|
||||
if (e.which == 32){
|
||||
//console.log('Space Detected');
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Here we capture keystrokes fo execute functions
|
||||
document.onkeyup = function(e) {
|
||||
// ALT-W wipe
|
||||
if (e.altKey && e.which == 87) {
|
||||
reset_log_fields();
|
||||
} else if ((e.keyCode == 10 || e.keyCode == 13) && (e.ctrlKey || e.metaKey)) {
|
||||
logQso();
|
||||
} else if (e.which == 27) {
|
||||
reset_log_fields();
|
||||
// Space to jump to either callsign or sent exchange
|
||||
} else if (e.which == 32) {
|
||||
if ($(document.activeElement).attr("id") == "callsign") {
|
||||
$("#exch_recv").focus();
|
||||
return false;
|
||||
} else if ($(document.activeElement).attr("id") == "exch_recv") {
|
||||
$("#callsign").focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// On Key up check and suggest callsigns
|
||||
$("#callsign").keyup(function() {
|
||||
var call = $(this).val();
|
||||
if (call.length >= 3) {
|
||||
$.get('lookup/scp/' + call.toUpperCase(), function(result) {
|
||||
$('.callsign-suggestions').text(result);
|
||||
highlight(call.toUpperCase());
|
||||
});
|
||||
}
|
||||
else if (call.length <= 2) {
|
||||
$('.callsign-suggestions').text("");
|
||||
}
|
||||
});
|
||||
|
||||
function reset_log_fields() {
|
||||
$('#name').val("");
|
||||
$('.callsign-suggestions').text("");
|
||||
$('#callsign').val("");
|
||||
$('#comment').val("");
|
||||
$('#exch_recv').val("");
|
||||
$("#callsign").focus();
|
||||
}
|
||||
|
||||
function logQso() {
|
||||
if ($("#callsign").val().length > 0) {
|
||||
|
||||
|
|
@ -2565,28 +2482,8 @@ function deleteQsl(id) {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
RegExp.escape = function(text) {
|
||||
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
||||
}
|
||||
|
||||
function highlight(term, base) {
|
||||
if (!term) return;
|
||||
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) {
|
||||
if (el.nodeType === 3) {
|
||||
var data = el.data;
|
||||
if (data = data.replace(re, replacement)) {
|
||||
var wrapper = $("<span>").html(data);
|
||||
$(el).before(wrapper.contents()).remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?php } ?>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
131
assets/js/sections/contesting.js
普通文件
131
assets/js/sections/contesting.js
普通文件
|
|
@ -0,0 +1,131 @@
|
|||
// Callsign always has focus on load
|
||||
$("#callsign").focus();
|
||||
|
||||
// Init serial sent as 1 when loading page
|
||||
$("#exch_sent").val(1);
|
||||
|
||||
// realtime clock
|
||||
$(function($) {
|
||||
var options = {
|
||||
utc: true,
|
||||
format: '%H:%M:%S'
|
||||
}
|
||||
$('.input_time').jclock(options);
|
||||
});
|
||||
|
||||
$(function($) {
|
||||
var options = {
|
||||
utc: true,
|
||||
format: '%d-%m-%Y'
|
||||
}
|
||||
$('.input_date').jclock(options);
|
||||
});
|
||||
|
||||
// We don't want spaces to be written in callsign
|
||||
$(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){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Here we capture keystrokes fo execute functions
|
||||
document.onkeyup = function(e) {
|
||||
// ALT-W wipe
|
||||
if (e.altKey && e.which == 87) {
|
||||
reset_log_fields();
|
||||
} else if ((e.keyCode == 10 || e.keyCode == 13) && (e.ctrlKey || e.metaKey)) {
|
||||
logQso();
|
||||
} else if (e.which == 27) {
|
||||
reset_log_fields();
|
||||
// Space to jump to either callsign or sent exchange
|
||||
} else if (e.which == 32) {
|
||||
if ($(document.activeElement).attr("id") == "callsign") {
|
||||
$("#exch_recv").focus();
|
||||
return false;
|
||||
} else if ($(document.activeElement).attr("id") == "exch_recv") {
|
||||
$("#callsign").focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// On Key up check and suggest callsigns
|
||||
$("#callsign").keyup(function() {
|
||||
var call = $(this).val();
|
||||
if (call.length >= 3) {
|
||||
$.get('lookup/scp/' + call.toUpperCase(), function(result) {
|
||||
$('.callsign-suggestions').text(result);
|
||||
highlight(call.toUpperCase());
|
||||
});
|
||||
}
|
||||
else if (call.length <= 2) {
|
||||
$('.callsign-suggestions').text("");
|
||||
}
|
||||
});
|
||||
|
||||
function reset_log_fields() {
|
||||
$('#name').val("");
|
||||
$('.callsign-suggestions').text("");
|
||||
$('#callsign').val("");
|
||||
$('#comment').val("");
|
||||
$('#exch_recv').val("");
|
||||
$("#callsign").focus();
|
||||
}
|
||||
|
||||
RegExp.escape = function(text) {
|
||||
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
||||
}
|
||||
|
||||
function highlight(term, base) {
|
||||
if (!term) return;
|
||||
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) {
|
||||
if (el.nodeType === 3) {
|
||||
var data = el.data;
|
||||
if (data = data.replace(re, replacement)) {
|
||||
var wrapper = $("<span>").html(data);
|
||||
$(el).before(wrapper.contents()).remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Only set the frequency when not set by userdata/PHP.
|
||||
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) {
|
||||
$('#frequency').val(result);
|
||||
$('#frequency_rx').val("");
|
||||
});
|
||||
});
|
||||
|
||||
/* Calculate Frequency */
|
||||
/* on band change */
|
||||
$('#band').change(function() {
|
||||
$.get('qso/band_to_freq/' + $(this).val() + '/' + $('.mode').val(), function(result) {
|
||||
$('#frequency').val(result);
|
||||
$('#frequency_rx').val("");
|
||||
});
|
||||
});
|
||||
正在加载…
在新工单中引用