phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Looking for a MOD

Goto page 1, 2  Next
 
Search this topic... | Search phpBB2 Discussion... | Search Box
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Author Message
JLA
Board Member



Joined: 30 Apr 2009

Posts: 298
Location: U.S.A


flag
PostPosted: Fri Sep 16, 2011 11:18 pm 
Post subject: Looking for a MOD

Looking for a MOD

A quote collapsing mod that will work for any visitor (logged in or not) and doesn't require refreshing the page.

Thanks in advance

_________________
http://www.jlaforums.com
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 416
Location: Québec


flag
PostPosted: Sat Sep 17, 2011 12:32 am 
Post subject: Re: Looking for a MOD

Something like a spoiler mod, I reckon? I haven't tested it, but it seems to be doing what you want (see line 112 in particular), so you could borrow from it and tweak your quote BBCode.

It's a very simple JavaScript trick, I've used for different parts of my website.
Back to top
JLA
Board Member



Joined: 30 Apr 2009

Posts: 298
Location: U.S.A


flag
PostPosted: Tue Sep 20, 2011 10:41 pm 
Post subject: Re: Looking for a MOD

Salvatos wrote:
Something like a spoiler mod, I reckon? I haven't tested it, but it seems to be doing what you want (see line 112 in particular), so you could borrow from it and tweak your quote BBCode.

It's a very simple JavaScript trick, I've used for different parts of my website.


Thanks. From that code, I was able to come up with the following. All works except one scenario

First, here is the code I have used

Code:

Open bbcode.tpl

Find:
<!-- BEGIN quote_username_open --></span>


After Add:
<div class="smallfont" style="margin-bottom:2px">
<input type="button" value="Show Quote" style="font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = 'Hide Quote'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show Quote'; }">
</div>
<div style="margin: 0px; padding: 6px; border: 1px inset; border: #D1D7DC; border-style: solid; border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px">

<div style="display: none;">

Find: <!-- BEGIN quote_open -->

After Add:
<div class="smallfont" style="margin-bottom:2px">
<input type="button" value="Show Quote" style="font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerText = ''; this.value = 'Hide Quote'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show Quote'; }">
</div>
<div style="margin: 0px; padding: 6px; border: 1px inset; border: #D1D7DC; border-style: solid; border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px">

<div style="display: none;">

Find:
<!-- BEGIN quote_close -->




      </td>
   </tr>
</table>

After add:
</div>
</div>
</div>


So here is the deal

What works:
Username quotes, standard quote, username quote and standard quote with multiple nested levels all work as expected.

What doesn't work:
In a post if there are separate quotes, the show/hide will only work for the 1st quote in that particular post. The other "separate" quotes in that post will not work.

Ideas?

_________________
http://www.jlaforums.com
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 416
Location: Québec


flag
PostPosted: Wed Sep 21, 2011 12:38 am 
Post subject: Re: Looking for a MOD

I think what could work is changing your DIV hierarchy. Keep only one container, inside which you have your INPUT, and then a second DIV that contains your quote table.

Then use "this.parentNode.childNodes[1]" instead. If I'm not mistaken, this goes up to the container div, then skips the input and reaches the table div.

Code:

Find: <!-- BEGIN quote_username_open --></span>
And
Find: <!-- BEGIN quote_open --></span>
After each, Add:

<div class="smallfont" style="margin-bottom:2px">
<input type="button" value="Show Quote" style="font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.childNodes[1].style.display != '') { this.parentNode.childNodes[1].style.display = ''; this.innerText = ''; this.value = 'Hide Quote'; } else { this.parentNode.childNodes[1].style.display = 'none'; this.innerText = ''; this.value = 'Show Quote'; }">

<div style="margin: 0px; padding: 6px; border: 1px inset; border: #D1D7DC; border-style: solid; border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; display: none;">


Code:

Find:
<!-- BEGIN quote_close -->
(...)
</table>
After, Add:

</div>
</div>


I just tested that code quickly and it worked with several quotes in a post, including some nested ones.
There would be a bit of tweaking to do for it to appear the way I'd like it to (personally I wouldn't add divs but simply put the code on the table with a link instead of a button), but the technical side of it is covered.

Oh by the way, does this.innerText = ''; really do anything to your input?
Back to top
JLA
Board Member



Joined: 30 Apr 2009

Posts: 298
Location: U.S.A


flag
PostPosted: Wed Sep 21, 2011 8:35 am 
Post subject: Re: Looking for a MOD

Salvatos wrote:
I think what could work is changing your DIV hierarchy. Keep only one container, inside which you have your INPUT, and then a second DIV that contains your quote table.

Then use "this.parentNode.childNodes[1]" instead. If I'm not mistaken, this goes up to the container div, then skips the input and reaches the table div.

Code:

Find: <!-- BEGIN quote_username_open --></span>
And
Find: <!-- BEGIN quote_open --></span>
After each, Add:

<div class="smallfont" style="margin-bottom:2px">
<input type="button" value="Show Quote" style="font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.childNodes[1].style.display != '') { this.parentNode.childNodes[1].style.display = ''; this.innerText = ''; this.value = 'Hide Quote'; } else { this.parentNode.childNodes[1].style.display = 'none'; this.innerText = ''; this.value = 'Show Quote'; }">

<div style="margin: 0px; padding: 6px; border: 1px inset; border: #D1D7DC; border-style: solid; border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; display: none;">


Code:

Find:
<!-- BEGIN quote_close -->
(...)
</table>
After, Add:

</div>
</div>


I just tested that code quickly and it worked with several quotes in a post, including some nested ones.
There would be a bit of tweaking to do for it to appear the way I'd like it to (personally I wouldn't add divs but simply put the code on the table with a link instead of a button), but the technical side of it is covered.

Oh by the way, does this.innerText = ''; really do anything to your input?


Gave this a quick try and it had the show button. When clicking it - everything disappears (button and all)

Can have another look later in the AM

Thanks

_________________
http://www.jlaforums.com
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 416
Location: Québec


flag
PostPosted: Wed Sep 21, 2011 4:02 pm 
Post subject: Re: Looking for a MOD

I don't really know what to tell you, I tested that code exactly as it appears in a vanilla bbcode.tpl (as far as I know) on subSilver. Maybe it's a browser compatibility issue, I'm using Firefox 6.

Maybe someone else can give it a go and see?
Back to top
JLA
Board Member



Joined: 30 Apr 2009

Posts: 298
Location: U.S.A


flag
PostPosted: Wed Sep 21, 2011 6:23 pm 
Post subject: Re: Looking for a MOD

Salvatos wrote:
I don't really know what to tell you, I tested that code exactly as it appears in a vanilla bbcode.tpl (as far as I know) on subSilver. Maybe it's a browser compatibility issue, I'm using Firefox 6.

Maybe someone else can give it a go and see?


Using firefox here as well.

It shows a button that says "Show Quote" but no quote below the button. When you click the button, it disappears.

_________________
http://www.jlaforums.com
Back to top
JLA
Board Member



Joined: 30 Apr 2009

Posts: 298
Location: U.S.A


flag
PostPosted: Wed Sep 21, 2011 7:41 pm 
Post subject: Re: Looking for a MOD

I found this which appears to work better. It either closes or hides "all" the quotes on a page. A few problems with this code exist though

* Show Quotes button shows at all quote levels (nested quotes) The button should only appear at the top level quote of nested quotes.
* When clicking, button does not change to "Hide Quotes"
* Does not default to quotes being hidden when a page is loaded. Quotes are show and user has to click to hide them

This might not be the best way to do this, but it might be a start to find the best method to accomplish this?

Here is the code

Code:

Open viewtopic_body.tpl

Before anything else add the following
<script type="text/javascript">
    var hidden = false;   
   
    function getElementsByClass( searchClass, domNode, tagName) {
   if (domNode == null) domNode = document;
   if (tagName == null) tagName = '*';
   var el = new Array();
   var tags = domNode.getElementsByTagName(tagName);
   var tcl = " "+searchClass+" ";
   for(i=0,j=0; i<tags.length; i++) {
      var test = " " + tags[i].className + " ";
      if (test.indexOf(tcl) != -1)
         el[j++] = tags[i];
   }
   return el;
   }

    function hidequotes()
    {
        hidden = !hidden;
        var newDisplay;
        if(hidden)
        {
            newDisplay = 'none';
        }
        else
        {
            newDisplay = 'block';
        }
        var quotes = getElementsByClass("classA", null, "div");
        for(var i = 0; i < quotes.length; i++)
        {
            quotes[i].style.display = newDisplay;
        }
    }
    </script>

Open bbcode.tpl
Find: <!-- BEGIN quote_username_open --></span>
and
<!-- BEGIN quote_open -->
      </span>
After add:  <button style="font-size:10px;margin:0px;padding:0px;" onClick="hidequotes()">Show Quotes</button>
<div class="classA" style="margin: 0px; padding: 6px;">

Find: <!-- BEGIN quote_close -->




      </td>
   </tr>
</table>

After add:
<div>


_________________
http://www.jlaforums.com
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 416
Location: Québec


flag
PostPosted: Thu Sep 22, 2011 12:18 am 
Post subject: Re: Looking for a MOD

* Show Quotes button shows at all quote levels (nested quotes) The button should only appear at the top level quote of nested quotes.
I'm not sure you'll be able to do that with this system. You would need a way to identify when a quote is nested within another, and that's not handled at all as it is. phpBB just keeps adding divs within divs and they're all identical except for their content.

One hacky way I could think of using JavaScript for it would be to use an onLoad event function that would check for each classA div if it has childNodes that are buttons. If so, it would hide them (display: none). But I'm not a big fan of using onLoad for that kind of tinkering.

* Does not default to quotes being hidden when a page is loaded. Quotes are show and user has to click to hide them

Code:
Change:
<div class="classA" style="margin: 0px; padding: 6px;">

To:
<div class="classA" style="margin: 0px; padding: 6px; display: none;">


And

Code:
Change:
<script type="text/javascript">
    var hidden = false;

To:
<script type="text/javascript">
    var hidden = true;


* When clicking, button does not change to "Hide Quotes"

Code:
Change:
        var newDisplay;
        if(hidden)
        {
            newDisplay = 'none';
        }
        else
        {
            newDisplay = 'block';
        }
        var quotes = getElementsByClass("classA", null, "div");
        for(var i = 0; i < quotes.length; i++)
        {
            quotes[i].style.display = newDisplay;
        }

To:
        var newDisplay;
        var newDisplayButton;
        if(hidden)
        {
            newDisplay = 'none';
            newDisplayButton = 'Show Quotes';
        }
        else
        {
            newDisplay = 'block';
            newDisplayButton = 'Hide Quotes';
        }
        var quotes = getElementsByClass("classA", null, "div");
        var displayButtons = getElementsByClass("classB", null, "button");
        for(var i = 0; i < quotes.length; i++)
        {
            quotes[i].style.display = newDisplay;
            displayButtons[i].innerHTML = newDisplayButton;
        }

And
Code:
Change:
<button style="font-size:10px;margin:0px;padding:0px;" onClick="hidequotes()">Show Quotes</button>

To:
<button class="classB" style="font-size:10px;margin:0px;padding:0px;" onClick="hidequotes()">Show Quotes</button>



Tested and worked on my board.
Back to top
JLA
Board Member



Joined: 30 Apr 2009

Posts: 298
Location: U.S.A


flag
PostPosted: Thu Sep 22, 2011 2:04 am 
Post subject: Re: Looking for a MOD

Thanks for that. It worked as expected. The only thing I noticed is when you go from one topic page to another, the quotes stay in the same state as the last page you were on except the button says show quotes even if they are already showing. You have to click the button twice to get it "sync'd up'

I am starting to see what you mean about your previous statement about using a link instead of a button.

I also do not care for having the button appear in all of the nested quotes as well so perhaps need to find another method for doing this since that will not work with this particular script. I would like to get your previous method working. Did you see my last comments?

I'm really surprised that there wasn't a mod released for this function back in the phpbb 2 heyday.

_________________
http://www.jlaforums.com
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 416
Location: Québec


flag
PostPosted: Thu Sep 22, 2011 7:14 am 
Post subject: Re: Looking for a MOD

JLA wrote:
The only thing I noticed is when you go from one topic page to another, the quotes stay in the same state as the last page you were on except the button says show quotes even if they are already showing. You have to click the button twice to get it "sync'd up'

That's weird, everything should reset on a page load...

JLA wrote:
I also do not care for having the button appear in all of the nested quotes as well so perhaps need to find another method for doing this since that will not work with this particular script. I would like to get your previous method working.

Regardless of which method we use, the way to hide nested buttons will be the same (or at least, applicable to both), if we find one, so it's your call.

JLA wrote:
Did you see my last comments?

I don't know which one you're referring to, but I don't think I've missed anything. It's late, though icon_rolleyes.gif
Back to top
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Thu Sep 22, 2011 1:32 pm 
Post subject: Re: Looking for a MOD

Can you guys make a MOD with instructions out of this for us noobs? icon_rolleyes.gif
it would be really useful this quote-collapse mod!
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 416
Location: Québec


flag
PostPosted: Thu Sep 22, 2011 4:04 pm 
Post subject: Re: Looking for a MOD

I probably could, but which version would you like?

The first take collapses only the quote associated with the button and the code is a little more compact (possibly more efficient resource-wise but I'm just guessing), the second collapses all quotes on the page regardless of which button you click.

And do you prefer a button above the quote or a link next to the "X wrote:" line?
Back to top
dondino
Board Member



Joined: 09 Dec 2008

Posts: 144


flag
PostPosted: Thu Sep 22, 2011 8:17 pm 
Post subject: Re: Looking for a MOD

Hello,
I wouldn't like to collapse all the quotes in the entire viewforum page,
i just want that the user can decide to collapse just a quote from a particular post, maybe because the quoted message is too long or for some other reasons.
So the collapse should be only post - exclusive.

As for the position of the button, I would like to have it on the extreme right of the quote header message shown on the left:

Salvatos @ 22 Sep 2011, 16:04 wrote: ------------------------> [collapse button]

the button with collapse should be on the right side of it

By the way, I have just found this code
Can this be useful for us somehow?
And on phpbb forum I have found also this even if i think its just for regged users since its profile related
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 416
Location: Québec


flag
PostPosted: Thu Sep 22, 2011 11:46 pm 
Post subject: Re: Looking for a MOD

Alright, that's easy enough (other than it took me a while to figure out how to get to the proper node).

Code:
OPEN templates/subSilver/bbcode.tpl

FIND
     <td><span class="genmed"><b>{USERNAME} {L_WROTE}:</b></span></td>

AFTER, ADD
     <td align="right"><span class="genmed"><a class="gensmall" onClick="if (this.parentNode.parentNode.parentNode.nextSibling.nextSibling.style.display != '') { this.parentNode.parentNode.parentNode.nextSibling.nextSibling.style.display = ''; this.innerHTML = 'Hide Quote'; } else { this.parentNode.parentNode.parentNode.nextSibling.nextSibling.style.display = 'none'; this.innerHTML = 'Show Quote'; }">Hide quote</a></span></td>

FIND
<td class="quote"><!-- END quote_username_open -->

REPLACE WITH
<td class="quote" colspan="2"><!-- END quote_username_open -->

FIND
     <td><span class="genmed"><b>{L_QUOTE}:</b></span></td>

AFTER, ADD
     <td align="right"><span class="genmed"><a class="gensmall" onClick="if (this.parentNode.parentNode.parentNode.nextSibling.nextSibling.style.display != '') { this.parentNode.parentNode.parentNode.nextSibling.nextSibling.style.display = ''; this.innerHTML = 'Hide Quote'; } else { this.parentNode.parentNode.parentNode.nextSibling.nextSibling.style.display = 'none'; this.innerHTML = 'Show Quote'; }">Hide quote</a></span></td>

FIND
<td class="quote"><!-- END quote_open -->

REPLACE WITH
<td class="quote" colspan="2"><!-- END quote_open -->


That's it. You may want to give the link a different class depending on your template.

Tested and works on Firefox 6 (though I prefer having the link right next to "Username wrote:" icon_smile.gif ).
Back to top
Display posts from previous:   
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Page 1 of 2 All times are GMT
Goto page 1, 2  Next
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0814 seconds using 15 queries. (SQL 0.0025 Parse 0.0634 Other 0.0154)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo