Skip to content

Commit

Permalink
Fixes added in "Patching VPKs" (#4)
Browse files Browse the repository at this point in the history
* remove details closing

* don't allow multiple open dialogs
  • Loading branch information
barnabwhy committed Jul 6, 2022
1 parent 997a947 commit ea2b48c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<button id="openSettingsButton" onclick="openSettingsPrompt()">Settings</button>
</div>
<div id="details">
<button id="detailsCloseButton" onclick="closeDetails()"><img src="img/close.svg" /></button>
<button id="detailsUnpackButton">Unpack</button>
<h2 class="title">Details</h2>
<p class="path">Path:<span style="font-size: 12px;"></span></p>
Expand Down
2 changes: 1 addition & 1 deletion main.css
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ body {
vertical-align: middle;
position: absolute;
top: 16px;
right: 64px;
right: 16px;
padding: 8px;
border: none;
cursor: pointer;
Expand Down
12 changes: 5 additions & 7 deletions renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async function selectVPK() {
fileTree.totalCompressed = Object.values(vpk.tree.files).reduce((p, c) => { return p + c.fileParts.reduce((a, b) => (a + b.entryLength), 0) }, 0);
fileTree.totalUncompressed = Object.values(vpk.tree.files).reduce((p, c) => { return p + c.fileParts.reduce((a, b) => (a + b.entryLengthUncompressed), 0) }, 0);

closeDetails();
showDirDetails(fileTree);
renderTree(fileTree);

isVpkOpen = true;
Expand Down Expand Up @@ -172,10 +172,6 @@ function renderDirs(dirs, parentEl) {
})
}

function closeDetails() {
document.querySelector("#details").classList.remove("visible");
}

function showDirDetails(d) {
console.log("Show details:", d);
document.querySelector("#details").classList.add("visible");
Expand Down Expand Up @@ -226,7 +222,7 @@ function bytesToSize(bytes) {
}

async function unpackDir(d) {
if(!isVpkOpen)
if(!isVpkOpen || isDialogOpen)
return;

console.log("Unpack:", d);
Expand All @@ -235,7 +231,7 @@ async function unpackDir(d) {
unpack(files);
}
async function unpackFile(f) {
if(!isVpkOpen)
if(!isVpkOpen || isDialogOpen)
return;

console.log("Unpack:", f);
Expand All @@ -251,7 +247,9 @@ async function unpack(files) {
document.querySelector("#unpackPrompt > .currentPath").innerText = "";
document.querySelector("#unpackPrompt > .progress").innerText = "0/" + files.length;

isDialogOpen = true;
let isUnpacking = await window.api.copyFiles(vpkPath, files)
isDialogOpen = false;

if(isUnpacking) {
unpackStartTime = Date.now();
Expand Down

0 comments on commit ea2b48c

Please sign in to comment.