PDA

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


ry215
06 Mar 2008, 16:22
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
06 Mar 2008, 17:05
Nice Job !

Feckie (Roger)
06 Mar 2008, 18:34
could this be done with select all and copy

ry215
06 Mar 2008, 18:37
could this be done with select all and copy

I will update soon. Thanks for use. :)

Syria BoY
06 Mar 2008, 18:52
Thanks :)

kaptanblack
06 Mar 2008, 19:11
Nice mod thanks ry215

I will test of this

codershark
06 Mar 2008, 19:22
will be very nice when you can "copy" integrate too.

SEOvB
07 Mar 2008, 03:21
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
07 Mar 2008, 04:09
will be very nice when you can "copy" integrate too.

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

People seem lazy now adays...

codershark
07 Mar 2008, 07:00
Yes Right Click -> Copy :D

valdet
07 Mar 2008, 18:40
Yes Right Click -> Copy :D

CTRL+C is even better.. :D

codershark
07 Mar 2008, 18:43
yes I only need the CTRL+C but it will be nice when he can include it

Triky
12 Mar 2008, 10:07
I think I will install this one.
Thanks.

Gosef
26 Mar 2008, 13:04
Nice Job !
Thanks

Dev.Sun
21 May 2008, 13:15
thanks.

rskg4
22 Jun 2008, 12:40
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
22 Jun 2008, 13:44
This only works on IE right? You can do the same thing with one small js line wrapped around the pre tags.

rskg4
22 Jun 2008, 13:51
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
22 Jun 2008, 14:08
That is where wrapping works, but only for IE so far.

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

djrapid.com
04 Oct 2008, 02:05
This is great

IIAnDoII
28 Feb 2009, 12:04
Thanks and nice mod

ragtek
28 Feb 2009, 12:27
Is it also possible to copy the code to the clipboard?

The4um
03 Mar 2009, 05:25
works very well

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

Pessimist
01 Aug 2009, 12:42
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
24 Sep 2009, 16:43
great one im using it now:)

RedHacker
30 Sep 2009, 00:32
ry215 can create and one button with deselect all....?

ravenfaust
13 Dec 2009, 18:03
can you get this to work in 3.8 please?

RedHacker
15 Dec 2009, 08:39
can you get this to work in 3.8 please?

It is work fine for 3.8.1 Version....

ravenfaust
26 Dec 2009, 19:23
working in 3.8.4 :D

ravenfaust
27 Dec 2009, 19:42
anyway to make this a text link instead of button?

RedHacker
10 Jan 2010, 13:35
Can update to the vBulletin 4....?

muratcan25
22 Jan 2010, 15:59
Thank you

snakedevil
03 Jun 2010, 14:22
Can update to the vBulletin 4....?

I need to :)

lubbie
01 Sep 2010, 11:13
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
05 Mar 2011, 16:43
this is very nice. can I add button to select and copy codes?

shadow12
28 Jun 2011, 12:04
very good thanks

dvdfanatic
11 Jul 2011, 11:12
thank you.

Modify, images use

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