PDA

View Full Version : Collapsable Quotes


Hellcat
01 Feb 2006, 09:07
As requested in this thread (http://www.vbulletin.org/forum/showthread.php?t=106863) :)

Collapsable Quote Mod

What does it do?
==================
Sometimes, when others post lots of quotes, or very long ones, you might get the wish to hide the quoted text and only read the new posted message.
Now you can :)
This little mod makes the quotes collapsable, like the categories on the forumhome or other areas of vBulletin.


Installation
==============
To apply this go to:
AdminCP -> Style Manager -> Edit templates -> "BB Code Layout Templates" group -> Template: "bbcode_quote"

Edit that template, cut out (=delete) EVERYTHING that's in there and paste this back in:


<div style="margin:20px; margin-top:5px; <if condition="$show['iewidthfix']">width: 100%;</if>">
<table cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100%">

<if condition="$show[quoteid]=$show[quoteid] + 1 + $vbulletin->userinfo[lastactivity]"></if>

<tr>
<td class="tcat">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('quote_$show[quoteid]')"><img

id="collapseimg_quote_$show[quoteid]" src="$stylevar/collapse_tcat{$collapseimg_forumid}.gif" alt="" border="0" /></a>
<div class="smallfont" style="margin-bottom:2px">
<a href="#top" onclick="return toggle_collapse('quote_$show[quoteid]')">$vbphrase[quote]
<if condition="$show['username']">($username)</if>: <em>(click to expand/collapse)</em></a>
</div>
</td>
</tr>

<tbody id="collapseobj_quote_$show[quoteid]" style="{$collapseobj_forumid}">
<tr>
<td class="alt2" style="border:1px inset">
<if condition="$show['username']">
<div><phrase 1="$username">$vbphrase[originally_posted_by_x]</phrase></div>
<div style="font-style:italic">$message</div>
<else />
$message
</if>
</td>
</tr>
</tbody>


</table>
</div>

<script type="text/javascript"> <!--
toggle_collapse('quote_$show[quoteid]');
--> </script>


Hit "SAVE" and you're done :)


*** If you are one of the lucky folks that have the "Template Manager" installed: ***
You can simply take the template .XML also supplied as download and import it via the template manager -> even faster and more easy done :D
(you might have to check "overwrite templates" when importing)


[i]What else?
============
By default this collapsable quotes start up collapsed!
So if a user wants to read the quoted text he has to uncollapse it.

If you want it the other way round, users can collapse quotes they do not want to waste space for the moment:
Remove (or leave out at install) the last three lines of the template:

<script type="text/javascript"> <!--
toggle_collapse('quote_$show[quoteid]');
--> </script>

If that part is removed/left out all quotes start up uncollapsed and visible.


That's it.

Have fun :)

Zia
01 Feb 2006, 10:37
Yahoooooooooooooooooooooooooooooooooooooooo

HellCat Rockzzzzzzzzzz

First POst :)

/me klicks install

no doubt it will reduce page loading time with a long quote

Thanx Man...really thnx

AshokForums.com
01 Feb 2006, 10:40
Installed

IrPr
01 Feb 2006, 10:56
Nice Modification ;)
is it compatible with Backlink for Quotes (http://www.vbulletin.org/forum/showthread.php?t=91282) By Andreas ?


no doubt it will reduce page loading time with a long quote

is this rite?

Snake
01 Feb 2006, 12:21
This is great! Thanks...

Zia
01 Feb 2006, 13:49
Nice Modification ;)
is it compatible with Backlink for Quotes (http://www.vbulletin.org/forum/showthread.php?t=91282) By Andreas ?


is this rite?

backlinks to quote put an link with the origin post...i didnt use this...
in ipb this kinda feature is avilable...& its really Kool...full quote in the reply but Collaps..after klik it will xpand & readable...

yeah its really nice...if any case u have to quote a LONG POST..that long post will be Collaps...

umm umm......i think another feature would be nice if added here....ignore any image in quote
Mr.Coder can u give a thought on it?


I Love This hack...its too good...only needed to edit template..nothing els...
in my view samll change but big out-put

Gizmo999
01 Feb 2006, 15:14
click, Giz hits the install button

Nice, very useful.

Gizmo999
01 Feb 2006, 15:46
hmm, not working on posts using quotes entered after I installed it, works fine on all those post with quotes previous to it :(

Gizmo999
01 Feb 2006, 16:04
logged out and back and it now works again, haven't tried a new quoted post yet though... when open the quote dialogue still say "click to expand" not "click to close"

GamerJunk.net
01 Feb 2006, 17:29
/me applauds

Nice hack

Zia
01 Feb 2006, 17:49
logged out and back and it now works again, haven't tried a new quoted post yet though... when open the quote dialogue still say "click to expand" not "click to close"

would u mind to post a Screen Shot before & after?

thnx

Gizmo999
01 Feb 2006, 20:59
Yeah, no problem, you can see in screen shot 1 dialogue is click to expand and it screen shot 2 it stays the same only the quote box is now expanded.

Gizmo999
01 Feb 2006, 21:10
Just had the same error as this afternoon, everything was Ok then I read a thread and the quote box was already open, tried to collapse and it wouldn't, went to a different theme based on bulletin default and it worked OK but the one I usually use is heavily customised, no idea why it does it a random though :(

More on this, it happens only in certain threads and only where there is more than one quoted box, the first quote works fine and collapses or opens, the second and subsequent are open when the page loads , if you try and collapse them it opens or closes the quote in the earliest post, weird.

Hellcat
02 Feb 2006, 02:11
The thing with the text is just a phrasing issue.
I changed it in the description and attached files to "click to expand/collapse".
The text doen't change when the quote is expaned or collapsed - it's not supposed to, at least at the moment ;)


hmm, not working on posts using quotes entered after I installed it, works fine on all those post with quotes previous to it :(
That's caused by vB's page caching.
But, like you already said, logging out and back in usually does the trick :)

XtremeOffroad
02 Feb 2006, 03:22
Love it Hellcat.
clicks Install.

Mudvayne
02 Feb 2006, 10:36
okiz...... I found a bug may b... Hellcats.. U better chk the link

http://www.golpo.net/forum/showpost.php?p=4924&postcount=16

Zia
02 Feb 2006, 11:07
helo hellcat..

seemd quote inside quote...
a post with previous quote is okay..when any one quote that one.... here comes the porblem........ "Paid Subscribers Link" shown....

http://www.golpo.net/forum/showthread.php?p=5024#post5024

this will show the full thread..1st quote is preffy nice...2nd quote ..its the problem...

is there any way that Quote will always Ignore Image & always ignore if there any previous quote...

Thnx

Gizmo999
02 Feb 2006, 14:31
The thing with the text is just a phrasing issue.
I changed it in the description and attached files to "click to expand/collapse".
The text doen't change when the quote is expaned or collapsed - it's not supposed to, at least at the moment ;)



That's caused by vB's page caching.
But, like you already said, logging out and back in usually does the trick :)


thanks for new phrase wording.

Is there any cache setting I can change to stop this opening quotes in certain threads, logging out and in occasionally works but not enough times and even logging in on a different computer as a different user the thread still has same problem. I can't work out why only odd threads are affected, its just happened in a 2 page thread where the first page is perfect but the second opens expanded other than first quote on that page.

TosaInu
02 Feb 2006, 18:11
Nice idea.
It doesn't fully work yet though.

Quotes prior to the hack, are still old style (granted that's probably because of post cache in html).

When a user makes a post with a single quote in a topic and then another post with a single quote, only the first one can be un/collapsed. The second one is uncollapsed from the start and can't be collapsed. Even worse, collapsing it just collapses the quote in the first post.

http://forums.totalwar.org/colquote.gif

Quotes from different users work fine, as long as they are the first one by that user.

Gizmo999
02 Feb 2006, 18:14
Thank you for explaining that better than I could.


Nice idea.
It doesn't fully work yet though.

Quotes prior to the hack, are still old style (granted that's probably because of post cache in html).

When a user makes a post with a single quote in a topic and then another post with a single quote, only the first one can be un/collapsed. The second one is uncollapsed from the start and can't be collapsed. Even worse, collapsing it just collapses the quote in the first post.

http://forums.totalwar.org/colquote.gif

Quotes from different users work fine, as long as they are the first one by that user.

TosaInu
02 Feb 2006, 19:55
Thank you for explaining that better than I could.

That would be the first time Gizmo999 :) English is not my native language.

Gizmo999
02 Feb 2006, 20:18
That would be the first time Gizmo999 :) English is not my native language.

its meant to be mine but I'm from the far north, almost into Scotland so my dialect is different:D :D

Hellcat
02 Feb 2006, 20:26
I might have an idea why this happens....
I'll look into this tonight and keep you posted!

Zia
02 Feb 2006, 20:39
I might have an idea why this happens....
I'll look into this tonight and keep you posted!

thankx man...we are waiting.....
plz give a thought about ignore image in quote...


thnx

Hellcat
02 Feb 2006, 21:24
thankx man...we are waiting.....
plz give a thought about ignore image in quote...

thnx
You want [img] tags in quotes striped?
Or (IMO better) converted to [url] tags?

Hmm.... that would be a different thing, but should be possible to do pretty easy with a plugin at the right hook....

/me thinks

Zia
02 Feb 2006, 21:30
thnx man...
did u figured out the probs..describe last post..

quote-inside a quote it showd the "paid subscriber link" ?

::) give a deep deep think...
/me offers hellcat a chilled bear & a cigar...

Hellcat
03 Feb 2006, 01:40
No clue where a subscription link could come from.

But I (hopfully) solved the "Later quote collapses/expands quote from earlier post" problem.

Replace this line: <if condition="$show[quoteid]=$show[quoteid]+1"></if> with this one: <if condition="$show[quoteid]=$show[quoteid] + 1 + $vbulletin->userinfo[lastactivity]"></if>

Instsructions and attachments have already been updated, hopfully that does the trick, let me know if there are still issues :)

Gizmo999
03 Feb 2006, 08:50
Sorry :(

I applied the code change but its still the same only now the first quote opens "expanded" and has same problem - subsequent quotes are "expanded" clicking collapse closes the very first one :(

Thanks for the time and effort on this

Hellcat
03 Feb 2006, 08:58
Sorry :(

I applied the code change but its still the same only now the first quote opens "expanded" and has same problem - subsequent quotes are "expanded" clicking collapse closes the very first one :(

Thanks for the time and effort on this
That might most likely be caused by vB's caching....
I experienced that myself during my experiments and didn't find a way (yet) to counteract it.

Try this:
On a post that seems to "ignore" the last modification to the template, edit and save that post and try again - should work now.

Try to post some some quote-posts in a test thread and look if everythings works there.
If it does -> it's the vB cache still pulling the old version of the template.

That cache is EVIL!
I disabled it on my boards....

Gizmo999
03 Feb 2006, 10:09
That might most likely be caused by vB's caching....
I experienced that myself during my experiments and didn't find a way (yet) to counteract it.

I disabled it on my boards....

Is that the post caching in admin Cp>server settings/optimisation ?? sorry, I'm new to all this :(

Hellcat
03 Feb 2006, 10:23
Is that the post caching in admin Cp>server settings/optimisation ??
Yes, it's the "Cached Posts Lifespan" setting.
On my live board I have that set to "0", my board isn't that huge that I need the cache to pull load off the server....


sorry, I'm new to all this :(
Hey,no problem!
The only stupid question is the one not asked :)
We all started at square one and had to ask our way through ;)

Gizmo999
03 Feb 2006, 11:06
Yes, it's the "Cached Posts Lifespan" setting.
On my live board I have that set to "0", my board isn't that huge that I need the cache to pull load off the server....

Thanks for the help, I tried editing a post with a specific users quote and all my subsequent posts using that users quotes work fine. Switching off cache made no difference to existing quoted posts/threads. We'll see how it goes on new posts/quoted posts.



Hey,no problem!
The only stupid question is the one not asked :)
We all started at square one and had to ask our way through ;)

I do try and ask and learn but its hard, I do marketing and have a little computer knowledge but maybe that is more dangerous than having none :D :D

Gizmo999
03 Feb 2006, 18:50
One quick question, the phrase Quote(user):click to expand /contract isn't showing up as the font colour is the same as the background (red), from the code it looks like the font style is smallfont yet my smallfont in my style is white. How do i change that colour please??

TosaInu
03 Feb 2006, 18:56
We have a spoiler code and I modified that one to make collapsable quotes. Nesting and Cache proof.

Same template bbcode_quote, replace the whole content:
<div style="margin:5px 20px 20px 20px">

<div class="smallfont" style="margin-bottom:2px">

<input type="button" value="Show" style="width:45px;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'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">

<if condition="$show['username']">
<phrase 1="$username">$vbphrase[originally_posted_by_x]</phrase>: click show to read.
<else />
Quote: click show to read.
</if>

</div>

<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">

<div style="display: none;">

<class="alt2" style="border:1px inset">
<if condition="$show['username']"> <div style="font-style:italic">$message</div>
<else />
$message
</if>

</div>

</div>

</div>


Thanks to Hellcat.

IrPr
03 Feb 2006, 19:22
Updated Today?

djwins
28 Feb 2006, 13:04
This would be great if it would check to see how many lines where in the quote before collapsing it.

Maybe 4 lines or less and the quote isn't collapsed.

LEAD_WEIGHT
02 Mar 2006, 02:39
Would it be possible to create a collapse field, but still be still be open with scrollbar. I do not know if select all can be made without file editing. see image below and follow link to site that has this a functional one. I notice it requires files edits to make for that brand of message board.

http://img212.imageshack.us/img212/8061/expandfield5jy.png

Demo
http://forums.phpmix.org/viewtopic.php?p=1164#1164
http://forums.phpmix.org/viewtopic.php?p=1165#1165

Tralala
02 Mar 2006, 04:25
In order to remove the redundant attribution...

From this:
Quote (Max): (click to expand/collapse)
Originally Posted by Max
This is a test...

to this:
Quote (Max):
This is a test...

Here's the code I modified.

<div style="margin:20px; margin-top:5px; <if condition="$show['iewidthfix']">width: 100%;</if>">
<table cellpadding="$stylevar[cellpadding]" cellspacing="0" border="0" width="100%">

<if condition="$show[quoteid]=$show[quoteid] + 1 + $vbulletin->userinfo[lastactivity]"></if>

<tr>
<td class="tcat">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('quote_$show[quoteid]')"><img

id="collapseimg_quote_$show[quoteid]" src="$stylevar[imgdir_button]/collapse_tcat{$collapseimg_forumid}.gif" alt="" border="0" /></a>
<div class="smallfont" style="margin-bottom:2px">
<a href="#top" onclick="return toggle_collapse('quote_$show[quoteid]')">$vbphrase[quote]
<if condition="$show['username']">($username)</if></a>
</div>
</td>
</tr>

<tbody id="collapseobj_quote_$show[quoteid]" style="{$collapseobj_forumid}">
<tr>
<td class="alt2" style="border:1px inset">
<if condition="$show['username']">
<div style="font-style:italic">$message</div>
<else />
$message
</if>
</td>
</tr>
</tbody>


</table>
</div>

Yes, I removed the "click to expand/collapse" text; I found it too wordy and unnecessary.

Thanks for a great hack!

Tralala
02 Mar 2006, 06:14
How can I make the "banner" a bit thinner? Users are complaining that it's distracting.


Actually, some users really don't like this change, and don't see why you'd want to collapse a quote in the first place at all.

And of course, others love it. :)


Like your Quoted IMG->URL hack (http://www.vbulletin.org/forum/showthread.php?t=107022), can this be made a user preference, Hellcat?

Allow each user to choose, in UserCP -> Edit Options:

Quoting:
Old style vs. new style
If new style, Default to collapsed vs. Default to expanded

ElForro
12 Mar 2006, 10:11
Hi.... One simple question.... I would love to use this but as a NEW BBCode.... I mean: [ spoiler ]something[ /spoiler ]

But i need something to replace the "quote_$show[quoteid]" in order to work as a separate BBCode...

Here's what i've got.. It works when only is a single "quote", but it doesn't when there ara more than one...

<div style="margin:20px; margin-top:5px;">

<table class="tborder" border="0" width="100%">

<tr>

<td class="thead">

<div class="smallfont" style="margin-bottom:2px">

<a href="#top" onclick="return toggle_collapse('quote_$show[quoteid]')"><b>Spoiler</b> | Hace click para ver / ocultar</a>

</div>

</td>

</tr>

<tbody id="collapseobj_quote_$show[quoteid]" style="{$collapseobj_forumid}">

<tr>

<td class="alt2">

{param}

</td>

</tr>

</tbody>

</table>

</div>

<script type="text/javascript"> <!--

toggle_collapse('quote_$show[quoteid]');

--> </script>

Thanks!! And sorry about my english! :D

InsaneContender
09 May 2006, 00:57
Your code isn't XHTML 1.0 Traditional valid. Here's a quick fix...

Change:

<tbody id="collapseobj_quote_$show[quoteid]" style="{$collapseobj_forumid}">
<tr>
<td class="alt2" style="border:1px inset">
<if condition="$show['username']">
<div><phrase 1="$username">$vbphrase[originally_posted_by_x]</phrase></div>
<div style="font-style:italic">$message</div>
<else />
$message
</if>
</td>
</tr>
</tbody>

To this:


<tr>
<td id="collapseobj_quote_$show[quoteid]" style="{$collapseobj_forumid} border:1px inset" class="alt2" style="">
<if condition="$show['username']">
<div><phrase 1="$username">$vbphrase[originally_posted_by_x]</phrase></div>
<div style="font-style:italic">$message</div>
<else />
$message
</if>
</td>
</tr>


Getting rid of that tbody tag takes care of it.

Avalon111
02 Nov 2006, 14:44
anyone tried this great mod on vb3.6.2?