PDA

View Full Version : Show Thread Enhancements - One Touch Select ALL: CODE, PHP, HTMML


ry215
03-05-2008, 10:00 PM
This is small hack used Script selectCode.

Install:
1. Open Temp: headinclude
Add below:
<script type="text/javascript">
function selectCode(a)
{
var e = a.parentNode.parentNode.getElementsByTagName('PRE' )[0];
if (window.getSelection)
{
var s = window.getSelection();
if (s.setBaseAndExtent)
{
s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
}
else
{
var r = document.createRange();
r.selectNodeContents(e);
s.removeAllRanges();
s.addRange(r);
}
}
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>


2. Open bbcode_code:
find:
$vbphrase[code]:
Add below:
<a href="#" onclick="selectCode(this); return false;"><input type="button" value="Select All" /></a>

3. Open bbcode_html:
find:
$vbphrase[html_code]:
Add below:
<a href="#" onclick="selectCode(this); return false;"><input type="button" value="Select All" /></a>

4. Open bbcode_php:
find:
$vbphrase[php_code]:
Add below:
<a href="#" onclick="selectCode(this); return false;"><input type="button" value="Select All" /></a>

Next find:
$code
Replace with:
<pre>$code</pre>

That?s all. ;)

Hope u like! :D

codershark
03-06-2008, 03:05 PM
Nice Job !

Feckie (Roger)
03-06-2008, 04:34 PM
could this be done with select all and copy

ry215
03-06-2008, 04:37 PM
could this be done with select all and copy

I will update soon. Thanks for use. :)

Syria BoY
03-06-2008, 04:52 PM
Thanks :)

kaptanblack
03-06-2008, 05:11 PM
Nice mod thanks ry215

I will test of this

codershark
03-06-2008, 05:22 PM
will be very nice when you can "copy" integrate too.

SEOvB
03-07-2008, 01:21 AM
Instead of having the javascript in the headinclude template, why not move it to SHOWTHREAD template if this is the only place this is being used.

having it on headinclude will make it load for every page, when its not neccassary

Extreme24
03-07-2008, 02:09 AM
will be very nice when you can "copy" integrate too.

Wow... uhmm... Right Click -> Copy?

People seem lazy now adays...

codershark
03-07-2008, 05:00 AM
Yes Right Click -> Copy :D

valdet
03-07-2008, 04:40 PM
Yes Right Click -> Copy :D

CTRL+C is even better.. :D

codershark
03-07-2008, 04:43 PM
yes I only need the CTRL+C but it will be nice when he can include it

Triky
03-12-2008, 08:07 AM
I think I will install this one.
Thanks.

Gosef
03-26-2008, 11:04 AM
Nice Job !
Thanks

Dev.Sun
05-21-2008, 11:15 AM
thanks.

rskg4
06-22-2008, 10:40 AM
Thanks for the code

There's one problem I found with this, it doesn't work with multiple code boxes in the same thread. Any idea how to fix that?

Boofo
06-22-2008, 11:44 AM
This only works on IE right? You can do the same thing with one small js line wrapped around the pre tags.

rskg4
06-22-2008, 11:51 AM
This only works on IE right? You can do the same thing with one small js line wrapped around the pre tags.


I'm using the select all button in firefox.

I should rephrase my original post, as I did more testing. The code works for multiple code boxes in the same thread...but not for posts with more than 1 code box.

Boofo
06-22-2008, 12:08 PM
That is where wrapping works, but only for IE so far.

ry215
08-07-2008, 10:42 AM
I tested in FF and IE, it both worked. And, it also work with threads which have multiple code boxes :D

djrapid.com
10-04-2008, 12:05 AM
This is great

IIAnDoII
02-28-2009, 10:04 AM
Thanks and nice mod

ragtek
02-28-2009, 10:27 AM
Is it also possible to copy the code to the clipboard?

The4um
03-03-2009, 03:25 AM
works very well

dandanch
03-13-2009, 04:44 AM
It doesn't work with multiple code boxes in the same thread.does any one have a fix for that ? :confused:

Pessimist
08-01-2009, 10:42 AM
I would make so for PHP (this fixed spaces issue):
4. ...
Find:
<code style="white-space:nowrap">
<!-- php buffer start -->$code<!-- php buffer end -->
</code>
Replace with:
<pre style="margin: 0px;"><code style="white-space:nowrap"><!-- php buffer start -->$code<!-- php buffer end --></code></pre>

itsheinz
09-24-2009, 02:43 PM
great one im using it now:)

RedHacker
09-29-2009, 10:32 PM
ry215 can create and one button with deselect all....?

ravenfaust
12-13-2009, 04:03 PM
can you get this to work in 3.8 please?

RedHacker
12-15-2009, 06:39 AM
can you get this to work in 3.8 please?

It is work fine for 3.8.1 Version....

ravenfaust
12-26-2009, 05:23 PM
working in 3.8.4 :D

ravenfaust
12-27-2009, 05:42 PM
anyway to make this a text link instead of button?

RedHacker
01-10-2010, 11:35 AM
Can update to the vBulletin 4....?

muratcan25
01-22-2010, 01:59 PM
Thank you

snakedevil
06-03-2010, 12:22 PM
Can update to the vBulletin 4....?

I need to :)

lubbie
09-01-2010, 09:13 AM
If any is interested in PM me. i´ve got the update. Hope its ok for vborg and the coder. If not please tell me

almohd
03-05-2011, 02:43 PM
this is very nice. can I add button to select and copy codes?

shadow12
06-28-2011, 10:04 AM
very good thanks

dvdfanatic
07-11-2011, 09:12 AM
thank you.

Modify, images use

<input type="image" src="http://www.xyz..." value="Select All" width="160" height="55,5" board="0" />