Adding Select All for [code] BBcode

Adding Select All for [code] BBcode 1.1 Stable Nulled

No permission to download
Compatible XF Versions
  1. 2.0
A simple but effective way to select all the content within a code bbcode in your forum.

Please note: this doesn't add a "select all" button like you're probably used to see, but it adds a simple functionality to your mouse (or your thumbs) so that each time you click (or tap) inside a code box, it'll automatically select all the text into it.

How to:
Download the attached file, and replace it with your existing bb_code_tag_code file in your template(s).

Alternatively, follow these steps to manually modify it:

Find

Code:
<code>{$content}</code>

Replace it with:

Code:
<code onclick="getData(this)">{$content}</code>

And add the following javascript code at the very end of that file (so that you load it only when you effectively have a code bbcode in your page, to save bandwidth):

Code:
<script>
function getData(element)
{
if (document.body.createTextRange) {
var range = document.body.createTextRange();
range.moveToElementText(element);
range.select();
} else if (window.getSelection) {
var selection = window.getSelection(); 
var range = document.createRange();
range.selectNodeContents(element);
selection.removeAllRanges();
selection.addRange(range);
}
 
}
</script>

Known bugs:

If you have more than codeboxes in the same page, it'll always and only select the first one. Fixed on v1.1

If you find any bugs, let me know! So far it's working great on my side.



CHANGELOG
v1.1 - Javascript optimization and bug fixes
v1.0 - First release




If you like my contributions here and want to support me in order to continue my development on Xenforo, drop me a private conversation.
  • gyS0higkSU6HTYEB43FHDA.jpeg
    gyS0higkSU6HTYEB43FHDA.jpeg
    58.1 KB · Views: 128
Author
Admin
Size
832 bytes
Extension
zip
Downloads
5
Views
1,523
First release
Last update

More resources from Admin

  • ficKrr
    Script ficKrr
    Multi Vendor Digital Products Marketplace with Subscription ON / OFF
  • Shofy
    Script Shofy
    eCommerce & Multivendor Marketplace Laravel Platform
  • TheFox
    WP TheFox
    Responsive Multi-Purpose WordPress Theme
  • Farmart
    Script Farmart
    Single or Multivendor Laravel eCommerce System
  • The Plus
    WP The Plus
    Addon for Elementor Page Builder WordPress Plugin

Similar resources

[OzzModz] Category Select Dropdown for [tl] Social Groups Admin
Dropdown selection menu for category chooser on groups creation
[OzzModz] Custom Field: Select All AnimeHaxor
Adds "select/deselect all" checkbox for multiple checkboxes custom fields
[OzzModz] Post Thread Forum Select Dropdown Admin
Dropdown selection menu for forum chooser on thread creation
[OzzModz] XFMG: Category Select Dropdown Admin
Replaces category list with dropdown selection menu for media add category chooser
727Threads
2,270Messages
60,970Members
luisoLatest member
Back