1. 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?

Discussion in 'Resource and Add-on Requests' started by glorify, Feb 22, 2011.

  1. glorify

    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...?
     
  2. Floris

    Floris Guest

    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 likes this.
  3. glorify

    glorify Well-Known Member

    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?
     
  4. Floris

    Floris Guest

    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.
     
  5. glorify

    glorify Well-Known Member

    OK. Thanks. I will try and report back :)
     
  6. glorify

    glorify Well-Known Member

    The sigs didn't show at all.
     
  7. FredC

    FredC Well-Known Member

    lol sounds like your half way there. :p
     
    Onimua, Vincent, Floris and 1 other person like this.
  8. glorify

    glorify Well-Known Member

    HaHa lol.
     
    Vincent likes this.
  9. high1976

    high1976 Active Member

    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'
     
  10. Robbo

    Robbo Well-Known Member

    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.
     
  11. glorify

    glorify Well-Known Member

    couldn't find anything--can you see if you can investigate more?
     

Share This Page