Merge pull request #428 from HB9HIL/sfle_style

[SFLE Part 2] Styling Adjustments and Gridsquare Support
This commit is contained in:
HB9HIL
2024-05-31 15:55:53 +02:00
committed by GitHub
20 changed files with 295 additions and 102 deletions

View File

@@ -38,6 +38,24 @@ class SimpleFLE extends CI_Controller {
$this->load->view('simplefle/syntax_help');
}
public function displayOptions() {
$data['callbook_lookup'] = $this->user_options_model->get_options('SimpleFLE',array('option_name'=>'callbook_lookup','option_key'=>'boolean'))->row()->option_value ?? 'true';
$this->load->view('simplefle/options', $data);
}
public function saveOptions() {
if($this->input->post('callbook_lookup')) {
$this->user_options_model->set_option('SimpleFLE', 'callbook_lookup', array('boolean' => xss_clean($this->input->post('callbook_lookup'))));
} else {
log_message('debug', 'SimpleFLE, saveOptions(); No Options to save. No Post Data');
}
}
private function modes_array() {
$this->load->model('modes');
@@ -56,5 +74,4 @@ class SimpleFLE extends CI_Controller {
return $modes;
}
}

View File

@@ -99,3 +99,5 @@ $lang['qso_simplefle_syntax_help_ln7'] = "The first QSO was at 21:34, and the se
$lang['qso_simplefle_syntax_help_ln8'] = "For our next QSO at 21:40 on 14th May, 2021, we changed the band to 40m but still on SSB. If no RST information is given, the syntax will use 59 for every new QSO. Therefore we can add another QSO which took place at the exact same time two days later. The date must be in format YYYY-MM-DD.";
$lang['qso_simplefle_syntax_help_ln9'] = "A full summary of all commands and the necessary syntax can be found in <a href='https://github.com/wavelog/wavelog/wiki/SimpleFLE' target='_blank'>this article</a> of our Wiki.";
$lang['qso_simplefle_options'] = 'Options';

View File

@@ -98,4 +98,6 @@ $lang['qso_simplefle_syntax_help_ln6'] = "我们的下一个 QSO 是在 2021 年
$lang['qso_simplefle_syntax_help_ln7'] = "完整的可用指令和语法可在 Wavelog Wiki 中的 <a href='https://github.com/wavelog/wavelog/wiki/SimpleFLE' target='_blank'>这篇文章</a> 查看。";
$lang['qso_simplefle_syntax_help_ln8'] = "";
$lang['qso_simplefle_syntax_help_ln9'] = "";
$lang['qso_simplefle_options'] = 'Options';

View File

@@ -98,4 +98,6 @@ $lang['qso_simplefle_syntax_help_ln6'] = "If you don't provide any RST informati
$lang['qso_simplefle_syntax_help_ln7'] = "The first QSO was at 21:34, and the second one 2 minutes later at 21:36. We write down 6 because this is the only data that changed here. The information about band and mode didn't change, so this data is omitted.";
$lang['qso_simplefle_syntax_help_ln8'] = "For our next QSO at 21:40 on 14th May, 2021, we changed the band to 40m but still on SSB. If no RST information is given, the syntax will use 59 for every new QSO. Therefore we can add another QSO which took place at the exact same time two days later. The date must be in format YYYY-MM-DD.";
$lang['qso_simplefle_syntax_help_ln9'] = "A full summary of all commands and the necessary syntax can be found in <a href='https://github.com/wavelog/wavelog/wiki/SimpleFLE' target='_blank'>this article</a> of our Wiki.";
$lang['qso_simplefle_options'] = 'Options';

View File

@@ -98,4 +98,6 @@ $lang['qso_simplefle_syntax_help_ln6'] = "If you don't provide any RST informati
$lang['qso_simplefle_syntax_help_ln7'] = "The first QSO was at 21:34, and the second one 2 minutes later at 21:36. We write down 6 because this is the only data that changed here. The information about band and mode didn't change, so this data is omitted.";
$lang['qso_simplefle_syntax_help_ln8'] = "For our next QSO at 21:40 on 14th May, 2021, we changed the band to 40m but still on SSB. If no RST information is given, the syntax will use 59 for every new QSO. Therefore we can add another QSO which took place at the exact same time two days later. The date must be in format YYYY-MM-DD.";
$lang['qso_simplefle_syntax_help_ln9'] = "A full summary of all commands and the necessary syntax can be found in <a href='https://github.com/wavelog/wavelog/wiki/SimpleFLE' target='_blank'>this article</a> of our Wiki.";
$lang['qso_simplefle_options'] = 'Options';

View File

@@ -99,3 +99,5 @@ $lang['qso_simplefle_syntax_help_ln7'] = "The first QSO was at 21:34, and the se
$lang['qso_simplefle_syntax_help_ln8'] = "For our next QSO at 21:40 on 14th May, 2021, we changed the band to 40m but still on SSB. If no RST information is given, the syntax will use 59 for every new QSO. Therefore we can add another QSO which took place at the exact same time two days later. The date must be in format YYYY-MM-DD.";
$lang['qso_simplefle_syntax_help_ln9'] = "A full summary of all commands and the necessary syntax can be found in <a href='https://github.com/wavelog/wavelog/wiki/SimpleFLE' target='_blank'>this article</a> of our Wiki.";
$lang['qso_simplefle_options'] = 'Options';

View File

@@ -99,3 +99,5 @@ $lang['qso_simplefle_syntax_help_ln7'] = "The first QSO was at 21:34, and the se
$lang['qso_simplefle_syntax_help_ln8'] = "For our next QSO at 21:40 on 14th May, 2021, we changed the band to 40m but still on SSB. If no RST information is given, the syntax will use 59 for every new QSO. Therefore we can add another QSO which took place at the exact same time two days later. The date must be in format YYYY-MM-DD.";
$lang['qso_simplefle_syntax_help_ln9'] = "A full summary of all commands and the necessary syntax can be found in <a href='https://github.com/wavelog/wavelog/wiki/SimpleFLE' target='_blank'>this article</a> of our Wiki.";
$lang['qso_simplefle_options'] = 'Options';

View File

@@ -99,3 +99,5 @@ $lang['qso_simplefle_syntax_help_ln7'] = "The first QSO was at 21:34, and the se
$lang['qso_simplefle_syntax_help_ln8'] = "For our next QSO at 21:40 on 14th May, 2021, we changed the band to 40m but still on SSB. If no RST information is given, the syntax will use 59 for every new QSO. Therefore we can add another QSO which took place at the exact same time two days later. The date must be in format YYYY-MM-DD.";
$lang['qso_simplefle_syntax_help_ln9'] = "A full summary of all commands and the necessary syntax can be found in <a href='https://github.com/wavelog/wavelog/wiki/SimpleFLE' target='_blank'>this article</a> of our Wiki.";
$lang['qso_simplefle_options'] = 'Options';

View File

@@ -99,3 +99,5 @@ $lang['qso_simplefle_syntax_help_ln7'] = "Das erste QSO war um 21:34 Uhr, und da
$lang['qso_simplefle_syntax_help_ln8'] = "Für unser nächstes QSO um 21:40 Uhr am 14.05.2021 haben wir das Band auf 40m geändert, sind aber immer noch auf SSB. Wenn keine RST-Informationen angegeben sind, verwendet die Syntax bei jedem neuen QSO 59. Daher können wir ein weiteres QSO hinzufügen welches um die exakt selbe Zeit zwei Tage später stattfand. Das Datum muss im Format YYYY-MM-DD eingegeben werden.";
$lang['qso_simplefle_syntax_help_ln9'] = "Eine vollständige Übersicht aller Befehle und der notwendigen Syntax findest du in <a href='https://github.com/wavelog/wavelog/wiki/SimpleFLE' target='_blank'>diesem Artikel</a> in unserem Wiki.";
$lang['qso_simplefle_options'] = 'Optionen';

View File

@@ -99,3 +99,5 @@ $lang['qso_simplefle_syntax_help_ln7'] = "The first QSO was at 21:34, and the se
$lang['qso_simplefle_syntax_help_ln8'] = "For our next QSO at 21:40 on 14th May, 2021, we changed the band to 40m but still on SSB. If no RST information is given, the syntax will use 59 for every new QSO. Therefore we can add another QSO which took place at the exact same time two days later. The date must be in format YYYY-MM-DD.";
$lang['qso_simplefle_syntax_help_ln9'] = "A full summary of all commands and the necessary syntax can be found in <a href='https://github.com/wavelog/wavelog/wiki/SimpleFLE' target='_blank'>this article</a> of our Wiki.";
$lang['qso_simplefle_options'] = 'Options';

View File

@@ -99,3 +99,5 @@ $lang['qso_simplefle_syntax_help_ln7'] = "The first QSO was at 21:34, and the se
$lang['qso_simplefle_syntax_help_ln8'] = "For our next QSO at 21:40 on 14th May, 2021, we changed the band to 40m but still on SSB. If no RST information is given, the syntax will use 59 for every new QSO. Therefore we can add another QSO which took place at the exact same time two days later. The date must be in format YYYY-MM-DD.";
$lang['qso_simplefle_syntax_help_ln9'] = "A full summary of all commands and the necessary syntax can be found in <a href='https://github.com/wavelog/wavelog/wiki/SimpleFLE' target='_blank'>this article</a> of our Wiki.";
$lang['qso_simplefle_options'] = 'Options';

View File

@@ -99,3 +99,5 @@ $lang['qso_simplefle_syntax_help_ln7'] = "The first QSO was at 21:34, and the se
$lang['qso_simplefle_syntax_help_ln8'] = "For our next QSO at 21:40 on 14th May, 2021, we changed the band to 40m but still on SSB. If no RST information is given, the syntax will use 59 for every new QSO. Therefore we can add another QSO which took place at the exact same time two days later. The date must be in format YYYY-MM-DD.";
$lang['qso_simplefle_syntax_help_ln9'] = "A full summary of all commands and the necessary syntax can be found in <a href='https://github.com/wavelog/wavelog/wiki/SimpleFLE' target='_blank'>this article</a> of our Wiki.";
$lang['qso_simplefle_options'] = 'Options';

View File

@@ -99,3 +99,5 @@ $lang['qso_simplefle_syntax_help_ln7'] = "Первое QSO состоялось
$lang['qso_simplefle_syntax_help_ln8'] = "Для следующего QSO в 21:40 14 мая 2021 года мы сменили диапазон на 40 м, но по-прежнему на SSB. Если информация о RST не указана, то синтаксис будет использовать 59 для каждого нового QSO. Поэтому мы можем добавить еще одно QSO, состоявшееся точно в это же время двумя днями позже. Дата должна быть в формате YYYY-MM-DD.";
$lang['qso_simplefle_syntax_help_ln9'] = "A full summary of all commands and the necessary syntax can be found in <a href='https://github.com/wavelog/wavelog/wiki/SimpleFLE' target='_blank'>this article</a> of our Wiki.";
$lang['qso_simplefle_options'] = 'Options';

View File

@@ -99,3 +99,5 @@ $lang['qso_simplefle_syntax_help_ln7'] = "El primer QSL fue a las 21:34, y el se
$lang['qso_simplefle_syntax_help_ln8'] = "Para nuestro siguiente QSO a las 21:40 el 14 de mayo de 2021, cambiamos la banda a 40m pero seguimos en SSB. Si no se ingresa datos de RST, la sintaxis usará 59 para cada nuevo QSO. Por lo tanto podemos añadir un nuevo QSO que ocurrió a la misma hora dos días después. La fecha debe estar en el formato YYYY-MM-DD.";
$lang['qso_simplefle_syntax_help_ln9'] = "A full summary of all commands and the necessary syntax can be found in <a href='https://github.com/wavelog/wavelog/wiki/SimpleFLE' target='_blank'>this article</a> of our Wiki.";
$lang['qso_simplefle_options'] = 'Options';

View File

@@ -99,3 +99,5 @@ $lang['qso_simplefle_syntax_help_ln7'] = "The first QSO was at 21:34, and the se
$lang['qso_simplefle_syntax_help_ln8'] = "For our next QSO at 21:40 on 14th May, 2021, we changed the band to 40m but still on SSB. If no RST information is given, the syntax will use 59 for every new QSO. Therefore we can add another QSO which took place at the exact same time two days later. The date must be in format YYYY-MM-DD.";
$lang['qso_simplefle_syntax_help_ln9'] = "A full summary of all commands and the necessary syntax can be found in <a href='https://github.com/wavelog/wavelog/wiki/SimpleFLE' target='_blank'>this article</a> of our Wiki.";
$lang['qso_simplefle_options'] = 'Options';

View File

@@ -99,3 +99,5 @@ $lang['qso_simplefle_syntax_help_ln7'] = "The first QSO was at 21:34, and the se
$lang['qso_simplefle_syntax_help_ln8'] = "For our next QSO at 21:40 on 14th May, 2021, we changed the band to 40m but still on SSB. If no RST information is given, the syntax will use 59 for every new QSO. Therefore we can add another QSO which took place at the exact same time two days later. The date must be in format YYYY-MM-DD.";
$lang['qso_simplefle_syntax_help_ln9'] = "A full summary of all commands and the necessary syntax can be found in <a href='https://github.com/wavelog/wavelog/wiki/SimpleFLE' target='_blank'>this article</a> of our Wiki.";
$lang['qso_simplefle_options'] = 'Options';

View File

@@ -16,7 +16,9 @@
var lang_qso_simplefle_syntax_help = "<?php echo lang('qso_simplefle_syntax_help_button'); ?>";
var lang_qso_simplefle_syntax_help_title = "<?php echo lang('qso_simplefle_syntax_help_title'); ?>";
var lang_qso_simplefle_syntax_help_close_w_sample = "<?php echo lang('qso_simplefle_syntax_help_close_w_sample'); ?>";
var lang_qso_simplefle_options = "<?php echo lang('qso_simplefle_options'); ?>";
var lang_admin_close = "<?php echo lang('admin_close'); ?>";
var lang_admin_save = "<?php echo lang('admin_save'); ?>";
var lang_qso_simplefle_error_band = "<?php echo lang('qso_simplefle_error_band'); ?>";
var lang_qso_simplefle_error_mode = "<?php echo lang('qso_simplefle_error_mode'); ?>";
var lang_qso_simplefle_error_time = "<?php echo lang('qso_simplefle_error_time'); ?>";
@@ -56,7 +58,7 @@
<div class="row mt-4">
<!-- START BASIC QSO DATA -->
<div class="card col-xs-12 col-md-4 simplefle" style="border: none">
<div class="card-header">
<?php echo lang('qso_simplefle_qso_data'); ?>
</div>
@@ -108,7 +110,7 @@
<div class="row">
<div class="col">
<p><?php echo lang('qso_simplefle_enter_the_data'); ?></p>
<textarea name="qso" class="form-control qso-area" cols="auto" rows="11" id="textarea"></textarea>
<textarea name="qso" class="form-control qso-area" cols="auto" rows="11" id="sfle_textarea" style="font-family: 'Courier New', sans-serif;"></textarea>
</div>
</div>
</div>
@@ -119,7 +121,7 @@
</div>
<div class="card-body">
<div class="qsoList">
<table class="table contacttable table-striped table-hover sfletable" id="qsoTable">
<table class="table table-striped table-hover sfletable" id="qsoTable">
<thead>
<tr>
<th><?php echo lang('general_word_date'); ?></th>
@@ -129,7 +131,7 @@
<th><?php echo lang('gen_hamradio_mode'); ?></th>
<th><?php echo lang('gen_hamradio_rsts'); ?></th>
<th><?php echo lang('gen_hamradio_rstr'); ?></th>
<th><?php echo lang('gen_hamradio_operator'); ?></th>
<th><?php echo lang('gen_hamradio_gridsquare'); ?></th>
<th><?php echo lang('gen_hamradio_refs'); ?>*</th>
</tr>
</thead>
@@ -141,23 +143,20 @@
<div class="col-6 col-sm-6">
<span class="js-qso-count"></span>
</div>
<div class="col-6 col-sm-6 text-end">
<div class="col-6 col-sm-6 text-end" id="refs_hint">
<?php echo lang('qso_simplefle_refs_hint'); ?>
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-3 col-sm-3">
<div class="btn-group" role="group" aria-label="sfle button group">
<button class="btn btn-primary js-reload-qso"><?php echo lang('qso_simplefle_reload'); ?></button>
</div>
<div class="col-3 col-sm-3">
<button class="btn btn-warning js-save-to-log"><?php echo lang('qso_simplefle_save'); ?></button>
</div>
<div class="col-3 col-sm-3">
<button class="btn btn-danger js-empty-qso"><?php echo lang('qso_simplefle_clear'); ?></button>
</div>
<div class="col-3 col-sm-3">
<button class="btn btn-success" id="js-syntax"><?php echo lang('qso_simplefle_syntax_help_button'); ?></button>
<button class="btn btn-secondary" id="js-options"><?php echo lang('admin_options'); ?></button>
</div>
</div>
</div>

View File

@@ -0,0 +1,20 @@
<!-- <table style="width:100%" class="table-sm table table-hover table-striped table-condensed text-start" id="useroptions">
<thead>
<tr>
<th class="text-start">Option</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>Auto Callbook Lookup</td>
<td>
<div class="form-check">
<input class="form-check-input" name="callbook_lookup" type="checkbox" <?php if (($callbook_lookup ?? "true") == "true") { echo 'checked'; } ?>>
</div>
</td>
</tr>
</tbody>
</table> -->
<p> No Options yet </p>

View File

@@ -716,31 +716,46 @@ div#station_logbooks_linked_table_paginate {
margin-right: 30px;
}
.sfletable {
height: 470px;
@media (min-width: 768px) {
.sfletable.table {
width: 100%;
}
.sfletable.table thead,
.sfletable.table tbody tr {
display: block;
width: 100%;
table-layout: fixed;
display: inline-table;
}
.sfletable.table tbody {
width: 95%;
overflow-y: scroll;
position: absolute;
}
.simplefle {
--bs-card-bg: none;
}
#sfle_textarea {
width: 100%;
box-sizing: border-box;
}
}
.sfletable.table {
width: 100%;
}
@media (max-width: 767px) {
.sfletable.table thead,
.sfletable.table tbody tr {
display: block;
width: 100%;
table-layout: fixed;
display: inline-table;
}
.sfletable.table {
overflow-x: auto;
font-size: 0.8em;
}
.sfletable.table tbody {
width: 95%;
overflow-y: scroll;
max-height: 440px;
position: absolute;
}
.simplefle {
--bs-card-bg: none;
#refs_hint {
font-size: 0.8em;
}
}
.red {

View File

@@ -1,14 +1,65 @@
var $textarea = $("textarea");
var textarea = $("#sfle_textarea");
var qsodate = "";
var qsotime = "";
var band = "";
var mode = "";
var freq = "";
var callsign = "";
var gridsquare = "";
var errors = [];
var qsoList = [];
var modes_regex = modes_regex(Modes);
$(document).ready(function () {
setInterval(updateUTCTime, 1000);
updateUTCTime();
var tabledata = localStorage.getItem(`user_${user_id}_tabledata`);
var mycall = localStorage.getItem(`user_${user_id}_my-call`);
var operator = localStorage.getItem(`user_${user_id}_operator`);
var mysotawwff = localStorage.getItem(`user_${user_id}_my-sota-wwff`);
var qsoarea = localStorage.getItem(`user_${user_id}_qso-area`);
var qsodate = localStorage.getItem(`user_${user_id}_qsodate`);
var myPower = localStorage.getItem(`user_${user_id}_my-power`);
var myGrid = localStorage.getItem(`user_${user_id}_my-grid`);
if (mycall != null) {
$("#station-call").val(mycall);
}
if (operator != null) {
$("#operator").val(operator);
}
if (mysotawwff != null) {
$("#my-sota-wwff").val(mysotawwff);
}
if (qsoarea != null) {
$(".qso-area").val(qsoarea);
}
if (qsodate != null) {
$("#qsodate").val(qsodate);
}
if (myPower != null) {
$("#my-power").val(myPower);
}
if (myGrid != null) {
$("#my-grid").val(myGrid);
}
if (tabledata != null) {
$("#qsoTable").html(tabledata);
handleInput();
}
$(window).on('resize', resizeElements);
$(document).ready(resizeElements);
});
$("#simpleFleInfoButton").click(function (event) {
var awardInfoLines = [
lang_qso_simplefle_info_ln2,
@@ -67,7 +118,7 @@ ssb
33 ok1xxx 4 3
`;
$textarea.val(logData.trim());
textarea.val(logData.trim());
handleInput();
BootstrapDialog.closeAll();
}
@@ -88,6 +139,63 @@ ssb
});
});
$("#js-options").click(function (event) {
$("#js-options").prop("disabled", false);
$.ajax({
url: base_url + "index.php/simplefle/displayOptions",
type: "post",
success: function (html) {
BootstrapDialog.show({
title: "<h4>" + lang_qso_simplefle_options + "</h4>",
nl2br: false,
message: html,
buttons: [
{
label: lang_admin_save,
cssClass: 'btn-primary btn-sm',
id: 'saveButton',
action: function (dialogItself) {
$('#optionButton').prop("disabled", false);
$('#closeButton').prop("disabled", true);
saveOptions();
dialogItself.close();
location.reload();
}
},
{
label: lang_admin_close,
cssClass: 'btn-sm',
id: 'closeButton',
action: function (dialogItself) {
$('#optionButton').prop("disabled", false);
dialogItself.close();
}
},
],
});
},
});
});
function saveOptions() {
$('#saveButton').prop("disabled", true);
$('#closeButton').prop("disabled", true);
$.ajax({
url: base_url + 'index.php/simplefle/saveOptions',
type: 'post',
data: {
callbook_lookup: $('input[name="callbook_lookup"]').is(':checked') ? true : false,
},
success: function(data) {
$('#saveButton').prop("disabled", false);
$('#closeButton').prop("disabled", false);
},
error: function() {
$('#saveButton').prop("disabled", false);
},
});
}
function updateUTCTime() {
const utcTimeElement = document.getElementById("utc-time");
const now = new Date();
@@ -114,17 +222,20 @@ function handleInput() {
var mode = "";
var freq = "";
var callsign = "";
var gridsquare = "";
var sotaWwff = "";
qsoList = [];
$("#qsoTable tbody").empty();
var text = $textarea.val().trim();
var text = textarea.val().trim();
lines = text.split("\n");
lines.forEach((row) => {
var rst_s = null;
var rst_r = null;
var gridsquare = "";
items = row.startsWith("day ") ? [row] : row.split(" ");
var itemNumber = 0;
var call_rec = false;
items.forEach((item) => {
if (item === "") {
@@ -179,9 +290,14 @@ function handleInput() {
} else if (
item.match(
/([a-zA-Z0-9]{1,3}[0-9][a-zA-Z0-9]{0,3}[a-zA-Z])|.*\/([a-zA-Z0-9]{1,3}[0-9][a-zA-Z0-9]{0,3}[a-zA-Z])|([a-zA-Z0-9]{1,3}[0-9][a-zA-Z0-9]{0,3}[a-zA-Z])\/.*/
)
) && call_rec !== true
) {
callsign = item.toUpperCase();
call_rec = true;
} else if (
item.match(/^[A-R]{2}[0-9]{2}([A-X]{2}([0-9]{2}([A-X]{2})?)?)?$/i)
) {
gridsquare = item.toUpperCase();
} else if (itemNumber > 0 && item.match(/^[-+]\d{1,2}|\d{1,3}$|\d{1,3}[-+]d{1,2}$/)) {
if (rst_s === null) {
rst_s = item;
@@ -230,6 +346,7 @@ function handleInput() {
freq,
band,
mode,
gridsquare,
rst_s,
rst_r,
sotaWwff,
@@ -255,7 +372,7 @@ function handleInput() {
<td>${mode}</td>
<td>${rst_s}</td>
<td>${rst_r}</td>
<td>${operator}</td>
<td>${gridsquare}</td>
<td>${sotaWwffText}</td>
</tr>`);
@@ -343,23 +460,23 @@ function checkMainFieldsErrors() {
$("#operator").css("border", "");
$("#warningOperatorField").hide();
}
if ($("textarea").val() === "") {
$("#textarea").css("border", "2px solid rgb(217, 83, 79)");
if (textarea.val() === "") {
textarea.css("border", "2px solid rgb(217, 83, 79)");
setTimeout(function () {
$("#textarea").css("border", "");
textarea.css("border", "");
}, 2000);
} else {
$("#textarea").css("border", "");
textarea.css("border", "");
}
}
$textarea.keydown(function (event) {
textarea.keydown(function (event) {
if (event.which == 13) {
handleInput();
}
});
$textarea.focus(function () {
textarea.focus(function () {
errors = [];
checkMainFieldsErrors();
showErrors();
@@ -596,11 +713,11 @@ function isTimeEntered() {
}
function isExampleDataEntered() {
let isExampleData = false;
if (textarea.value.startsWith("*example-data*")) {
isExampleData = true;
}
return isExampleData;
let isExampleData = false;
if (textarea.val().startsWith("*example-data*")) {
isExampleData = true;
}
return isExampleData;
}
function getAdifTag(tagName, value) {
@@ -703,57 +820,50 @@ function isWWFF(value) {
return false;
}
$(document).ready(function () {
setInterval(updateUTCTime, 1000);
updateUTCTime();
var tabledata = localStorage.getItem(`user_${user_id}_tabledata`);
var mycall = localStorage.getItem(`user_${user_id}_my-call`);
var operator = localStorage.getItem(`user_${user_id}_operator`);
var mysotawwff = localStorage.getItem(`user_${user_id}_my-sota-wwff`);
var qsoarea = localStorage.getItem(`user_${user_id}_qso-area`);
var qsodate = localStorage.getItem(`user_${user_id}_qsodate`);
var myPower = localStorage.getItem(`user_${user_id}_my-power`);
var myGrid = localStorage.getItem(`user_${user_id}_my-grid`);
function resizeElements() {
var textarea = $('#sfle_textarea');
var textareaOffset = 40;
if (mycall != null) {
$("#station-call").val(mycall);
}
var tableFrame = $('.sfletable.table');
var tableFrameOffset = 140;
if (operator != null) {
$("#operator").val(operator);
}
var table = $('#qsoTableBody');
var tableoOffset = 160;
if (mysotawwff != null) {
$("#my-sota-wwff").val(mysotawwff);
}
if ($(window).width() >= 768) {
var newHeight = $(window).height() - textarea.offset().top - textareaOffset;
textarea.css('height', newHeight + 'px');
if (qsoarea != null) {
$(".qso-area").val(qsoarea);
}
var newHeight = $(window).height() - tableFrame.offset().top - tableFrameOffset;
tableFrame.css('height', newHeight + 'px');
if (qsodate != null) {
$("#qsodate").val(qsodate);
}
var newHeight = $(window).height() - table.offset().top - tableoOffset;
table.css('height', newHeight + 'px');
if (myPower != null) {
$("#my-power").val(myPower);
}
$('.js-reload-qso').removeClass('btn-sm');
$('.js-save-to-log').removeClass('btn-sm');
$('.js-empty-qso').removeClass('btn-sm');
$('#js-syntax').removeClass('btn-sm');
$('#js-options').removeClass('btn-sm');
if (myGrid != null) {
$("#my-grid").val(myGrid);
}
} else {
textarea.css('height', 'auto');
tableFrame.css('height', '530px');
table.css('height', '400px');
if (tabledata != null) {
$("#qsoTable").html(tabledata);
handleInput();
$('.js-reload-qso').addClass('btn-sm');
$('.js-save-to-log').addClass('btn-sm');
$('.js-empty-qso').addClass('btn-sm');
$('#js-syntax').addClass('btn-sm');
$('#js-options').addClass('btn-sm');
}
});
}
$(".js-save-to-log").click(function () {
if ($("textarea").val() === "") {
$("#textarea").css("border", "2px solid rgb(217, 83, 79)");
if (textarea.val() === "") {
textarea.css("border", "2px solid rgb(217, 83, 79)");
setTimeout(function () {
$("#textarea").css("border", "");
textarea.css("border", "");
}, 2000);
return false;
}
@@ -811,8 +921,9 @@ $(".js-save-to-log").click(function () {
qsoList.forEach((item) => {
var callsign = item[2];
var gridsquare = item[6];
var rst_rcvd = item[7].replace(/dB$/, ''); // we don't want 'dB' in the database
var rst_sent = item[6].replace(/dB$/, ''); // *
var rst_sent = item[8].replace(/dB$/, ''); // *
var start_date = item[0];
var start_time =
item[1][0] +
@@ -828,14 +939,14 @@ $(".js-save-to-log").click(function () {
var iota_ref = "";
var pota_ref = "";
var wwff_ref = "";
if (isSOTA(item[8])) {
sota_ref = item[8];
} else if (isIOTA(item[8])) {
iota_ref = item[8];
} else if (isPOTA(item[8])) {
pota_ref = item[8];
} else if (isWWFF(item[8])) {
wwff_ref = item[8];
if (isSOTA(item[9])) {
sota_ref = item[9];
} else if (isIOTA(item[9])) {
iota_ref = item[9];
} else if (isPOTA(item[9])) {
pota_ref = item[9];
} else if (isWWFF(item[9])) {
wwff_ref = item[9];
}
$.ajax({
@@ -843,6 +954,7 @@ $(".js-save-to-log").click(function () {
type: "post",
data: {
callsign: callsign,
locator: gridsquare,
rst_rcvd: rst_rcvd,
rst_sent: rst_sent,
start_date: start_date,
@@ -870,4 +982,4 @@ $(".js-save-to-log").click(function () {
},
});
}
});
});