MyBB Community Forums

Full Version: Code Select All
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Does anyone have a working plug-in for a "Select All" button for mybb forums v1.8.3?  Something similar to this old version from the past would be nice, but it's not compatible:  Code Select All for MyBB 1.6.x - Extensions - MyBB.de
DVZ Code Tags by Devilshakerz
(2022-04-30, 12:10 PM)PARADOXP Wrote: [ -> ]
DVZ Code Tags by Devilshakerz

That's a little more complex that what I need.  All I'm looking for is for a simple little button (or SELECT ALL link) at the top of a code box that will copy the code in that box to the clipboard.  

This is an actual code box.

_____________________________________________________________________________________________
|Code:  (Select All)                                                                        |
|
 This is a mock up of what the box would look like, with the link                          |

| to select all being above it.                                                             |

Just as simple as that, if I didn't explain myself properly.  It doesn't need to colorize the code, or add line numbers, or anything complex.  Just add a simple little Select All link or button above the code boxes, if such a thing would be possible.  Wink
For modern browsers, you can add something like this before </body> in the showthread template:

<script>
document.querySelectorAll('.codeblock').forEach(codeblock => {
	codeblock.querySelector('.title').addEventListener('click', () => {
		window.getSelection().selectAllChildren(codeblock.querySelector('code'));
	});
});
</script>

The .title selector can be changed to target any custom element added in the mycode_code template.
Many thanks Devilshakerz! It's exactly what I was hoping to find. You've made my day. Wink
(2022-04-29, 11:46 PM)SMcNeill Wrote: [ -> ]Does anyone have a working plug-in for a "Select All" button for mybb forums v1.8.3?  Something similar to this old version from the past would be nice, but it's not compatible:  Code Select All for MyBB 1.6.x - Extensions - MyBB.de


Hmm, while it looks like you may have already found an alternate solution already, but not sure if you did a search online already for such of the likes or not, but, here is just another suggestion along the lines of your initial plugin request, but the several variants of selectall plugin included in this old plugin repo found here: https://github.com/vintagedaddyo/MyBB_Pl...tallincode should still be working I would suppose and perhaps be along the lines of your initial request of a plugin of the likes? Just another suggestion for your request. Best of luck.