• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Add-on Hey calorie - Collapse Signatures?

glorify

Well-known member
#1
calorie, I used your mod here to collapse sigs i my old vb forum and it is one of my members most requested add ons that have been lost since software switch.

Any chance...?
 
F

Floris

Guest
#2
XenForo uses jQuery now, it shouldn't be too hard to tell it with js+cookie to collapse auto, or the other way around, until clicked, and update cookie if it needs to be remembered.

.toggleClass() api can be used perhaps; http://api.jquery.com/toggleClass/

Code:
/* add to extra.css, rename appropriately */
  .signature { display: inline; }
  .sigToggle { display: none; }
/* .. */

/* .. whatever the signature code is, class="baseHtml signature ugc sigToggle", rename accordingly .. */
  <div class="baseHtml signature ugc sigToggle">... my $signature .. (click to hide)</div>
<script>
/* if xenforo uses div or span replace p with div or span
   i think it is: <div class="baseHtml signature ugc"> */
    $("div").click(function () {
      $(this).toggleClass("sigToggle");
    });
</script>
 

glorify

Well-known member
#3
XenForo uses jQuery now, it shouldn't be too hard to tell it with js+cookie to collapse auto, or the other way around, until clicked, and update cookie if it needs to be remembered.

.toggleClass() api can be used perhaps; http://api.jquery.com/toggleClass/

Code:
/* add to extra.css, rename appropriately */
  .signature { display: inline; }
  .sigToggle { display: none; }
/* .. */

/* .. whatever the signature code is, class="baseHtml signature ugc sigToggle", rename accordingly .. */
  <div class="baseHtml signature ugc sigToggle">... my $signature .. (click to hide)</div>
<script>
/* if xenforo uses div or span replace p with div or span
   i think it is: <div class="baseHtml signature ugc"> */
    $("div").click(function () {
      $(this).toggleClass("sigToggle");
    });
</script>
Wow Floris, I truly appreciate that.

I would assume in extra.css I would add
Code:
  .signature { display: inline; }
  .sigToggle { display: none; }
and in the Message template, I would find:
Code:
        <xen:if is="{$visitor.content_show_signature} && {$message.signature}">
            <div class="baseHtml signature ugc"><aside>{xen:raw $message.signatureHtml}</aside></div>
        </xen:if>
and replace it with:
Code:
        <xen:if is="{$visitor.content_show_signature} && {$message.signature}">
            <div class="baseHtml signature ugc sigToggle"><aside>{xen:raw $message.signatureHtml}</aside></div>
            <script>
                 $("div").click(function () {
                  $(this).toggleClass("sigToggle");
                 });
            </script>
        </xen:if>
Yeay or Nay?
 
F

Floris

Guest
#4
It sounds like we are on the right path. I have not tested it, nor do I know this is the right approach.
But yeah, it is worth a test. I am sure Miko or Erik or others with more jQuery experience (with xenforo) than me know if this is going right or wrong.

The javascript probably should be in a header somewhere, or at least just once on the page, not for every signature. script only needs to be loaded once. perhaps put it in the footer or something.
 

glorify

Well-known member
#6
It sounds like we are on the right path. I have not tested it, nor do I know this is the right approach.
But yeah, it is worth a test. I am sure Miko or Erik or others with more jQuery experience (with xenforo) than me know if this is going right or wrong.

The javascript probably should be in a header somewhere, or at least just once on the page, not for every signature. script only needs to be loaded once. perhaps put it in the footer or something.
The sigs didn't show at all.
 

high1976

Active member
#9
maybe someone can use it, it's a simple toggle to show/hide sigs on post base.
find template: message:
Code:
        <xen:if is="{$visitor.content_show_signature} && {$message.signature}">
            <div class="baseHtml signature ugc{xen:if $message.isIgnored, ' ignored'}"><aside>{xen:raw $message.signatureHtml}</aside></div>
        </xen:if>
and replace it with:
Code:
 <xen:if is="{$visitor.content_show_signature} && {$message.signature}">
<dl class="signature">
<dt>
<a onclick="jQuery(this).parents('.signature').find('.showsig').toggle('slow'); return false;" href="#">{xen:phrase showhidesig}</a>
</dt>
<dd>
<div class="showsig baseHtml ugc{xen:if $message.isIgnored, ' ignored'}" style="display: none; padding: 5px;"><aside>{xen:raw $message.signatureHtml}</aside></div>
</dd>
</dl> 
</xen:if>
finally create a phrase for 'showhidesig'
 

Robbo

Well-known member
#10
The proper way to do this would be much simpler than described here. XenForo extends jQuery animation classes and you can use them to make the same effect as when you drop down the thread display options. Look at the code for them and duplicate for your needs... if you can't I'll write up some stuff to help when I have a chance.
 

glorify

Well-known member
#11
The proper way to do this would be much simpler than described here. XenForo extends jQuery animation classes and you can use them to make the same effect as when you drop down the thread display options. Look at the code for them and duplicate for your needs... if you can't I'll write up some stuff to help when I have a chance.
couldn't find anything--can you see if you can investigate more?