ChatGPT Chat copy code and export code buttons

人民的勤务员
2024-09-21T23:35:20Z

exist chatgpt.com Add an animation in the lower right corner of the upper code block“Copy code”button and a for ChatGPT Code block in response adds export button，Prompts the user to save code to a file based on the programming language detected by the code block’s class name。

简体中文 | English | 한국어 | Tiếng Việt | 繁體中文
👆️access GitHub Readme file on for a better experience。

GitHubView the serviceman’s scriptGithub:@ChinaGodMan
GreasyForkView the serviceman’s script
View the serviceman’s script on the current page

⭐If the script helps you,Can light up the stars to encourage⭐

Recommended use：

💡 Tip: The script manager and browser listed above do not represent all
The script runs normally in the following environment

ChatGPT Chat copy code and export code buttons

「 exist chatgpt.com Add an animation in the lower right corner of the upper code block“Copy code”button and a for ChatGPT Code block in response adds export button，Prompts the user to save code to a file based on the programming language detected by the code block’s class name。 」

Download:Github | ⭐Greasy Fork

Update records

🛠️ ChatGPT Chat Copy Code Button Update log

📅 2024-09-23 08:58:07- Ver 1.2.0.0

repair: • Newly sent content will also add buttons incorrectly,When adding, determine whether the following child elements exist in the element.querySelector('div.flex.items-center.text-token-text-secondary') repair: •Export code to detect errors in code typevar languageDiv = elem.parentElement.parentElement.querySelector('div.flex.items-center.text-token-text-secondary') →var languageDiv = elem.querySelector('div.flex.items-center.text-token-text-secondary')

📅 2024-09-22 10:44:07- Ver 1.1.0.0

New: •Add a button to export code,The new code comes from the script →ChatGPT Code Export Button

📅 2024-09-22 07:06:07- Ver 1.0.0.0

New: •Compatible with new version ChatGPT Official website

ChatGPT Chat Copy Code Button user script

introduce

The user script is chatgpt.com and share.nezhagpt.cloud code block on the page add a“Copy code”button。The button is located in the lower right corner of the code block，With animation effects，Users can easily copy the code to the clipboard with the click of a button。

Function

In the lower right corner of the code block add a“Copy code”button

After clicking the button，The code will be copied to the clipboard

There is a feedback animation after clicking the button，button will show“Copied!”hint

Button color changes on mouseover

Usage scenarios

Developers can easily copy code snippets

It is more convenient for learners to view code

Automatically observe and add copy button for newly loaded code blocks

Installation steps

1. Install a browser extension that supports userscripts，For example Tampermonkey or Violentmonkey。

2. Click the green button above to install。

compatibility

support Chrome、Firefox、Edge、Opera and Safari Wait for mainstream browsers

Project address

GitHub Project address

YodaBets OpenAI Chat Copy Code ButtonScript posted by the original author

Feedback address

If you have any questions or suggestions，Please provide feedback via the link below：GitHub Feedback address

Contributors

YodaBets OpenAI Chat Copy Code Button modified this script

Muffin Productions ChatGPT Code Export Button referenced the export code in this script

人民的勤务员

Authorize

This script follows MIT License open source