Greasy Fork Code Copy Button (AFU IT)

Adds a single floating copy button with a notification from code container on Greasy Fork

Skaber
afu-it
Daglige installationer
0
Installationer i alt
0
Bedømmelser
0 0 0
Version
0.1
Oprettet
07.05.2025
Opdateret
07.05.2025
Size
5,86 kB
Licens
MIT
Gælder for

Description
A userscript that adds a convenient floating copy button to code blocks on Greasy Fork (https://greasyfork.org/). The button stays visible as you scroll through long code snippets, making it easy to copy code with a single click. When clicked, the button displays a checkmark icon and a minimalist "copied" notification to confirm the action.

Features
- Adds a floating copy button to all code blocks on Greasy Fork
- Button stays visible when scrolling through long code snippets
- Semi-transparent dark button that becomes fully opaque on hover
- Visual feedback with checkmark icon and "copied" text when code is copied
- Automatically works on all pages of Greasy Fork
- Clean, minimalist design that doesn't interfere with the site's appearance

Installation Instructions
Step 1: Install a Userscript Manager
- First, you need a userscript manager extension for your browser:

Chrome: Tampermonkey or Violentmonkey
Firefox: Greasemonkey, Tampermonkey, or Violentmonkey
Edge: Tampermonkey or Violentmonkey
Safari: Tampermonkey or Userscripts

Step 2: Install the Script
- Click on your userscript manager icon in your browser
- Select "Create a new script" or "Add new script"
- Delete any template code
- Copy and paste the entire script code into the editor
- Save the script (Ctrl+S or Command+S)

Step 3: Use the Script
- Visit any page on https://greasyfork.org/ that contains code blocks
- You'll see a dark, semi-transparent copy button in the top-right corner of each code block
- The button will stay visible as you scroll through the code
- Click the button to copy the entire code to your clipboard
- A checkmark icon and "copied" text will appear briefly to confirm the action

How It Works
- The script identifies all code containers on Greasy Fork pages and adds a floating copy button to each one. When clicked, the button extracts the code content (including handling line numbers) and copies it to your clipboard using the Clipboard API. The button provides visual feedback by changing to acheckmark icon and displaying a minimalist "copied" notification for 2 seconds.

Compatibility
- Works on all major browsers with userscript support
- Tested on Chrome, Firefox, and Edge
- Compatible with Tampermonkey, Violentmonkey, and Greasemonkey

Troubleshooting
- If buttons don't appear, try refreshing the page
- Make sure your userscript manager is enabled for greasyfork.org
- Check if you have any conflicting scripts or extensions
- If the copy function doesn't work, ensure your browser permissions allow clipboard access

Version History
- v0.1 (Initial release): Basic functionality with floating copy button and visual feedback

==================================================================================

DONATE
- Please donate my hardwork as low as $1 only to my hardwork.
- Ethereum (ERC20) Network, 0xCCB7bce062A47B60939F2f3d7B3d124dEEF4c065