mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Prettified Code!
This commit is contained in:
parent
d2074ee5ea
commit
2ca11421bd
1 changed files with 30 additions and 40 deletions
|
@ -460,13 +460,12 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
}
|
}
|
||||||
var timestamp = Math.floor(Date.now() / 1000);
|
var timestamp = Math.floor(Date.now() / 1000);
|
||||||
|
|
||||||
var uuid = uuidv4();
|
var uuid = uuidv4();
|
||||||
let uuidlast = uuid.lastIndexOf("-");
|
let uuidlast = uuid.lastIndexOf("-");
|
||||||
uuidlast += 1;
|
uuidlast += 1;
|
||||||
if (uuidlast > 0) {
|
if (uuidlast > 0) {
|
||||||
uuid = uuid.substring(uuidlast);
|
uuid = uuid.substring(uuidlast);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// check if broadcast
|
// check if broadcast
|
||||||
if (dxcallsign.startsWith("BC-")) {
|
if (dxcallsign.startsWith("BC-")) {
|
||||||
|
@ -476,16 +475,16 @@ window.addEventListener("DOMContentLoaded", () => {
|
||||||
// .toUpperCase();
|
// .toUpperCase();
|
||||||
//dxcallsignWithID = "BC-" + broadcastChannelIdCRC;
|
//dxcallsignWithID = "BC-" + broadcastChannelIdCRC;
|
||||||
var tnc_command = "broadcast";
|
var tnc_command = "broadcast";
|
||||||
var message_type = "broadcast_transmit"
|
var message_type = "broadcast_transmit";
|
||||||
let Data = {
|
let Data = {
|
||||||
command: tnc_command,
|
command: tnc_command,
|
||||||
broadcastChannel: dxcallsign,
|
broadcastChannel: dxcallsign,
|
||||||
data: chatmessage,
|
data: chatmessage,
|
||||||
uuid: uuid
|
uuid: uuid,
|
||||||
};
|
};
|
||||||
ipcRenderer.send("run-tnc-command", Data);
|
ipcRenderer.send("run-tnc-command", Data);
|
||||||
} else {
|
} else {
|
||||||
var message_type = "transmit"
|
var message_type = "transmit";
|
||||||
var file_checksum = crc32(file).toString(16).toUpperCase();
|
var file_checksum = crc32(file).toString(16).toUpperCase();
|
||||||
var tnc_command = "msg";
|
var tnc_command = "msg";
|
||||||
var data_with_attachment =
|
var data_with_attachment =
|
||||||
|
@ -1123,7 +1122,7 @@ update_chat = function (obj) {
|
||||||
getSetUserInformation(dxcallsign);
|
getSetUserInformation(dxcallsign);
|
||||||
getSetUserSharedFolder(dxcallsign);
|
getSetUserSharedFolder(dxcallsign);
|
||||||
|
|
||||||
var new_callsign = `
|
var new_callsign = `
|
||||||
<a class="list-group-item list-group-item-action rounded-4 rounded-top rounded-bottom border-1 mb-2 ${callsign_selected}" id="chat-${dxcallsign}-list" data-bs-toggle="list" href="#chat-${dxcallsign}" role="tab" aria-controls="chat-${dxcallsign}">
|
<a class="list-group-item list-group-item-action rounded-4 rounded-top rounded-bottom border-1 mb-2 ${callsign_selected}" id="chat-${dxcallsign}-list" data-bs-toggle="list" href="#chat-${dxcallsign}" role="tab" aria-controls="chat-${dxcallsign}">
|
||||||
|
|
||||||
<div class="d-flex w-100 justify-content-between">
|
<div class="d-flex w-100 justify-content-between">
|
||||||
|
@ -1142,7 +1141,6 @@ var new_callsign = `
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|
||||||
document
|
document
|
||||||
.getElementById("list-tab")
|
.getElementById("list-tab")
|
||||||
.insertAdjacentHTML("beforeend", new_callsign);
|
.insertAdjacentHTML("beforeend", new_callsign);
|
||||||
|
@ -1289,8 +1287,12 @@ var new_callsign = `
|
||||||
var new_message = `
|
var new_message = `
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<div class="ms-auto" id="msg-${obj._id}-control-area">
|
<div class="ms-auto" id="msg-${obj._id}-control-area">
|
||||||
<!--<button class="btn bg-transparent p-1 m-1"><i class="bi bi-arrow-repeat link-secondary" id="retransmit-msg-${obj._id}" style="font-size: 1.2rem;"></i></button>-->
|
<!--<button class="btn bg-transparent p-1 m-1"><i class="bi bi-arrow-repeat link-secondary" id="retransmit-msg-${
|
||||||
<button class="btn bg-transparent p-1 m-1"><i class="bi bi-trash link-secondary" id="del-msg-${obj._id}" style="font-size: 1.2rem;"></i></button>
|
obj._id
|
||||||
|
}" style="font-size: 1.2rem;"></i></button>-->
|
||||||
|
<button class="btn bg-transparent p-1 m-1"><i class="bi bi-trash link-secondary" id="del-msg-${
|
||||||
|
obj._id
|
||||||
|
}" style="font-size: 1.2rem;"></i></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="rounded-3 mt-3 mb-0 me-2" style="max-width: 75%;">
|
<div class="rounded-3 mt-3 mb-0 me-2" style="max-width: 75%;">
|
||||||
<div class="card border-primary bg-primary" id="msg-${obj._id}">
|
<div class="card border-primary bg-primary" id="msg-${obj._id}">
|
||||||
|
@ -1321,7 +1323,7 @@ var new_callsign = `
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj.type == "transmit") {
|
if (obj.type == "transmit") {
|
||||||
console.log(obj)
|
console.log(obj);
|
||||||
//console.log('msg-' + obj._id + '-status')
|
//console.log('msg-' + obj._id + '-status')
|
||||||
|
|
||||||
if (obj.status == "failed") {
|
if (obj.status == "failed") {
|
||||||
|
@ -2046,7 +2048,7 @@ async function updateAllChat(clear) {
|
||||||
.then(async function (result) {
|
.then(async function (result) {
|
||||||
// handle result async
|
// handle result async
|
||||||
//document.getElementById("blurOverlay").classList.add("bg-primary");
|
//document.getElementById("blurOverlay").classList.add("bg-primary");
|
||||||
console.log(result)
|
console.log(result);
|
||||||
if (typeof result !== "undefined") {
|
if (typeof result !== "undefined") {
|
||||||
for (const item of result.docs) {
|
for (const item of result.docs) {
|
||||||
//await otherwise history will not be in chronological order
|
//await otherwise history will not be in chronological order
|
||||||
|
@ -2086,23 +2088,19 @@ function getSetUserSharedFolder(selected_callsign) {
|
||||||
if (
|
if (
|
||||||
selected_callsign == "" ||
|
selected_callsign == "" ||
|
||||||
selected_callsign == null ||
|
selected_callsign == null ||
|
||||||
|
|
||||||
typeof selected_callsign == "undefined"
|
typeof selected_callsign == "undefined"
|
||||||
) {
|
) {
|
||||||
console.log("return triggered");
|
console.log("return triggered");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable button if broadcast
|
// disable button if broadcast
|
||||||
if(selected_callsign.startsWith("BC-")){
|
if (selected_callsign.startsWith("BC-")) {
|
||||||
document.getElementById("sharedFolderDXButton").disabled = true;
|
document.getElementById("sharedFolderDXButton").disabled = true;
|
||||||
|
} else {
|
||||||
}else{
|
document.getElementById("sharedFolderDXButton").disabled = false;
|
||||||
document.getElementById("sharedFolderDXButton").disabled = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
returnObjFromCallsign(users, selected_callsign)
|
returnObjFromCallsign(users, selected_callsign)
|
||||||
.then(function (data) {
|
.then(function (data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
@ -2233,21 +2231,15 @@ function getSetUserInformation(selected_callsign) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// disable button if broadcast
|
||||||
|
if (selected_callsign.startsWith("BC-")) {
|
||||||
// disable button if broadcast
|
document.getElementById("userModalDXButton").disabled = true;
|
||||||
if(selected_callsign.startsWith("BC-")){
|
document.getElementById("ping").disabled = true;
|
||||||
document.getElementById("userModalDXButton").disabled = true;
|
} else {
|
||||||
document.getElementById("ping").disabled = true;
|
document.getElementById("userModalDXButton").disabled = false;
|
||||||
|
document.getElementById("ping").disabled = false;
|
||||||
}else{
|
|
||||||
document.getElementById("userModalDXButton").disabled = false;
|
|
||||||
document.getElementById("ping").disabled = false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
document.getElementById("dx_user_info_callsign").innerHTML =
|
document.getElementById("dx_user_info_callsign").innerHTML =
|
||||||
selected_callsign;
|
selected_callsign;
|
||||||
|
|
||||||
|
@ -2284,8 +2276,6 @@ function getSetUserInformation(selected_callsign) {
|
||||||
defaultUserIcon;
|
defaultUserIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Callsign list elements
|
// Callsign list elements
|
||||||
document.getElementById(
|
document.getElementById(
|
||||||
"chat-" + selected_callsign + "-list-dxgrid"
|
"chat-" + selected_callsign + "-list-dxgrid"
|
||||||
|
|
Loading…
Reference in a new issue