Greasy Fork Code Copy Button (AFU IT)

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

作者
afu-it
今日安裝
1
安裝總數
28
評價
0 0 0
版本
0.1
建立日期
2025-05-07
更新日期
2025-05-07
尺寸
5.9 KB
授權條款
MIT
腳本執行於

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