Minor cleanup
All checks were successful
Build and test project / build-and-test (push) Successful in 1m33s
All checks were successful
Build and test project / build-and-test (push) Successful in 1m33s
This commit is contained in:
@@ -21,6 +21,7 @@ export default [
|
|||||||
HTMLElement: 'readonly',
|
HTMLElement: 'readonly',
|
||||||
Worker: 'readonly',
|
Worker: 'readonly',
|
||||||
requestAnimationFrame: 'readonly',
|
requestAnimationFrame: 'readonly',
|
||||||
|
location: 'readonly',
|
||||||
// JSZip loaded via script tag
|
// JSZip loaded via script tag
|
||||||
JSZip: 'readonly',
|
JSZip: 'readonly',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -212,6 +212,11 @@ h2 {
|
|||||||
border-color: var(--border);
|
border-color: var(--border);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mode-card-disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
.mode-card-selected {
|
.mode-card-selected {
|
||||||
border-color: var(--primary);
|
border-color: var(--primary);
|
||||||
box-shadow: 0 0 0 1px var(--primary), var(--shadow);
|
box-shadow: 0 0 0 1px var(--primary), var(--shadow);
|
||||||
|
|||||||
@@ -185,8 +185,7 @@ function goToModeSelection() {
|
|||||||
const patchesHint = $('mode-patches-hint');
|
const patchesHint = $('mode-patches-hint');
|
||||||
if (autoModeNoPatchesAvailable) {
|
if (autoModeNoPatchesAvailable) {
|
||||||
patchesRadio.disabled = true;
|
patchesRadio.disabled = true;
|
||||||
patchesCard.style.opacity = '0.5';
|
patchesCard.classList.add('mode-card-disabled');
|
||||||
patchesCard.style.cursor = 'not-allowed';
|
|
||||||
patchesHint.hidden = false;
|
patchesHint.hidden = false;
|
||||||
// Auto-select NickelMenu since it's the only available option.
|
// Auto-select NickelMenu since it's the only available option.
|
||||||
const nmRadio = $q('input[value="nickelmenu"]', stepMode);
|
const nmRadio = $q('input[value="nickelmenu"]', stepMode);
|
||||||
@@ -194,8 +193,7 @@ function goToModeSelection() {
|
|||||||
nmRadio.dispatchEvent(new Event('change'));
|
nmRadio.dispatchEvent(new Event('change'));
|
||||||
} else {
|
} else {
|
||||||
patchesRadio.disabled = false;
|
patchesRadio.disabled = false;
|
||||||
patchesCard.style.opacity = '';
|
patchesCard.classList.remove('mode-card-disabled');
|
||||||
patchesCard.style.cursor = '';
|
|
||||||
patchesHint.hidden = true;
|
patchesHint.hidden = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,24 +466,9 @@ btnErrorBack.addEventListener('click', () => {
|
|||||||
showStep(stepPatches);
|
showStep(stepPatches);
|
||||||
});
|
});
|
||||||
|
|
||||||
// "Start Over" — full reset of all state, back to step 1.
|
// "Start Over" — reload the page for a guaranteed clean slate.
|
||||||
btnRetry.addEventListener('click', () => {
|
btnRetry.addEventListener('click', () => {
|
||||||
state.device.disconnect();
|
location.reload();
|
||||||
state.firmwareURL = null;
|
|
||||||
state.resultTgz = null;
|
|
||||||
state.resultNmZip = null;
|
|
||||||
state.manualMode = false;
|
|
||||||
state.selectedPrefix = null;
|
|
||||||
state.patchesLoaded = false;
|
|
||||||
state.isRestore = false;
|
|
||||||
state.selectedMode = null;
|
|
||||||
state.nickelMenuOption = null;
|
|
||||||
btnDeviceNext.hidden = false;
|
|
||||||
btnDeviceRestore.hidden = false;
|
|
||||||
|
|
||||||
setNavLabels(TL.NAV_DEFAULT);
|
|
||||||
setNavStep(1);
|
|
||||||
showStep(stepConnect);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
@@ -494,31 +477,24 @@ btnRetry.addEventListener('click', () => {
|
|||||||
// Modal dialogs for "How It Works" (disclaimer) and "Privacy" (analytics info).
|
// Modal dialogs for "How It Works" (disclaimer) and "Privacy" (analytics info).
|
||||||
// Clicking the backdrop (the <dialog> element itself) also closes them.
|
// Clicking the backdrop (the <dialog> element itself) also closes them.
|
||||||
|
|
||||||
const dialog = $('how-it-works-dialog');
|
/** Wire up a <dialog>: open button, close button, and backdrop click to close. */
|
||||||
$('btn-how-it-works').addEventListener('click', (e) => {
|
function setupDialog(dialogId, openBtnId, closeBtnId) {
|
||||||
e.preventDefault();
|
const dlg = $(dialogId);
|
||||||
dialog.showModal();
|
$(openBtnId).addEventListener('click', (e) => {
|
||||||
});
|
e.preventDefault();
|
||||||
$('btn-close-dialog').addEventListener('click', () => {
|
dlg.showModal();
|
||||||
dialog.close();
|
});
|
||||||
});
|
$(closeBtnId).addEventListener('click', () => dlg.close());
|
||||||
dialog.addEventListener('click', (e) => {
|
dlg.addEventListener('click', (e) => {
|
||||||
if (e.target === dialog) dialog.close();
|
if (e.target === dlg) dlg.close();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setupDialog('how-it-works-dialog', 'btn-how-it-works', 'btn-close-dialog');
|
||||||
|
|
||||||
// Privacy dialog is only shown when analytics are enabled.
|
// Privacy dialog is only shown when analytics are enabled.
|
||||||
if (analyticsEnabled()) {
|
if (analyticsEnabled()) {
|
||||||
$('btn-privacy').hidden = false;
|
$('btn-privacy').hidden = false;
|
||||||
$('privacy-link-separator').hidden = false;
|
$('privacy-link-separator').hidden = false;
|
||||||
}
|
}
|
||||||
const privacyDialog = $('privacy-dialog');
|
setupDialog('privacy-dialog', 'btn-privacy', 'btn-close-privacy');
|
||||||
$('btn-privacy').addEventListener('click', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
privacyDialog.showModal();
|
|
||||||
});
|
|
||||||
$('btn-close-privacy').addEventListener('click', () => {
|
|
||||||
privacyDialog.close();
|
|
||||||
});
|
|
||||||
privacyDialog.addEventListener('click', (e) => {
|
|
||||||
if (e.target === privacyDialog) privacyDialog.close();
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -383,7 +383,7 @@ export function initNickelMenu(state) {
|
|||||||
showNmDone('download');
|
showNmDone('download');
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
state.showError(TL.STATUS.NM_INSTALL_FAILED + err.message);
|
state.showError(TL.STATUS.NM_INSTALL_FAILED(err.message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ export function initPatchesFlow(state) {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
btnWrite.disabled = false;
|
btnWrite.disabled = false;
|
||||||
btnWrite.textContent = TL.BUTTON.WRITE_TO_KOBO;
|
btnWrite.textContent = TL.BUTTON.WRITE_TO_KOBO;
|
||||||
state.showError(TL.STATUS.WRITE_FAILED + err.message);
|
state.showError(TL.STATUS.WRITE_FAILED(err.message));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ export const TL = {
|
|||||||
EXTRACTING: 'Extracting KoboRoot.tgz...',
|
EXTRACTING: 'Extracting KoboRoot.tgz...',
|
||||||
APPLYING_PATCHES: 'Applying patches...',
|
APPLYING_PATCHES: 'Applying patches...',
|
||||||
NO_FIRMWARE_URL: 'No download URL available for this device.',
|
NO_FIRMWARE_URL: 'No download URL available for this device.',
|
||||||
WRITE_FAILED: 'Failed to write KoboRoot.tgz: ',
|
WRITE_FAILED: (msg) => `Failed to write KoboRoot.tgz: ${msg}`,
|
||||||
NM_INSTALL_FAILED: 'NickelMenu installation failed: ',
|
NM_INSTALL_FAILED: (msg) => `NickelMenu installation failed: ${msg}`,
|
||||||
EXTRACT_FAILED: 'KoboRoot.tgz not found in software update',
|
EXTRACT_FAILED: 'KoboRoot.tgz not found in software update',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user