MediaWiki:Gadget-GrAnnotations.js: Difference between revisions

No edit summary
No edit summary
Line 82: Line 82:


   function buildDom() {
   function buildDom() {
     // ── Desktop FAB strip (hidden on mobile) ─────────────────────────
     // ── Desktop FAB strip ────────────────────────────────────────────
     $fab = $( [
     $fab = $( [
       '<div id="gra-fab" role="toolbar" aria-label="Feedback / Note / Bookmark">',
       '<div id="gra-fab" role="toolbar" aria-label="Feedback / Note / Bookmark">',
Line 274: Line 274:
     }
     }
     _fabSelVer = _selVersion;
     _fabSelVer = _selVersion;
     // CSS hides the one that's not appropriate for the device
     if (_mobile) {
    showMobileBar();
      showMobileBar();
     showFab(_selRect);
     } else {
      showFab(_selRect);
    }
   }
   }


Line 284: Line 286:


   function showFab(rect) {
   function showFab(rect) {
     if (_mobile) return;  // mobile uses bottom bar instead
     if (_mobile) return;  // mobile uses bottom bar
     if (!rect) return;
     if (!rect) return;
     var fabW = 46, fabH = 126;
     var fabW = 46, fabH = 126;
Line 637: Line 639:
     $(document).on('mouseup', function(e){
     $(document).on('mouseup', function(e){
       if (e.button !== 0) return;
       if (e.button !== 0) return;
       if (isMobile()) return;  // mobile handled separately
       if (_mobile) return;  // mobile uses selectionchange
       setTimeout(tryShowActions, 20);
       setTimeout(tryShowActions, 20);
     });
     });
Line 652: Line 654:
         if (v !== _selVersion) return;
         if (v !== _selVersion) return;
         if (_fabSelVer === v) return;
         if (_fabSelVer === v) return;
         tryShowActions();   // works for both mobile and desktop
         tryShowActions();
       }, 600);  // 600ms — after browser copy menu appears
       }, 600);  // 600ms — after browser copy menu appears
     });
     });