User:Shahadat/CopyCodeBlock

From Justapedia, unleashing the power of collective wisdom
Jump to navigation Jump to search
CopyCodeBlock
DescriptionAdds a button to copy the content of each code block (<pre>)
UpdatedNovember 24, 2023
    (8 months ago)
Browser supportChrome, Firefox, etc.
SourceUser:Shahadat/CopyCodeBlock.js

This script adds a button at the top right corner of each code block (created in wikitext via <pre>...</pre>, <syntaxhighlight>...</syntaxhighlight>, or a line beginning with a space, or the entirety of a Lua, CSS, or JavaScript page) that only shows up when your mouse cursor is inside the block and copies the content of the block when clicked.

Installation

Method 1

Get ScriptInstaller, then navigate to User:Shahadat/CopyCodeBlock.js and click "Install" at the top.

Method 2
  1. Place {{subst:iusc|User:Shahadat/CopyCodeBlock.js}} on Special:MyPage/common.js or a skin-specific page, like Special:MyPage/vector.js.
  2. Press "Publish Changes"

Script Attribution