Copy Code to Clipboard for CODE/HTML/PHP BBCode
vBulletin 4 Creator:
vBulletin 4 Mod Link: https://vbulletin.org/forum/showthre...ight=copy+code Javascript Fix: Working with vB 5.6.9 About: This modification adds a "Copy Code" box that will select all of the code within the box, as well as automatically copy to clipboard. The vB4 mod did not automatically copy the code, which I've fixed in this version. Installation Copy and paste the following javascript code at the bottom of your head_include template: AdminCP -> Styles -> Style Manager -> Edit Templates -> head_include Code:
<script type="text/javascript"> function selectAll(a) { var e = a.parentNode.parentNode.getElementsByTagName('code')[0]; if (window.getSelection) { var s = window.getSelection(); var r = document.createRange(); r.selectNodeContents(e); s.removeAllRanges(); s.addRange(r); document.execCommand('copy') } else if (document.getSelection) { var s = document.getSelection(); var r = document.createRange(); r.selectNodeContents(e); s.removeAllRanges(); s.addRange(r); } else if (document.selection) { var r = document.body.createTextRange(); r.moveToElementText(e); r.select(); } } </script> For CODE BBCode: Navigate to AdminCP -> Styles -> Style Manager -> Edit Templates -> bbcode_code Find: Code:
{vb:rawphrase code}: Code:
{vb:rawphrase code}: <input type="button" value="{vb:rawphrase select_code}" onclick="selectAll(this); return false;"> Code:
{vb:raw code} Code:
<code>{vb:raw code}</code> For HTML BBCode: Navigate to AdminCP -> Styles -> Style Manager -> Edit Templates -> bbcode_html Find: Code:
{vb:rawphrase html_code}: Code:
{vb:rawphrase html_code}: <input type="button" value="{vb:rawphrase select_code}" onclick="selectAll(this); return false;"> Code:
{vb:raw code} Code:
<code>{vb:raw code}</code> For PHP BBCode: Navigate to AdminCP -> Styles -> Style Manager -> Edit Templates -> bbcode_php Find: Code:
{vb:rawphrase php_code}: Code:
{vb:rawphrase php_code}: <input type="button" value="{vb:rawphrase select_code}" onclick="selectAll(this); return false;"> Code:
{vb:raw code} Code:
<code>{vb:raw code}</code> Then add the following to your css_additional.css: Code:
.bbcode_container .bbcode_description { background: #777; font-weight: 8; padding: 5px; } .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-size: 10px; font-weight: 7; float: right; margin-right: 5px; } You may need to make some adjustments. Enjoy! Download No files for download. Screenshots |
Similar Mods
After posting automatically copy to clipboard | vBulletin 3.0 Full Releases |
[tweak] Copy Post URL to clipboard | vBulletin 2.x Template Modifications |