From 71773e22e56ce5b6cc7aa05a4f260b172e1d8847 Mon Sep 17 00:00:00 2001 From: Owl <268753081+owlsy@users.noreply.github.com> Date: Tue, 7 Apr 2026 09:53:33 +1000 Subject: [PATCH] zapper-content.js: fix duplicate firing Resolve attaching three handlers that all trigger for a single tap, which onChild may run multiple times. Noticed behaviour when using "addManualRuleFromPrompt()", causing the prompt to appear twice on macOS when it should only be once. Kept 'click' as it works in iOS Safari, macOS Safari, and for accessibility (keyboard activation). --- wBlock Scripts (iOS)/Resources/zapper-content.js | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/wBlock Scripts (iOS)/Resources/zapper-content.js b/wBlock Scripts (iOS)/Resources/zapper-content.js index beabe5f..2107abf 100644 --- a/wBlock Scripts (iOS)/Resources/zapper-content.js +++ b/wBlock Scripts (iOS)/Resources/zapper-content.js @@ -433,8 +433,6 @@ undoLastZap().catch(() => {}); }; undoButton.addEventListener('click', onUndo); - undoButton.addEventListener('pointerup', onUndo, true); - undoButton.addEventListener('touchend', onUndo, { passive: false }); const manualButton = document.createElement('button'); manualButton.type = 'button'; @@ -448,8 +446,6 @@ addManualRuleFromPrompt().catch(() => {}); }; manualButton.addEventListener('click', onManualRule); - manualButton.addEventListener('pointerup', onManualRule, true); - manualButton.addEventListener('touchend', onManualRule, { passive: false }); const doneButton = document.createElement('button'); doneButton.type = 'button'; @@ -464,8 +460,6 @@ finalizeSessionAndReload().catch(() => {}); }; doneButton.addEventListener('click', onDone); - doneButton.addEventListener('pointerup', onDone, true); - doneButton.addEventListener('touchend', onDone, { passive: false }); const defaultGroup = document.createElement('span'); defaultGroup.className = 'wblock-default'; @@ -487,8 +481,6 @@ navigateParent(); }; parentButton.addEventListener('click', onParent); - parentButton.addEventListener('pointerup', onParent, true); - parentButton.addEventListener('touchend', onParent, { passive: false }); const childButton = document.createElement('button'); childButton.type = 'button'; @@ -500,8 +492,6 @@ navigateChild(); }; childButton.addEventListener('click', onChild); - childButton.addEventListener('pointerup', onChild, true); - childButton.addEventListener('touchend', onChild, { passive: false }); const hideButton = document.createElement('button'); hideButton.type = 'button'; @@ -511,8 +501,6 @@ confirmHide(); }; hideButton.addEventListener('click', onHide); - hideButton.addEventListener('pointerup', onHide, true); - hideButton.addEventListener('touchend', onHide, { passive: false }); navGroup.appendChild(parentButton); navGroup.appendChild(childButton);