Show successful match, fix text/button reset

Shows patches matched for full matches to help identify which version was uploaded (with accompanying green style).

Also, fixes force load text and buttons not hiding/clearing when uploading a matching file after a non-matching file without reloading the page.
This commit is contained in:
Horo 2021-03-26 03:53:45 -07:00 committed by Will
parent 86ecb1287a
commit 176fa72e5f
2 changed files with 18 additions and 0 deletions

View File

@ -209,6 +209,12 @@ button:hover:enabled, .fileLabel > strong:hover {
color: red;
}
.matchSuccess {
font-size: 15px;
font-style: italic;
color: green;
}
li > button {
height: 24px;
padding: 0 7px;

View File

@ -211,6 +211,7 @@ class PatchContainer {
var supportedDlls = $("<ul>");
this.forceLoadTexts = [];
this.forceLoadButtons = [];
this.matchSuccessText = [];
for (var i = 0; i < this.patchers.length; i++) {
var checkboxId = createID();
@ -223,6 +224,9 @@ class PatchContainer {
var matchPercent = $('<span>').addClass('matchPercent');
this.forceLoadTexts.push(matchPercent);
matchPercent.appendTo(listItem);
var matchSuccess = $('<span>').addClass('matchSuccess');
this.matchSuccessText.push(matchSuccess);
matchSuccess.appendTo(listItem);
var forceButton = $('<button>').text('Force load?').hide();
this.forceLoadButtons.push(forceButton);
forceButton.appendTo(listItem);
@ -300,6 +304,10 @@ class PatchContainer {
self.errorDiv.empty();
self.successDiv.empty();
for (var i = 0; i < self.patchers.length; i++) {
// reset text and buttons
self.forceLoadButtons[i].hide();
self.forceLoadTexts[i].text('');
self.matchSuccessText[i].text('');
var patcher = self.patchers[i];
// remove the previous UI to clear the page
patcher.destroyUI();
@ -310,6 +318,10 @@ class PatchContainer {
if (patcher.validatePatches()) {
found = true;
loadPatch(this, self, patcher);
// show patches matched for 100% - helps identify which version is loaded
var valid = patcher.validPatches;
var percent = (valid / patcher.totalPatches * 100).toFixed(1);
self.matchSuccessText[i].text(' ' + valid + ' of ' + patcher.totalPatches + ' patches matched (' + percent + '%) ');
}
}