Greasy Fork

Greasy Fork is available in English.

Perplexity Code Block Copy (AFU IT)

Enhanced code blocks in Perplexity with better selection and copy features for inline code

作者
afu-it
日安装量
0
总安装量
0
评分
0 0 0
版本
1.0
创建于
2025-05-08
更新于
2025-05-08
大小
10.2 KB
许可证
MIT
适用于

Description
This userscript make code blocks in Perplexity AI by adding one-click copy functionality and custom styling. It makes inline code stand out with a light blue background while maintaining the default styling for multi-line code blocks.

Easy to understand
Just select the code, and it will auto copied the code
But what if its a long code? Just double click it, it will copied all the code!

Features
- Inline code highlighting: Single-line code within paragraphs gets a distinctive #20b8cb background with black text
- Easy copying: Click inline code to copy it, or select specific text to copy just that portion
- Double-click to copy all: Double-click any code block to copy its entire content
- Visual feedback: A small "Copied!" tooltip appears next to your cursor when text is copied
- Smart styling: Only applies styling after answers are fully generated

Installation Tutorial

1. Install Tampermonkey:
- Visit the [Chrome Web Store](https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo) (for Chrome) or [Firefox Add-ons](https://addons.mozilla.org/en-US/firefox/addon/tampermonkey/) (for Firefox)
- Click "Add to Chrome/Firefox" to install the extension

2. Create a new script:
- Click on the Tampermonkey icon in your browser toolbar
- Select "Create a new script"
- Delete any default code that appears

3. Add the script:
- Copy and paste the entire userscript code into the editor
- Click File > Save or press Ctrl+S

4. Use the enhanced code blocks:
- Visit Perplexity AI (refresh if you're already there)
- Inline code will now have a light blue background
- Click on inline code to copy it
- Select text within any code block to copy just that selection
- Double-click any code block to copy its entire content

Usage Tips
- For inline code like `console.log()`, just click once to copy
- For multi-line code blocks, select specific text to copy portions
- Double-click anywhere in a code block to copy the entire block
- The tooltip appears right next to your cursor for immediate feedback