removed jQuery from cookie c

onsent and improoved spot request from table.js
This commit is contained in:
coulisse 2023-01-06 22:05:26 +01:00
parent d80e00ab4c
commit 0a85e94787
11 changed files with 361 additions and 270 deletions

View File

@ -4,6 +4,7 @@ Release v.2.4
- changed dimensions of spots in world dx spost charts
- managed empty data in data providers for charts
- removed jQuery: migrated to vanilla javascript
- for spot refresh get only new spots starting from last rowid
___
Date: 01/01/2023
Release v.2.4

View File

@ -20,7 +20,7 @@ db_insert () {
spotteritu=$(shuf -i 1-90 -n 1)
spottercq=$(shuf -i 1-40 -n 1)
#for epoc use https://www.epochconverter.com/
timestamp=$(shuf -i 1672781935-1672785538 -n 1)
timestamp=$(shuf -i 1672993916-1672997517 -n 1)
cs_letter_1=$(chr $(shuf -i 65-90 -n1))
cs_letter_2=$(chr $(shuf -i 65-90 -n1))
@ -34,7 +34,7 @@ db_insert () {
sudo mysql -uroot dxcluster -e "INSERT INTO spot VALUES (${i},${freq},'${callsign}',${timestamp},'DUMMY TEST','IU1BOW',${spotdxcc},${spotterdxcc},'IU1BOW-2',${spotitu},${spotcq},${spotteritu},${spottercq},NULL,NULL,'5.198.229.129');"
#sudo mysql -uroot dxcluster -e "INSERT INTO spot VALUES (${i},${freq},'${callsign}',UNIX_TIMESTAMP(),'DUMMY TEST','IU1BOW',${spotdxcc},${spotterdxcc},'IU1BOW-2',${spotitu},${spotcq},${spotteritu},${spottercq},NULL,NULL,'5.198.229.129');"
sleep 0.5
sleep 5
p=$(( ${i}*100/${n} ))
echo -ne ${p}'% \r'
done

20
static/js/.eslintrc.yml Normal file
View File

@ -0,0 +1,20 @@
env:
browser: true
es2021: true
extends: eslint:recommended
overrides: []
parserOptions:
ecmaVersion: latest
rules:
indent:
- error
- tab
linebreak-style:
- error
- unix
quotes:
- error
- single
semi:
- error
- never

View File

@ -11,7 +11,8 @@ fetch(qryString)
.then((response) => response.json())
.then((data) => {
try {
rows_list = buildHtmlTable('bodyspot',data, rows_list, my_callsign);
//rows_list = buildHtmlTable('bodyspot',data, rows_list, my_callsign);
tb.build(data,my_callsign);
} catch (err) {
console.log(err);
console.log(err.stack);

View File

@ -3,6 +3,7 @@
*/
function myCallsignSearch() {
callsign=document.getElementById('callsignInput').value;
//construct query parameters
if (callsign.replace(/\s/g, "").length > 0) {
location.href = ('/callsign.html?c=').concat((callsign.trim()).toUpperCase());

View File

@ -1,9 +1,9 @@
/**
* Create a cookie
*
* @param {String} cname cookie name
* @param {string} cvalue cookie value
* @param {integer} exdays the number of the days for cookie expiration
* @param cname {String} cookie name
* @param cvalue {string} cookie value
* @param exdays {integer} the number of the days for cookie expiration
*/
function setCookie(cname, cvalue, exdays) {
const d = new Date();
@ -15,8 +15,8 @@ function setCookie(cname, cvalue, exdays) {
/**
* get a cookie
*
* @param {String} cname cookie name
* @returns {string} cookie value
* @param cname {String} cookie name
* @returns cookie value
*/
function getCookie(cname) {
let name = cname + "=";
@ -38,8 +38,8 @@ function getCookie(cname) {
/**
* format the data refresh string for exhibit on charts
*
* @param {String} date date of the last refresh
* @returns {string} string formatted
* @param date {String} date of the last refresh
* @returns string formatted
*/
function get_last_refresh(data) {
var dt_refresh = new Date(0); // The 0 there is the key, which sets the date to the epoch
@ -141,7 +141,16 @@ function setText(id, newvalue) {
}
function openModal() {
document.getElementById("backdrop").style.display = "block"
document.getElementById("exampleModal").style.display = "block"
document.getElementById("exampleModal").classList.add("show")
}
function closeModal() {
document.getElementById("backdrop").style.display = "none"
document.getElementById("exampleModal").style.display = "none"
document.getElementById("exampleModal").classList.remove("show")
}
/*
function doRefresh(){
@ -154,4 +163,5 @@ plot_dst.refresh(myChart,'/plot_get_dx_spots_trend');
setInterval(function(){doRefresh()}, 5000);
*/
*/

View File

@ -1,11 +1,14 @@
/*
script used to acquire user conset to cookie banner (and set the cookie consent)
*/
var fn = function () {
document.cookie = "cookie_consent=true;SameSite=Strict; Secure;max-age=2592000";
// document.getElementById('cookie-consent-container').hidden = true;
$('#cookie-consent-container').modal('hide')
let cookie_modal = new bootstrap.Modal(document.getElementById('cookie_consent_modal'), {
keyboard: false
})
cookie_modal.show();
//if button is pressed, setting cookie
document.getElementById('cookie_consent_btn').onclick = function(){
setCookie('cookie_consent',true,30);
cookie_modal.hide();
};
document.getElementById('cookie-consent').onclick = fn;
$('#cookie-consent-container').modal({backdrop:"static",keyboard:false})
$('#cookie-consent-container').modal('show')

View File

@ -1,8 +1,262 @@
class table_builder {
/**
* Table builder constructor
* @param selector {string} The html identifier where build the spots table
*/
constructor(selector) {
this.selector=selector;
this.current_data=[];
}
/**
* @return last_rowid {integer} the last rowid
*/
getLastRowId() {
let last_rowid;
if (this.current_data == null) {
last_rowid=0;
} else {
if (this.current_data.length < 1) {
last_rowid=0;
} else {
last_rowid=this.current_data[0].rowid;
}
}
return last_rowid;
}
/**
* @param line {object} with the data of a single spot
* @param isnew {boolean} is the new rows indicator
* @param dt_current {string} current date in dd/mm/yyyy format
* @param callsign {string} optional callsign
* @return a &lt;tr&gt; dom element
*/
#buildRow(line, isnew, dt_current,callsign=""){
const row = document.createElement("tr");
row.id= line.rowid;
if (callsign.length>0) {
if (callsign == line.de) {
row.id= line.rowid;
} else if (callsign == line.dx) {
row.id= line.rowid;
}
} else if (isnew) {
row.className="table-info";
}
//Column: DE search on QRZ
const i_qrzde = document.createElement("i");
i_qrzde.className="bi-search";
i_qrzde.role="button";
i_qrzde.ariaLabel=line.de;
const a_qrzde = document.createElement("a");
a_qrzde.href=qrz_url + line.de;
a_qrzde.target="_blank";
a_qrzde.rel="noopener";
const span_qrzde = document.createElement("span");
//Mark DE if it found in callsign search
if (line.de == callsign) {
const mark_qrzde = document.createElement("mark");
mark_qrzde.textContent = line.de;
span_qrzde.appendChild(mark_qrzde)
} else {
span_qrzde.textContent='\xa0' + line.de;
}
const td_qrzde = document.createElement("td");
a_qrzde.appendChild(i_qrzde);
td_qrzde.appendChild(a_qrzde);
td_qrzde.appendChild(span_qrzde);
row.append(td_qrzde);
//Column: frequency
var freq = Intl.NumberFormat('it-IT', {
style: 'decimal'
}).format(line.freq);
const span_freq = document.createElement("span");
span_freq.className="badge bg-warning text-dark badge-responsive";
span_freq.textContent=freq;
const td_freq = document.createElement("td");
td_freq.appendChild(span_freq);
row.appendChild(td_freq);
//Column: DX (with ADXO Management)
var adxo = findAdxo(my_adxo_events, line.dx);
var adxo_link = '<a href=' + adxo_url + ' target=_blank rel=noopener >NG3K Website</a>'
const i_qrzdx = document.createElement("i");
i_qrzdx.className="bi-search";
i_qrzdx.role="button";
i_qrzdx.ariaLabel=line.dx;
const a_qrzdx = document.createElement("a");
a_qrzdx.href=qrz_url + line.dx;
a_qrzdx.target="_blank";
a_qrzdx.rel="noopener";
const span_qrzdx = document.createElement("span");
//Mark DX if it found in callsign search
const mark_qrzdx = document.createElement("mark");
mark_qrzdx.textContent = line.dx;
if (line.dx == callsign) {
span_qrzdx.appendChild(mark_qrzdx)
} else {
span_qrzdx.textContent='\xa0' + line.dx;
}
if (adxo != undefined) {
const i_adxo = document.createElement("i");
i_adxo.tabIndex=0;
i_adxo.className="bi-megaphone-fill";
i_adxo.style="color: cornflowerblue;";
i_adxo.role="button";
i_adxo.ariaLabel="dx_operations";
i_adxo.setAttribute('data-bs-container', "body" );
i_adxo.setAttribute('data-bs-toggle', "popover" );
i_adxo.setAttribute('data-bs-trigger', "focus" );
i_adxo.setAttribute('data-bs-sanitizer', "true");
i_adxo.setAttribute('data-bs-placement', "auto");
i_adxo.setAttribute('data-bs-html', "true");
i_adxo.setAttribute('data-bs-title', "Announced DX Op.: " + adxo.summary);
i_adxo.setAttribute('data-bs-content', adxo.description + "data from " + adxo_link);
span_qrzdx.appendChild(i_adxo);
}
const td_qrzdx = document.createElement("td");
a_qrzdx.appendChild(i_qrzdx);
td_qrzdx.appendChild(a_qrzdx);
td_qrzdx.append(span_qrzdx);
row.appendChild(td_qrzdx);
//Column: Flag
try {
const span_flag=document.createElement("span");
span_flag.className="img-flag fi fi-" + line.iso;
span_flag.setAttribute('data-bs-container', "body" );
span_flag.setAttribute('data-bs-toggle', "popover" );
span_flag.setAttribute('data-bs-trigger', "hover" );
span_flag.setAttribute('data-bs-placement', "left");
span_flag.setAttribute('data-bs-content', line.country );
const td_flag = document.createElement("td");
td_flag.appendChild(span_flag);
row.appendChild(td_flag);
} catch (err) {
console.log(err);
console.log("error creating flag");
const td_flag = document.createElement("td");
row.appendChild(td_flag);
}
//Column: Country
const td_country_code = document.createElement("td");
td_country_code.className="d-none d-lg-table-cell d-xl-table-cell";
td_country_code.textContent = line.country;
row.appendChild(td_country_code);
//Column: Comment
const td_comm = document.createElement("td");
td_comm.className="d-none d-lg-table-cell d-xl-table-cell";
td_comm.textContent = line.comm;
row.appendChild(td_comm);
//Column: UTC
let dt = new Date(line.time * 1000);
let hh = '00' + dt.getUTCHours();
hh = hh.substring(hh.length - 2, hh.length);
let mi = '00' + dt.getMinutes();
mi = mi.substring(mi.length - 2, mi.length);
let dd = '00' + dt.getUTCDate();
dd = dd.substring(dd.length - 2, dd.length);
let mo = '00' + (Number(dt.getUTCMonth()) + 1);
mo = mo.substring(mo.length - 2, mo.length);
let yy = dt.getUTCFullYear();
let tm = hh + ':' + mi;
dt = dd + '/' + mo + '/' + yy;
const div_date_time = document.createElement("div");
div_date_time.className="d-flex flex-column";
const p_time = document.createElement("div");
p_time.textContent=tm;
div_date_time.appendChild(p_time);
if (dt != dt_current) {
const p_date = document.createElement("div");
p_date.textContent=dt;
div_date_time.appendChild(p_date);
}
row.appendChild(div_date_time);
//Finally append the row created to the table
return row;
}
/**
* Build the table with the spot
*
* @param data {json} The payload with all the spots received from cluster
* @param rl {json} Row List
* @param callsign {string} An optional parameter with the callsign to search
*/
build(data, callsign) {
if (data != null) {
//get current date
let d = new Date();
let dd_current = '00' + d.getUTCDate();
dd_current = dd_current.substring(dd_current.length - 2, dd_current.length);
let mo_current = '00' + (Number(d.getUTCMonth()) + 1);
mo_current = mo_current.substring(mo_current.length - 2, mo_current.length);
let yy_current = d.getUTCFullYear();
let dt_current = dd_current + '/' + mo_current + '/' + yy_current;
//empty the table
document.getElementById(this.selector).replaceChildren();
//insert in table new elements
let merge_data = [];
for (let i = 0; i < data.length; i++) {
document.getElementById(this.selector).append(this.#buildRow(data[i],true,dt_current,callsign));
merge_data.push(data[i]);
}
//insert in html table previous elements
for (let i = 0; i < this.current_data.length-data.length; i++) {
document.getElementById(this.selector).append(this.#buildRow(this.current_data[i],false,dt_current,callsign));
merge_data.push(this.current_data[i]);
}
//replace current data with merge
this.current_data=merge_data;
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'))
var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
return new bootstrap.Popover(popoverTriggerEl)
})
try {
return;
} catch (err) {
return;
}
}
}
} //end class
/********************************************************************************
* javascript used to popolate main table with spots
* ******************************************************************************/
var adxo_url = 'https://www.ng3k.com/misc/adxo.html'
var qrz_url = 'https://www.qrz.com/db/'
const adxo_url = 'https://www.ng3k.com/misc/adxo.html'
const qrz_url = 'https://www.qrz.com/db/'
const tb = new table_builder('bodyspot');
/**
* Decode Announced Dx Operation (ng3k)
@ -12,224 +266,13 @@ var qrz_url = 'https://www.qrz.com/db/'
*/
function findAdxo(adxo, callsign_to_find) {
if (adxo) {
for (var i = 0; i < adxo.length; i++) {
for (let i = 0; i < adxo.length; i++) {
if (adxo[i].callsign == callsign_to_find) {
return adxo[i];
}
}
}
}
/**
* Build the table with the spot
*
* @param selector {string} The html identifier where build the spots table
* @param data {json} The payload with all the spots received from cluster
* @param rl {json} Row List
* @param callsign {string} An optional parameter with the callsign to search
*/
function buildHtmlTable(selector, data, rl, callsign) {
if (data != null) {
var myRows = new Array();
//get current date
var d = new Date();
var dd_current = '00' + d.getUTCDate();
dd_current = dd_current.substring(dd_current.length - 2, dd_current.length);
var mo_current = '00' + (Number(d.getUTCMonth()) + 1);
mo_current = mo_current.substring(mo_current.length - 2, mo_current.length);
var yy_current = d.getUTCFullYear();
dt_current = dd_current + '/' + mo_current + '/' + yy_current;
//empty the table
document.getElementById(selector).replaceChildren();
//insert in table
for (var i = 0; i < data.length; i++) {
myRows[i] = data[i].rowid;
const row = document.createElement("tr");
row.id= data[i].rowid;
var found = rl.find(element => element == data[i].rowid);
if (callsign != undefined) {
if (callsign == data[i].de) {
row.id= data[i].rowid;
} else if (callsign == data[i].dx) {
row.id= data[i].rowid;
}
} else if (found == undefined && rl.length > 0) {
row.className="table-info";
row.id=data[i].rowid;
}
//Column: DE search on QRZ
const i_qrzde = document.createElement("i");
i_qrzde.className="bi-search";
i_qrzde.role="button";
i_qrzde.ariaLabel=data[i].de;
const a_qrzde = document.createElement("a");
a_qrzde.href=qrz_url + data[i].de;
a_qrzde.target="_blank";
a_qrzde.rel="noopener";
const span_qrzde = document.createElement("span");
//Mark DE if it found in callsign search
const mark_qrzde = document.createElement("mark");
mark_qrzde.textContent = textContent=data[i].de;
if (data[i].de == callsign) {
span_qrzde.appendChild(mark_qrzde)
} else {
span_qrzde.textContent='\xa0' + data[i].de;
}
const td_qrzde = document.createElement("td");
a_qrzde.appendChild(i_qrzde);
td_qrzde.appendChild(a_qrzde);
td_qrzde.appendChild(span_qrzde);
row.append(td_qrzde);
//Column: frequency
var freq = Intl.NumberFormat('it-IT', {
style: 'decimal'
}).format(data[i].freq);
const span_freq = document.createElement("span");
span_freq.className="badge bg-warning text-dark badge-responsive";
span_freq.textContent=freq;
const td_freq = document.createElement("td");
td_freq.appendChild(span_freq);
row.appendChild(td_freq);
//Column: DX (with ADXO Management)
var adxo = findAdxo(my_adxo_events, data[i].dx);
var adxo_link = '<a href=' + adxo_url + ' target=_blank rel=noopener >NG3K Website</a>'
const i_qrzdx = document.createElement("i");
i_qrzdx.className="bi-search";
i_qrzdx.role="button";
i_qrzdx.ariaLabel=data[i].dx;
const a_qrzdx = document.createElement("a");
a_qrzdx.href=qrz_url + data[i].dx;
a_qrzdx.target="_blank";
a_qrzdx.rel="noopener";
const span_qrzdx = document.createElement("span");
//Mark DX if it found in callsign search
const mark_qrzdx = document.createElement("mark");
mark_qrzdx.textContent = textContent=data[i].dx;
if (data[i].dx == callsign) {
span_qrzdx.appendChild(mark_qrzdx)
} else {
span_qrzdx.textContent='\xa0' + data[i].dx;
}
if (adxo != undefined) {
const i_adxo = document.createElement("i");
i_adxo.tabIndex=0;
i_adxo.className="bi-megaphone-fill";
i_adxo.style="color: cornflowerblue;";
i_adxo.role="button";
i_adxo.ariaLabel="dx_operations";
i_adxo.setAttribute('data-bs-container', "body" );
i_adxo.setAttribute('data-bs-toggle', "popover" );
i_adxo.setAttribute('data-bs-trigger', "focus" );
i_adxo.setAttribute('data-bs-sanitizer', "true");
i_adxo.setAttribute('data-bs-placement', "auto");
i_adxo.setAttribute('data-bs-html', "true");
i_adxo.setAttribute('data-bs-title', "Announced DX Op.: " + adxo.summary);
i_adxo.setAttribute('data-bs-content', adxo.description + "data from " + adxo_link);
span_qrzdx.appendChild(i_adxo);
}
const td_qrzdx = document.createElement("td");
a_qrzdx.appendChild(i_qrzdx);
td_qrzdx.appendChild(a_qrzdx);
td_qrzdx.append(span_qrzdx);
row.appendChild(td_qrzdx);
//Column: Flag
try {
const span_flag=document.createElement("span");
span_flag.className="img-flag fi fi-" + data[i].iso;
span_flag.setAttribute('data-bs-container', "body" );
span_flag.setAttribute('data-bs-toggle', "popover" );
span_flag.setAttribute('data-bs-trigger', "hover" );
span_flag.setAttribute('data-bs-placement', "left");
span_flag.setAttribute('data-bs-content', data[i].country );
const td_flag = document.createElement("td");
td_flag.appendChild(span_flag);
row.appendChild(td_flag);
} catch (err) {
console.log(err);
console.log("error creating flag");
const td_flag = document.createElement("td");
row.appendChild(td_flag);
}
//Column: Country
const td_country_code = document.createElement("td");
td_country_code.className="d-none d-lg-table-cell d-xl-table-cell";
td_country_code.textContent = data[i].country;
row.appendChild(td_country_code);
//Column: Comment
const td_comm = document.createElement("td");
td_comm.className="d-none d-lg-table-cell d-xl-table-cell";
td_comm.textContent = data[i].comm;
row.appendChild(td_comm);
//Column: UTC
var dt = new Date(data[i].time * 1000);
var hh = '00' + dt.getUTCHours();
hh = hh.substring(hh.length - 2, hh.length);
var mi = '00' + dt.getMinutes();
mi = mi.substring(mi.length - 2, mi.length);
var dd = '00' + dt.getUTCDate();
dd = dd.substring(dd.length - 2, dd.length);
var mo = '00' + (Number(dt.getUTCMonth()) + 1);
mo = mo.substring(mo.length - 2, mo.length);
var yy = dt.getUTCFullYear();
tm = hh + ':' + mi;
dt = dd + '/' + mo + '/' + yy;
const div_date_time = document.createElement("div");
div_date_time.className="d-flex flex-column";
const p_time = document.createElement("div");
p_time.textContent=tm;
div_date_time.appendChild(p_time);
if (dt != dt_current) {
const p_date = document.createElement("div");
p_date.textContent=dt;
div_date_time.appendChild(p_date);
}
row.appendChild(div_date_time);
//Finally append the row created to the table
document.getElementById(selector).append(row);
}
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'))
var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
return new bootstrap.Popover(popoverTriggerEl)
})
try {
return Array.from(myRows);
} catch (err) {
return;
}
}
}
/**
* Function to filter spot when pressed the search button on filter
* This function trigger the search, also triggered by timer
@ -277,8 +320,9 @@ function getFilter(id, param, len, qrystr) {
*/
function refresh_timer() {
var qryAll = '';
let qryAll = '';
//get other filters
qryAll = getFilter('band', 'b', 14, qryAll);
qryAll = getFilter('de_re', 'e', 7, qryAll);
qryAll = getFilter('dx_re', 'x', 7, qryAll);
@ -286,24 +330,24 @@ function refresh_timer() {
qryAll = getFilter('cqdeInput', 'qe', -1, qryAll);
qryAll = getFilter('cqdxInput', 'qx', -1, qryAll);
// Open a new connection, using the GET request on the URL endpoint
var qryString = 'spotlist';
//Composing query string
let qryString = ('spotlist?lr=').concat(tb.getLastRowId());
if (qryAll) {
qryString = qryString.concat('?'.concat(qryAll));
qryString = qryString.concat(qryAll);
}
console.log(qryString)
//Open a new connection, using the GET request on the URL endpoint
fetch(qryString)
.then((response) => response.json())
.then((data) => {
.then((data_new) => {
try {
rows_list = buildHtmlTable('bodyspot', data, rows_list);
tb.build(data_new);
} catch (err) {
console.log(err);
console.log(err.stack);
console.log(data);
console.log(data_new);
}
})
}
}

View File

@ -21,7 +21,7 @@
<link rel="preload" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/6.6.6/css/flag-icons.min.css" as="style" integrity="sha512-uvXdJud8WaOlQFjlz9B15Yy2Au/bMAvz79F7Xa6OakCl2jvQPdHD0hb3dEqZRdSwG4/sknePXlE7GiarwA/9Wg==" crossorigin="anonymous" onload="this.rel='stylesheet'" >
<noscript><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/6.6.6/css/flag-icons.min.css"></noscript>
<script src="static/js/load_css.min.js"></script>
<script class="spiderscript" src="static/js/load_css.min.js"></script>
{% endblock head %}
</head>
<body>
@ -89,9 +89,9 @@
<span id="version">v2.4.1</span>
</div>
</footer>
<script async src="static/js/clock.min.js"></script>
<script async src="static/js/copy_date.min.js"></script>
<script async src="static/js/load-sw.min.js"></script>
<script async class="spiderscript" src="static/js/clock.min.js"></script>
<script async class="spiderscript" src="static/js/copy_date.min.js"></script>
<script async class="spiderscript" src="static/js/load-sw.min.js"></script>
<script nonce="sedfGFG32xs">
{% block app_data %}
var my_callsign='{{callsign}}';
@ -103,7 +103,7 @@
-->
<script defer src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
{% block app_scripts %}
<script async src="static/js/callsign_search.min.js"></script>
<script async class="spiderscript" src="static/js/callsign_search.js"></script>
{% endblock app_scripts %}
{% block inline_scripts %}
{% endblock inline_scripts %}
@ -112,24 +112,27 @@
{# then user has already consented so no requirement for consent banner #}
{% else %}
{# show a cookie consent banner #}
<div class="modal" tabindex="-1" id="cookie-consent-container">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title">We use cookies</h1>
</div>
<div class="modal-body">
<p>We use only technical cookies.</p>
<p>Clicking &quot;I agree&quot;, you agree to the storing of cookies on your device. To learn more about how we use cookies, please see our cookies policy.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="cookie-consent">I agree</button>
</div>
</div>
</div>
</div>
<script defer src="static/js/cookie_consent.min.js"></script>
{% endif %}
<!-- Modal for cookie consent-->
<div class="modal fade" id="cookie_consent_modal" tabindex="-1" aria-labelledby="cookie-consent-container" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">We use cookies</h5>
</div>
<div class="modal-body">
<p>We use only technical cookies.</p>
<p>Clicking &quot;I agree&quot;, you agree to the storing of cookies on your device. To learn more about how we use cookies, please see our cookies policy.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="cookie_consent_btn">I agree</button>
</div>
</div>
</div>
</div>
<script defer class="spiderscript" src="static/js/cookie_consent.js"></script>
{% endif %}
</body>
</html>

View File

@ -12,5 +12,5 @@
<div class="row mx-auto">
{% endblock filters %}
{% block inline_scripts %}
<script defer src="static/js/callsign_inline.js"></script>
<script defer class="spiderscript" src="static/js/callsign_inline.js"></script>
{% endblock %}

View File

@ -86,6 +86,7 @@ def query_build():
try:
#get url parameters
last_rowid=request.args.get('lr') #Last rowid fetched by front end
band=(request.args.getlist('b')) #band filter
dere=(request.args.getlist('e')) #DE continent filter
dxre=(request.args.getlist('x')) #Dx continent filter
@ -93,6 +94,7 @@ def query_build():
decq=(request.args.getlist('qe')) #DE cq zone filter
dxcq=(request.args.getlist('qx')) #DX cq zone filter
query_string=''
#construct band query decoding frequencies with json file
@ -149,7 +151,13 @@ def query_build():
if dxcq[0].isnumeric():
dxcq_qry_string = ' AND spotcq =' + dxcq[0]
query_string="SELECT rowid, spotter AS de, freq, spotcall AS dx, comment AS comm, time, spotdxcc from dxcluster.spot WHERE 1=1"
if last_rowid is None:
last_rowid = "0"
if not last_rowid.isnumeric():
last_rowid = 0
query_string="SELECT rowid, spotter AS de, freq, spotcall AS dx, comment AS comm, time, spotdxcc from dxcluster.spot WHERE rowid > "+last_rowid
if len(band) > 0:
query_string += band_qry_string
@ -170,7 +178,7 @@ def query_build():
query_string += dxcq_qry_string
query_string += " ORDER BY rowid desc limit 50;"
except Exception as e:
logger.error(e)
query_string = ''
@ -286,7 +294,7 @@ def sitemap():
@app.route('/callsign.html', methods=['GET'])
def callsign():
payload=spotquery()
#payload=spotquery()
callsign=request.args.get('c')
response=flask.Response(render_template('callsign.html',mycallsign=cfg['mycallsign'],telnet=cfg['telnet'],mail=cfg['mail'],menu_list=cfg['menu']['menu_list'],timer_interval=cfg['timer']['interval'],callsign=callsign,adxo_events=adxo_events,continents=continents_cq,bands=band_frequencies))
return response