Categorise packet lists

This commit is contained in:
Ross
2021-01-28 09:48:38 +00:00
parent 5a2c0db61b
commit f7fc1d9134
2 changed files with 32 additions and 2 deletions
+5
View File
@@ -1007,4 +1007,9 @@ display: block
#options-link {
padding-top: 40px;
}
.packet-list-title {
text-transform: capitalize;
font-weight: bolder;
}
+27 -2
View File
@@ -127,7 +127,19 @@ async function loadExamList(data) {
if (exams_completed.indexOf(name) > -1) {
c = " session-completed";
}
$("#packet-list").append(
let list;
if (exam.type != undefined) {
if ($(`#packet-list .${exam.type}`).length) {
list = $(`#packet-list .${exam.type}`);
} else {
list = $("#packet-list").append(`<div class='packet-list ${exam.type}'><span class='packet-list-title'>${exam.type}</span><br/></div>`);
}
} else {
list = $("#packet-list");
}
list.append(
$(`<div class='packet-button${c}' title='Load packet'></div>`)
.text(name)
.click(function () {
@@ -186,6 +198,19 @@ async function loadPacketList(data) {
$("#packet-list").empty();
window.packet_list.forEach(function (packet) {
// Seperate packet types
let list;
if (packet.type != undefined) {
if ($(`#packet-list .${packet.type}`)) {
list = $(`#packet-list .${packet.type}`);
} else {
list = $(`<div class='packet-list ${packet.type}'>${packet.type}<br/></div>`);
$("#packet-list").append(list);
}
} else {
list = $("#packet-list");
}
let c = "";
if (packets_started.indexOf(packet) > -1) {
c = " session-started";
@@ -193,7 +218,7 @@ async function loadPacketList(data) {
if (packets_completed.indexOf(packet) > -1) {
c = " session-completed";
}
$("#packet-list").append(
list.append(
$(`<div class='packet-button${c}' title='Load packet'></div>`)
.text(packet)
.click(function () {