LMArena | Floating Copy Buttons

Adds floating copy buttons for code blocks and chat messages

这些是此脚本变更过代码的版本。 显示所有版本。

  • v3.1 2025-12-31

    v3.1

    • Fix: Message buttons now appear for streaming messages during active conversations. (MutationObserver was only detecting messages inside newly added ol containers, not individual message elements added to an existing container.)
  • v3.0 2025-12-31

    v3.0

    • Cleanup: Removed orphaned function getElementVisibleBounds (never called).
    • Cleanup: Removed all debug console logging instrumentation (~23 statements).
    • Cleanup: Removed debug-only properties (btn._dragLogged, isChatSwitch).
    • Cleanup: Removed buggy/dead querySelectorAll?.[...] branch in MutationObserver.
    • Cleanup: Removed unused state fields (state.block, state.icon) from codeColumnMap.
    • Performance: Removed unnecessary drag event listener used only for logging.
  • v2.9 2025-12-30

    ### **Version 3.0 — Major Overhaul & "Code Column" Update**

    **Summary of Changes (v1.4 → v3.0):**

    * **New Feature: The "Code Column"**
    * Replaced the old centered floating button inside code blocks with a seamless, full-height **interactive strip** on the right edge of the code area.
    * **Smart Positioning:** The copy icon within the strip now follows your viewport (sticky behavior) so it is always accessible while scrolling long code blocks.
    * **Hover to reveal:** The strip remains transparent until hovered, keeping code readable.

    * **Native Header Integration**
    * Replaced the website's native "Copy" button in the top-right of code blocks with a custom, high-performance button.
    * This button shares the same Drag & Drop capabilities as the floating buttons.

    * **Robust React & SPA Support**
    * Completely rewrote the initialization logic to handle **Single Page Application (SPA)** navigation.
    * Fixed issues where buttons would disappear when switching between chats.
    * Implemented "React Stabilization" to ensure elements attach correctly after the page hydrates.

    * **Smart Collision Detection**
    * **Input Area Safety:** The Code Column now automatically resizes and clips itself to avoid overlapping the text input area at the bottom of the screen.
    * **Dynamic Resizing:** Added observers to detect when the text input grows (multi-line typing), ensuring the UI adjusts perfectly in real-time.

    * **UX Improvements**
    * **Instant Drag:** Removed the hold-delay. Drag-and-drop operations now start instantly upon mouse movement, while clicking remains an instant copy action.
    * **Seamless Design:** Removed visual gaps between the Code Column and the site header/footer for a cleaner look.

  • v1.3 2025-12-20

    v1.3 - Drag & Drop Update

    • New Feature: Drag-and-Drop Support!
      • Quick Click (<0.3s): Copies text to clipboard (standard behavior).
      • Click & Hold + Drag: You can now drag the button to drop the text directly into external applications (VS Code, Notepad, other browser tabs).
    • Smart Markdown Export: When dragging chat messages, the content is automatically converted to clean Markdown (preserving headers, code blocks, bold/italic, lists, and tables) instead of raw text.
    • Visual Feedback: Added animations for "holding" and "dragging" states.
    • Technical Fixes:
      • Switched to accessible div elements to ensure reliable native drag behavior across all browsers.
      • Improved hit detection for glassmorphism buttons.
  • v1.2 2025-12-19

    fixed message copy button (ignored markdown syntax in previous version)

  • v1.1 2025-12-17