MediaWiki:Gadget-GrAnnotations.js: Difference between revisions

No edit summary
No edit summary
Line 542: Line 542:
     });
     });


     /* Mobile: show fab after selection settles */
     /* Mobile: intercept selection as early as possible */
    document.addEventListener('touchend', function(e) {
var _lastTouchEnd = 0;
      if (!_mobile) return;
document.addEventListener('touchend', function(e) {
      /* Don't trigger if touch ended on the fab itself */
  if (!_mobile) return;
      if ($fab[0] && $fab[0].contains(e.target)) return;
  if ($fab[0] && $fab[0].contains(e.target)) return;
      clearTimeout(_selTimer);
  _lastTouchEnd = Date.now();
      _selTimer = setTimeout(tryShowActions, 400);
  clearTimeout(_selTimer);
    }, { passive: true });
  /* Fire at 100ms — before browser popup (~300ms) */
  _selTimer = setTimeout(tryShowActions, 100);
}, { passive: true });


     /* selectionchange debounced */
     /* selectionchange debounced */