From 25f52689e11807c056d6a476fca03ced34c4e416 Mon Sep 17 00:00:00 2001 From: Mathias Malmqvist Date: Thu, 2 Oct 2025 01:26:37 +0200 Subject: [PATCH] Show percentage for amount L2 and R2 is pressed Add "Don't show again" option to the Edge disclaimer modal --- assets/dualshock-controller.svg | 4 ++++ js/core.js | 20 +++++++++++++++++++ js/modals/calib-center-modal.js | 2 +- js/template-loader.js | 4 ++-- ...odal.html => auto-calib-center-modal.html} | 2 +- templates/edge-modal.html | 4 ++++ 6 files changed, 32 insertions(+), 4 deletions(-) rename templates/{calibrate-modal.html => auto-calib-center-modal.html} (80%) diff --git a/assets/dualshock-controller.svg b/assets/dualshock-controller.svg index fadf352..6a2a82c 100644 --- a/assets/dualshock-controller.svg +++ b/assets/dualshock-controller.svg @@ -105,4 +105,8 @@ + + 0 % + 0 % + diff --git a/js/core.js b/js/core.js index ccf3d43..a214e86 100644 --- a/js/core.js +++ b/js/core.js @@ -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(); } diff --git a/js/modals/calib-center-modal.js b/js/modals/calib-center-modal.js index 81057b1..b183eff 100644 --- a/js/modals/calib-center-modal.js +++ b/js/modals/calib-center-modal.js @@ -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); diff --git a/js/template-loader.js b/js/template-loader.js index d3d5cbf..0db4151 100644 --- a/js/template-loader.js +++ b/js/template-loader.js @@ -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); } diff --git a/templates/calibrate-modal.html b/templates/auto-calib-center-modal.html similarity index 80% rename from templates/calibrate-modal.html rename to templates/auto-calib-center-modal.html index 86cc276..97f5258 100644 --- a/templates/calibrate-modal.html +++ b/templates/auto-calib-center-modal.html @@ -1,5 +1,5 @@ -