Adding Select All for [code] BBcode

Adding Select All for [code] BBcode 1.1

No permission to download
XF Compatibility
  1. 2.2.x
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
HTML:
<code>{$content}</code>
  • Replace it with:
HTML:
<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):
JavaScript:
<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>

gyS0higkSU6HTYEB43FHDA.webp
Author
axtona
Views
335
Extension type
txt
File size
939 bytes
First release
Last update
Ratings 0,00 star(s) 0 ratings
More resources from axtona
Coupons Avanzados para WooCommerce Premium
Coupons Avanzados para WooCommerce Premium
Extienda las Características de Su Cupón
Antler - Proveedor de Hosting y Plantilla WHMCS
Antler - Proveedor de Hosting y Plantilla WHMCS
Desarrollado con la última tecnología HTML5 y CSS3, basado en el Framework Bootstrap.
Using Composer Packages
Using Composer Packages
XenForo v2 uses Composer behind the scenes to include certain packages used by the core software

Similar resources

 bbcode parser A
Elimina los tags BBCode no deseados de las mensajes.
[AndyB] Disallow bold bbcode A
Disallows bold bbcode tag in posts.
[AndyB] HTML to bbcode A
Updates post with HTML to BBCode.
Back
Top