Refactor downloads and ToC

This commit is contained in:
Yakov5776 2022-10-13 00:50:18 -04:00
parent 7fe44f2813
commit 4a93affc30
3 changed files with 43 additions and 10 deletions

View File

@ -19,5 +19,5 @@ Private Key:
A user by the name of coke<sub><sup>[Citation needed]</sup></sub> made an application which generates RSA pairs for the client, the download can be found [here](/hidden/Download#906c8ec652e43b043603b97fc0e31a626448e65bdf4819c7a8c4bc18a768d8a8).
### See Also:
<h3 id="see-also">See Also:</h3>
- [What are signatures?](/Client Security/Signatures)

View File

@ -1,5 +1,7 @@
let fileSpan = document.getElementById("file-span");
let dlText = document.getElementById("download-text");
let descText = document.getElementById("description-text");
let sizeText = document.getElementById("size-text");
const hash = window.location.hash.substr(1);
@ -11,9 +13,25 @@ fetch("/api/getFile?id=" + hash).then(function(response) {
function setupPage(data) {
if (data["Error"]) redirect404();
if (data["Author"])
{
showElement(document.getElementById("author-div"));
document.getElementById("author-text").innerText = data["Author"];
}
dlText.innerText = `Download '${data["Name"]}'`;
descText.innerText = data["Description"];
document.title = "Download " + data["Name"] + " - ROBLOX Reverse Engineering";
sizeText.innerText = FileSize(data["Size"])
let btn = document.createElement("button");
btn.className = "md-button md-button--primary downloadIcon";
btn.onclick = downloadFile;
btn.innerText = "Download File";
fileSpan.appendChild(btn);
showElement(fileSpan);
}
@ -24,4 +42,13 @@ function redirect404() {
function downloadFile() {
window.location.href = "/api/dlFile?id=" + hash;
}
function showElement(element) {
element.style.display = "block";
}
function FileSize(size) {
var i = size == 0 ? 0 : Math.floor(Math.log(size) / Math.log(1024));
return (size / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i];
}

View File

@ -1,16 +1,22 @@
# Download Text
<h1 id="download-text">Getting File Information...</h1>
##### File Description:
<p id="description-text">Description Text</p>
<div id="file-span" style="display:none">
<h5 id="file-description">File Description:</h5>
<p id="description-text">Description Text</p>
<br>
<button class="md-button md-button--primary downloadIcon" onClick="downloadFile()">Download File</button>
<div id="author-div" style="display:none">
<h5 id="file-author" style="display:inline">Author:</h5>
<p id="author-text" style="display:inline">Author Text</p>
</div>
<h5 id="file-size" style="display:inline">File Size:</h5>
<p id="size-text" style="display:inline">1GB</p>
<br>
<br>
</div>
<script src="/assets/Download.js"></script>
<style>
.md-nav--secondary {
display: none;
}
.downloadIcon {
background-image: url(/assets/download-24.png);
background-position: 9px;