HackTheBox Academy - Add Clipboard Copy To Code Blocks

Automatically submits any dynamic question input by pressing ENTER

作者
L0WK3Y-IAAN
日安装量
0
总安装量
0
评分
0 0 0
版本
1.1
创建于
2025-07-16
更新于
2025-07-16
大小
5.3 KB
许可证
MIT
适用于

HTB Academy Code Block Clipboard Button

A Tampermonkey userscript that adds convenient clipboard buttons to code blocks on Hack The Box Academy, making it easy to copy code snippets with a single click.

Features

  • One-Click Copy: Adds a "Copy" button to every code block on HTB Academy
  • Visual Feedback: Button changes to "Copied!" with green highlight when successful
  • Dynamic Content Support: Automatically detects and adds buttons to code blocks loaded via AJAX
  • Cross-Browser Compatibility: Uses modern clipboard API with fallback for older browsers
  • Responsive Design: Button is properly sized and positioned within code block containers
  • Dark Theme Integration: Styled to match HTB Academy's dark theme

Installation

  1. Install Tampermonkey browser extension
  2. Click "Create a new script" in Tampermonkey dashboard
  3. Copy and paste the script code
  4. Save the script (Ctrl+S)
  5. Visit any HTB Academy page with code blocks

Usage

The script automatically activates on academy.hackthebox.com pages. When you encounter code blocks, you'll see a small "Copy" button in the top-right corner of each block.

  • Click the button to copy the code to your clipboard
  • Visual confirmation shows "Copied!" when successful
  • Error handling displays "Error" if copying fails
  • Auto-reset returns button to normal state after 2 seconds

Browser Support

  • ✅ Chrome/Chromium
  • ✅ Firefox
  • ✅ Safari
  • ✅ Edge
  • ✅ Opera

Permissions

This script requires no special permissions and runs entirely in the browser context.

Changelog

v1.1

  • Fixed button positioning to stay within code block boundaries
  • Improved button sizing and spacing
  • Added proper overflow handling
  • Enhanced visual styling

v1.0

  • Initial release
  • Basic clipboard functionality
  • Dynamic content detection
  • Dark theme styling

Contributing

Feel free to submit issues or improvements to enhance the script's functionality.

License

This script is provided as-is for educational purposes. Use responsibly on HTB Academy.