diff --git a/css/main.css b/css/main.css index da739f8..2808bab 100644 --- a/css/main.css +++ b/css/main.css @@ -767,18 +767,36 @@ select option:disabled { transition: all 0.2s; } +.save-button { + display:inline-block; + padding-left: 10px; + color:#FFFFFF; +} + +.save-button a { + color: inherit; +} + +.save-button:hover { + color: blue; +} + .packet-button:hover{ color:lightblue; border-color:blue; } -.sk-cube-grid { - width: 60px; - height: 60px; +.progress-block { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); + font-size: smaller; +} + +.sk-cube-grid { + width: 60px; + height: 60px; } .sk-cube-grid .sk-cube { diff --git a/index.html b/index.html index 301b7bc..9c2fde4 100644 --- a/index.html +++ b/index.html @@ -101,6 +101,9 @@
+ diff --git a/js/helpers.js b/js/helpers.js index f443b52..6def092 100644 --- a/js/helpers.js +++ b/js/helpers.js @@ -3,7 +3,9 @@ * @param {array} array */ export function shuffleArray(array) { - var currentIndex = array.length, temporaryValue, randomIndex; + var currentIndex = array.length, + temporaryValue, + randomIndex; // While there remain elements to shuffle... while (0 !== currentIndex) { // Pick a remaining element... @@ -26,3 +28,15 @@ export function urltoFile(url, filename, mimeType) { return new File([buf], filename, { type: mimeType }); }); } + +export function formatBytes(bytes, decimals = 2) { + if (bytes === 0) return "0 Bytes"; + + const k = 1024; + const dm = decimals < 0 ? 0 : decimals; + const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; + + const i = Math.floor(Math.log(bytes) / Math.log(k)); + + return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes[i]; +} diff --git a/js/main.js b/js/main.js index 191bee0..3fba18a 100644 --- a/js/main.js +++ b/js/main.js @@ -55,9 +55,19 @@ function loadPacketList(data) { window.packet_list = data.packets; window.packet_list.forEach(function (packet) { $("#packet-list").append( - $("").click(function () { - loadPacketFromAjax("packets/" + packet); - }) + $("") + .text(packet) + .click(function () { + loadPacketFromAjax("packets/" + packet); + }) + .append( + $( + `` + ).click(function () { + console.log("packets/" + packet); + event.stopPropagation(); + }) + ) ); }); $("#options-panel").show(); @@ -69,11 +79,28 @@ function loadPacketList(data) { */ function loadPacketFromAjax(path) { console.log("loading packet from " + path); - $.getJSON(path, function (data) { - setUpPacket(data); - $("#options-panel").hide(); + // $.getJSON(path, function (data) { + // setUpPacket(data); + // $("#options-panel").hide(); + // }) + $.ajax({ + dataType: "json", + url: path, + progress: function (e) { + if (e.lengthComputable) { + var completedPercentage = Math.round((e.loaded * 100) / e.total); + console.log(completedPercentage); + + $("#progress").html( + `${completedPercentage}%