Fix update button icons

This commit is contained in:
Cohee 2023-11-19 01:33:54 +02:00
parent 53c3fc16c1
commit 685bb9742e
2 changed files with 9 additions and 7 deletions

View File

@ -512,8 +512,8 @@ async function generateExtensionHtml(name, manifest, isActive, isDisabled, isExt
isUpToDate = data.isUpToDate;
displayVersion = ` (${branch}-${commitHash.substring(0, 7)})`;
updateButton = isUpToDate ?
`<span class="update-button"><button class="btn_update menu_button" data-name="${name.replace('third-party', '')}" title="Up to date"><i class="fa-solid fa-code-commit"></i></button></span>` :
`<span class="update-button"><button class="btn_update menu_button" data-name="${name.replace('third-party', '')}" title="Update available"><i class="fa-solid fa-download"></i></button></span>`;
`<span class="update-button"><button class="btn_update menu_button" data-name="${name.replace('third-party', '')}" title="Up to date"><i class="fa-solid fa-code-commit fa-fw"></i></button></span>` :
`<span class="update-button"><button class="btn_update menu_button" data-name="${name.replace('third-party', '')}" title="Update available"><i class="fa-solid fa-download fa-fw"></i></button></span>`;
originHtml = `<a href="${origin}" target="_blank" rel="noopener noreferrer">`;
}
@ -641,6 +641,7 @@ async function showExtensionsDetails() {
*/
async function onUpdateClick() {
const extensionName = $(this).data('name');
$(this).find('i').addClass('fa-spin');
await updateExtension(extensionName, false);
}
@ -658,6 +659,11 @@ async function updateExtension(extensionName, quiet) {
});
const data = await response.json();
if (!quiet) {
showExtensionsDetails();
}
if (data.isUpToDate) {
if (!quiet) {
toastr.success('Extension is already up to date');
@ -665,10 +671,6 @@ async function updateExtension(extensionName, quiet) {
} else {
toastr.success(`Extension ${extensionName} updated to ${data.shortCommitHash}`);
}
if (!quiet) {
showExtensionsDetails();
}
} catch (error) {
console.error('Error:', error);
}

View File

@ -67,7 +67,7 @@ function downloadAssetsList(url) {
const asset = availableAssets[assetType][i];
const elemId = `assets_install_${assetType}_${i}`;
let element = $('<button />', { id: elemId, type: "button", class: "asset-download-button menu_button" })
const label = $("<i class=\"fa-solid fa-download fa-xl\"></i>");
const label = $("<i class=\"fa-fw fa-solid fa-download fa-xl\"></i>");
element.append(label);
//if (DEBUG_TONY_SAMA_FORK_MODE)