Log in

View Full Version : Collapsable Quotes


Hellcat
01-31-2006, 10:00 PM
As requested in this thread (https://vborg.vbsupport.ru/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
02-01-2006, 08:37 AM
Yahoooooooooooooooooooooooooooooooooooooooo

HellCat Rockzzzzzzzzzz

First POst :)

* Zia klicks install

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

Thanx Man...really thnx

AshokForums.com
02-01-2006, 08:40 AM
Installed

IrPr
02-01-2006, 08:56 AM
Nice Modification ;)
is it compatible with Backlink for Quotes (https://vborg.vbsupport.ru/showthread.php?t=91282) By Andreas ?


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

is this rite?

Snake
02-01-2006, 10:21 AM
This is great! Thanks...

Zia
02-01-2006, 11:49 AM
Nice Modification ;)
is it compatible with Backlink for Quotes (https://vborg.vbsupport.ru/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
02-01-2006, 01:14 PM
<font color="Green">click, Giz hits the install button</font>

Nice, very useful.

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

Gizmo999
02-01-2006, 02:04 PM
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
02-01-2006, 03:29 PM
/me applauds

Nice hack

Zia
02-01-2006, 03:49 PM
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
02-01-2006, 06:59 PM
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
02-01-2006, 07:10 PM
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-02-2006, 12:11 AM
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-02-2006, 01:22 AM
Love it Hellcat.
clicks Install.

Mudvayne
02-02-2006, 08:36 AM
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-02-2006, 09:07 AM
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-02-2006, 12:31 PM
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-02-2006, 04:11 PM
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-02-2006, 04:14 PM
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-02-2006, 05:55 PM
Thank you for explaining that better than I could.

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

Gizmo999
02-02-2006, 06:18 PM
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-02-2006, 06:26 PM
I might have an idea why this happens....
I'll look into this tonight and keep you posted!

Zia
02-02-2006, 06:39 PM
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-02-2006, 07:24 PM
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....

* Hellcat thinks

Zia
02-02-2006, 07:30 PM
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...
* Zia offers hellcat a chilled bear & a cigar...

Hellcat
02-02-2006, 11:40 PM
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
02-03-2006, 06:50 AM
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
02-03-2006, 06:58 AM
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
02-03-2006, 08:09 AM
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
02-03-2006, 08:23 AM
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
02-03-2006, 09:06 AM
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
02-03-2006, 04:50 PM
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
02-03-2006, 04:56 PM
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('d iv')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('d iv')[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
02-03-2006, 05:22 PM
Updated Today?

djwins
02-28-2006, 11:04 AM
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
03-02-2006, 12:39 AM
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
03-02-2006, 02:25 AM
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
03-02-2006, 04:14 AM
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 (https://vborg.vbsupport.ru/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
03-12-2006, 08:11 AM
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
05-08-2006, 10:57 PM
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
11-02-2006, 12:44 PM
anyone tried this great mod on vb3.6.2?