removed duplicate message listener

This commit is contained in:
JustEngineer committed 2025-10-13 13:09:22 +03:00
1 parent 02bfff2c41
commit 08acdfc66f
2 files changed
+3 -26

No files matched your search

-23
View File
@@ -13,29 +13,6 @@ chrome.runtime.onInstalled.addListener(async () => {
console.log('📦 Installation resource test:', resources);
});
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.action === 'executeScript') {
// Get tabId from sender or requests
const tabId = request.tabId || sender.tab?.id;
if (!tabId) {
sendResponse({ success: false, error: 'Could not determine target tab' });
return;
}
// Use IIFE for async handlings
(async () => {
try {
await executeLocalScript(request.scriptName, tabId);
sendResponse({ success: true });
} catch (error) {
sendResponse({ success: false, error: error.message });
}
})();
return true; // Important: indicates async response
}
});
async function executeLocalScript(scriptName, tabId) {
try {
+3 -3
View File
@@ -4410,7 +4410,7 @@ localStorage.removeItem("lp");
const timeText = Utils.msToTimeText(remainingMs);
if (currentChargesEl) {
currentChargesEl.innerHTML = `${state.displayCharges} / ${state.maxCharges}`;
currentChargesEl.innerHTML = `${state.displayCharges} / ${max}`;
}
if (
@@ -4608,7 +4608,7 @@ localStorage.removeItem("lp");
totalMaxCharges = accounts.reduce((sum, acc) => {
if (currentAccount && acc.token === currentAccount.token) {
// Use real-time max charges for current account
return sum + Math.floor(state.maxCharges || acc.Max || 0);
return sum + Math.floor((state.fullChargeData?.max ?? state.maxCharges ?? acc.Max ?? 0));
} else {
// Use stored data for other accounts
return sum + Math.floor(acc.Max || 0);
@@ -4633,7 +4633,7 @@ localStorage.removeItem("lp");
<i class="fas fa-bolt"></i> ${Utils.t('charges')}
</div>
<div class="wplace-stat-value" id="wplace-stat-charges-value">
${state.displayCharges} / ${state.maxCharges}
${state.displayCharges} / ${state.fullChargeData?.max ?? state.maxCharges}
</div>
</div>
<div class="wplace-stat-item">