'SELECT ALL' feature

For support and discussion related to templates, themes, and imagesets in phpBB 3.0.
Get Involved
Locked
dragos2k7
Registered User
Posts: 62
Joined: Sat Dec 16, 2006 9:35 pm
Location: Romania
Name: Dragos Giurca
Contact:

'SELECT ALL' feature

Post by dragos2k7 »

What is the 'SELECT ALL' javascript code needed for this feature to work on subsilver2 styles? it would be very handy. thanks.
and if you can tell where to add it would be great. thanks.
User avatar
Raimon
Former Team Member
Posts: 12088
Joined: Tue May 30, 2006 5:31 pm
Location: Netherlands
Name: Raimon Meuldijk
Contact:

Re: 'SELECT ALL' feature

Post by Raimon »

I used it for my FIsubice2 style:
Raimon wrote: search:

Code: Select all

<!-- BEGIN code_open -->
<div class="codetitle"><b>{L_CODE}:</b></div><div class="codecontent">
<!-- END code_open -->

<!-- BEGIN code_close -->
</div>
<!-- END code_close -->

replace with:

Code: Select all

<!-- BEGIN code_open --><dl class="codebox"><dt>{L_CODE}: <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></dt><dd><code><!-- END code_open -->
<!-- BEGIN code_close --></code></dd></dl><!-- END code_close -->
And works fine on subsilver2 styles.
Need phpBB installation, extenstions, Styles or integrate phpBB with you website?
Contact me for fair prices and good service!
dragos2k7
Registered User
Posts: 62
Joined: Sat Dec 16, 2006 9:35 pm
Location: Romania
Name: Dragos Giurca
Contact:

Re: 'SELECT ALL' feature

Post by dragos2k7 »

thanks..i did it this way

Code: Select all

<!-- BEGIN code_open -->
<div class="codetitle"><b>{L_CODE}:</b> <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></div><div class="codecontent">
<code>
<!-- END code_open -->

<!-- BEGIN code_close -->
</code>
</div>
<!-- END code_close -->
but is there a way to change the look of the text inside the code tags? it's kind of small
EDIT
There is one problem, if i have 2 code boxes in the same post, it only selects the first :D. weird.
statm
Registered User
Posts: 447
Joined: Thu Jul 21, 2005 11:03 am
Location: NC, USA
Name: Matt
Contact:

Re: 'SELECT ALL' feature

Post by statm »

I also had that problem dragos when I incorporated the SELECT ALL in my style. The only way I could find to fix it was to use the exact code they used in prosilver. The definition list code. Once I used the exact code. It selected the individual box that I clicked and not just the first one.

This is how I did it in my subsilver based style:

Code: Select all

<!-- BEGIN code_open --><dl><dt class="codetitle"><strong>{L_CODE}:</strong> <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></dt><dd class="codecontent"><code><!-- END code_open -->
<!-- BEGIN code_close --></code></dd></dl><!-- END code_close -->
dragos2k7
Registered User
Posts: 62
Joined: Sat Dec 16, 2006 9:35 pm
Location: Romania
Name: Dragos Giurca
Contact:

Re: 'SELECT ALL' feature

Post by dragos2k7 »

thanks statm. i translated your example into mine. all i had to do is to close everything in another div

Code: Select all

<!-- BEGIN code_open -->
<div><div class="codetitle"><b>{L_CODE}:</b> <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></div><div class="codecontent">
<code>
<!-- END code_open -->

<!-- BEGIN code_close -->
</code>
</div></div>
<!-- END code_close -->
and it works. it selects any code. i find it better than the phpBB's one that adds to the curent selection :D

another problem i have with my forum is that i don't get redirected after posting. i have to press one of the links to return to the post
statm
Registered User
Posts: 447
Joined: Thu Jul 21, 2005 11:03 am
Location: NC, USA
Name: Matt
Contact:

Re: 'SELECT ALL' feature

Post by statm »

Im glad you got it working!
bpx
Registered User
Posts: 40
Joined: Wed Jan 02, 2008 11:53 am

Re: 'SELECT ALL' feature

Post by bpx »

I had tried this on VistaX style, but it not work. shame.
statm
Registered User
Posts: 447
Joined: Thu Jul 21, 2005 11:03 am
Location: NC, USA
Name: Matt
Contact:

Re: 'SELECT ALL' feature

Post by statm »

Well how did you do it bpx?
bpx
Registered User
Posts: 40
Joined: Wed Jan 02, 2008 11:53 am

Re: 'SELECT ALL' feature

Post by bpx »

What I tried was to open bbcode.html and search for

Code: Select all

<!-- BEGIN code_open -->
<div class="codetitle"><b>{L_CODE}:</b></div><div class="codecontent">
<!-- END code_open -->

<!-- BEGIN code_close -->
</div>
<!-- END code_close -->
and replace with

Code: Select all

<!-- BEGIN code_open -->
<div><div class="codetitle"><b>{L_CODE}:</b> <a href="#" onclick="selectCode(this); return false;">{L_SELECT_ALL_CODE}</a></div><div class="codecontent">
<code>
<!-- END code_open -->

<!-- BEGIN code_close -->
</code>
</div></div>
<!-- END code_close -->
and it does not work?
User avatar
Raimon
Former Team Member
Posts: 12088
Joined: Tue May 30, 2006 5:31 pm
Location: Netherlands
Name: Raimon Meuldijk
Contact:

Re: 'SELECT ALL' feature

Post by Raimon »

After that change did you refresh your template into your administrationpanel?
Need phpBB installation, extenstions, Styles or integrate phpBB with you website?
Contact me for fair prices and good service!
statm
Registered User
Posts: 447
Joined: Thu Jul 21, 2005 11:03 am
Location: NC, USA
Name: Matt
Contact:

Re: 'SELECT ALL' feature

Post by statm »

I think the mentality is that if its subsilver it shouldn't use the dl,dt,dd tags. Its perfectly fine to use the definition tags.
bpx
Registered User
Posts: 40
Joined: Wed Jan 02, 2008 11:53 am

Re: 'SELECT ALL' feature

Post by bpx »

I dunno? But if you can get it working for VistaX style, please post here. thanks
statm
Registered User
Posts: 447
Joined: Thu Jul 21, 2005 11:03 am
Location: NC, USA
Name: Matt
Contact:

Re: 'SELECT ALL' feature

Post by statm »

Im sure if you use the way I did it. It will work anywhere.
bpx
Registered User
Posts: 40
Joined: Wed Jan 02, 2008 11:53 am

Re: 'SELECT ALL' feature

Post by bpx »

@ statm - I had tried your code, but it still does not work on VistaX or AeroBlue as the style is now called. :(
statm
Registered User
Posts: 447
Joined: Thu Jul 21, 2005 11:03 am
Location: NC, USA
Name: Matt
Contact:

Re: 'SELECT ALL' feature

Post by statm »

Wow, Im very sorry.. I forgot one of the key pieces of code that makes it even work.. I don't know how Raimon did it without this, but this is what the code in bbcode.html looks for.

You need to add this to the head in overall_header.html:

Code: Select all

function selectCode(a)
{
	// Get ID of code block
	var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];

	// Not IE
	if (window.getSelection)
	{
		var s = window.getSelection();
		// Safari
		if (s.setBaseAndExtent)
		{
			s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
		}
		// Firefox and Opera
		else
		{
			var r = document.createRange();
			r.selectNodeContents(e);
			s.removeAllRanges();
			s.addRange(r);
		}
	}
	// Some older browsers
	else if (document.getSelection)
	{
		var s = document.getSelection();
		var r = document.createRange();
		r.selectNodeContents(e);
		s.removeAllRanges();
		s.addRange(r);
	}
	// IE
	else if (document.selection)
	{
		var r = document.body.createTextRange();
		r.moveToElementText(e);
		r.select();
	}
}
Locked

Return to “[3.0.x] Styles Support & Discussion”