Add-on Hey calorie - Collapse Signatures?

glorify

Well-known member
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...?
 
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>
 
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?
 
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.
 
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.
 
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'
 
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.
 
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?
 
Bit of a blast of an old thread - But did you ever get this sorted? Looking for a way to toggle signatures.
 
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'

This worked a treat on 1.5 - Looking to upgrade to 2.1 - Would this still work?
 
No, anything written for XF1 will not work on XF2, it would have to be rewritten with the correct syntax and new code.

Ah thats a shame. This is the final piece of the jigsaw I need to find!
Thanks for the reply :)
 
Would any developer be willing to give me a quote to either design or mod, or just work out what the code would be so all signatures are hidden and show a link to show it - Like I have on 1.5?202113
 
Top Bottom