mirror of https://github.com/DJ2LS/FreeDATA.git
Prettified Code!
parent
bfb2543c05
commit
b644b36fe4
|
@ -762,7 +762,10 @@ update_chat = function (obj) {
|
||||||
// increment callsign counter
|
// increment callsign counter
|
||||||
callsign_counter++;
|
callsign_counter++;
|
||||||
dxcallsigns.add(dxcallsign);
|
dxcallsigns.add(dxcallsign);
|
||||||
if ((callsign_counter == 1 && selected_callsign=="") || selected_callsign == dxcallsign ) {
|
if (
|
||||||
|
(callsign_counter == 1 && selected_callsign == "") ||
|
||||||
|
selected_callsign == dxcallsign
|
||||||
|
) {
|
||||||
var callsign_selected = "active show";
|
var callsign_selected = "active show";
|
||||||
//document.getElementById('chatModuleDxCall').value = dxcallsign;
|
//document.getElementById('chatModuleDxCall').value = dxcallsign;
|
||||||
selected_callsign = dxcallsign;
|
selected_callsign = dxcallsign;
|
||||||
|
@ -1497,24 +1500,26 @@ async function updateAllChat(clear) {
|
||||||
}
|
}
|
||||||
//Ensure we create an index before running db.find
|
//Ensure we create an index before running db.find
|
||||||
//We can't rely on the default index existing before we get here...... :'(
|
//We can't rely on the default index existing before we get here...... :'(
|
||||||
await db.createIndex({
|
await db
|
||||||
index: {
|
.createIndex({
|
||||||
fields: [{ timestamp: "asc" }],
|
index: {
|
||||||
},
|
fields: [{ timestamp: "asc" }],
|
||||||
})
|
},
|
||||||
|
})
|
||||||
.then(async function (result) {
|
.then(async function (result) {
|
||||||
// handle result
|
// handle result
|
||||||
await db.find({
|
await db
|
||||||
selector: {
|
.find({
|
||||||
$and: [{ timestamp: { $exists: true } }, { $or: chatFilter }],
|
selector: {
|
||||||
//$or: chatFilter
|
$and: [{ timestamp: { $exists: true } }, { $or: chatFilter }],
|
||||||
},
|
//$or: chatFilter
|
||||||
sort: [
|
|
||||||
{
|
|
||||||
timestamp: "asc",
|
|
||||||
},
|
},
|
||||||
],
|
sort: [
|
||||||
})
|
{
|
||||||
|
timestamp: "asc",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
.then(async function (result) {
|
.then(async function (result) {
|
||||||
// handle result async
|
// handle result async
|
||||||
if (typeof result !== "undefined") {
|
if (typeof result !== "undefined") {
|
||||||
|
@ -1537,12 +1542,14 @@ async function updateAllChat(clear) {
|
||||||
.catch(function (err) {
|
.catch(function (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
});
|
});
|
||||||
if (clear == true && dxcallsigns.has(selected_callsign) == false) {
|
if (clear == true && dxcallsigns.has(selected_callsign) == false) {
|
||||||
//Selected call sign is not visible, reset to first call sign
|
//Selected call sign is not visible, reset to first call sign
|
||||||
let tmp = dxcallsigns.entries().next().value[0];
|
let tmp = dxcallsigns.entries().next().value[0];
|
||||||
selected_callsign=tmp;
|
selected_callsign = tmp;
|
||||||
document.getElementById("chat-" + tmp + "-list").classList.add("active","show");
|
document
|
||||||
document.getElementById("chat-" + tmp ).classList.add("active","show");
|
.getElementById("chat-" + tmp + "-list")
|
||||||
scrollMessagesToBottom();
|
.classList.add("active", "show");
|
||||||
}
|
document.getElementById("chat-" + tmp).classList.add("active", "show");
|
||||||
|
scrollMessagesToBottom();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue