Show percentage for amount L2 and R2 is pressed

Add "Don't show again" option to the Edge disclaimer modal
This commit is contained in:
Mathias Malmqvist
2025-10-02 01:26:37 +02:00
committed by dualshock-tools
parent 6073803215
commit 25f52689e1
6 changed files with 32 additions and 4 deletions

View File

@@ -110,6 +110,11 @@ function gboot() {
show_welcome_modal();
$("input[name='displayMode']").on('change', on_stick_mode_change);
// Setup edge modal "Don't show again" checkbox
$('#edgeModalDontShowAgain').on('change', function() {
localStorage.setItem('edgeModalDontShowAgain', this.checked.toString());
});
}
// Since modules are deferred, DOM might already be loaded
@@ -583,6 +588,15 @@ function update_ds_button_svg(changes, BUTTON_MAP) {
const svg = trigger.toUpperCase() + '_infill';
const infill = document.getElementById(svg);
set_svg_group_color(infill, color);
// Update percentage text
const percentage = Math.round((val / 255) * 100);
const percentageText = document.getElementById(trigger.toUpperCase() + '_percentage');
if (percentageText) {
percentageText.textContent = `${percentage} %`;
percentageText.setAttribute('opacity', percentage > 0 ? '1' : '0');
percentageText.setAttribute('fill', percentage < 35 ? pressedColor : 'white');
}
}
}
@@ -880,6 +894,12 @@ function show_donate_modal() {
}
function show_edge_modal() {
// Check if user has chosen not to show the modal again
const dontShowAgain = localStorage.getItem('edgeModalDontShowAgain');
if (dontShowAgain === 'true') {
return;
}
la("edge_modal");
bootstrap.Modal.getOrCreateInstance('#edgeModal').show();
}

View File

@@ -120,7 +120,7 @@ export class CalibCenterModal {
return;
this.setProgress(0);
new bootstrap.Modal(document.getElementById('calibrateModal'), {}).show();
new bootstrap.Modal(document.getElementById('autoCalibCenterModal'), {}).show();
await sleep(1000);

View File

@@ -77,7 +77,7 @@ export async function loadAllTemplates() {
const finetuneModalHtml = await loadTemplate('finetune-modal');
const calibCenterModalHtml = await loadTemplate('calib-center-modal');
const welcomeModalHtml = await loadTemplate('welcome-modal');
const calibrateModalHtml = await loadTemplate('calibrate-modal');
const autoCalibCenterModalHtml = await loadTemplate('auto-calib-center-modal');
const rangeModalHtml = await loadTemplate('range-modal');
const edgeProgressModalHtml = await loadTemplate('edge-progress-modal');
const edgeModalHtml = await loadTemplate('edge-modal');
@@ -87,6 +87,6 @@ export async function loadAllTemplates() {
// Create modals container
const modalsContainer = document.createElement('div');
modalsContainer.id = 'modals-container';
modalsContainer.innerHTML = faqModalHtml + popupModalHtml + finetuneModalHtml + calibCenterModalHtml + welcomeModalHtml + calibrateModalHtml + rangeModalHtml + edgeProgressModalHtml + edgeModalHtml + donateModalHtml + quickTestModalHtml;
modalsContainer.innerHTML = faqModalHtml + popupModalHtml + finetuneModalHtml + calibCenterModalHtml + welcomeModalHtml + autoCalibCenterModalHtml + rangeModalHtml + edgeProgressModalHtml + edgeModalHtml + donateModalHtml + quickTestModalHtml;
document.body.appendChild(modalsContainer);
}