Grok Chat Navigation Improvements

Keyboard navigation and message interaction for Grok chat

יוצר
na na
התקנות יומיות
0
סה"כ התקנות
0
דירוגים
0 0 0
גרסה
1.2
נוצר
25-04-2025
עודכן
29-04-2025
Size
19.4 קילו-בייט
רישיון
MIT
חל על

Grok Chat Navigation Improvements

This userscript enhances the accessibility and usability of the Grok chat interface by adding keyboard navigation and interaction capabilities. It allows users to easily select, edit, copy, and regenerate chat messages using intuitive keyboard shortcuts, making the chat more accessible and efficient.

Features

  • Keyboard Navigation:

    • Navigate through chat messages using j (down), k (up), Home, and End keys. Ctrl+I to focus the main chat input field.
  • Message Interaction:

    • Edit (e), copy (c), or regenerate (r) selected messages with keyboard shortcuts.
    • Enhanced cursor control in editing mode with Ctrl+Home and Ctrl+End.
    • Quickly go to the last or the first chat message by quickly double tapping End and/or Home, respectively.
  • Escape Key Functionality:

    • Press Escape to deselect messages, defocus input, cancel editing, or toggle the aside panel for messages with code.
  • Mouse Interaction:

    • Click a message to select it; click outside to deselect.
  • Scroll Handling:

    • Automatically adjusts selection and scrolls to keep the selected message in view.

Installation

  1. Install a userscript manager like Tampermonkey for Chrome or Firefox.
  2. Click the Tampermonkey icon in your browser and select "Create a new script."
  3. Copy and paste the entire script code into the editor.
  4. Save the script with "File" > "Save" or Ctrl+S.
  5. The script will activate on the Grok chat page (https://grok.com/*).

Usage

Navigation

  • j or ArrowDown: Select the next message.
  • k or ArrowUp: Select the previous message.
  • Home: Jump to the first message.
  • End: Jump to the last message (scrolls to bottom with offset).

Interaction

  • With a message selected:
    • e: Edit the message.
    • c: Copy the message.
    • r: Regenerate the message.
  • While editing:
    • Ctrl+Home: Move cursor to start.
    • Ctrl+End: Move cursor to end.
    • Escape: Cancel editing.

Deselection and Panel Control

  • Escape: Deselect the current message, cancel editing, or toggle the aside panel.

Mouse Interaction

  • Click a message to select it.
  • Click outside messages to deselect.

Compatibility

  • Works on the Grok chat interface at https://grok.com/*.
  • Tested with Tampermonkey on Chrome and Firefox.

License

Released under the MIT License. See script header for details.

Author

  • cdr-x

    Changelog

  • Version 1.2:

    • Added: Ctrl+I hotkey to focus the main chat input box.
    • Improved: Escape key now defocuses and restores previous message selection.
    • Added: Double-tap Home/End (within 800 ms) jumps to the first/last message and scrolls it into view.
    • Improved: Button selection for Edit/Cancel/Copy/Regenerate is language-agnostic, using visible button order and SVG icon detection.
  • Version 1.0:

    • Initial release with keyboard navigation and interaction features.