XF 2.3 Expanding Signatures on 2.3

We have some code we use to expand signatures when they are clicked. After we upgraded to 2.3 it no longer functions. From what I've read it's because of the removal of Jquery.

What would be a non-Jquery way of accomplishing the same thing?

Code:
<xf:js>       
    $('.message-signature').each(function () {
           var jSignature = $(this);
            jSignature.find('.bbCodeSpoiler button').click(function () {
        jSignature.css('max-height', 'none');
        });
    });
</xf:js>
 
Try this (untested):
JavaScript:
<xf:js>
document.querySelectorAll('.message-signature').forEach(function(jSignature) {
    var spoilerButton = jSignature.querySelector('.bbCodeSpoiler button');
    if (spoilerButton) {
        spoilerButton.addEventListener('click', function() {
            jSignature.style.maxHeight = 'none';
        });
    }
});
</xf:js>
 
I was attempting to view a backup of our 2.2 site to see how relevant this other code I found was in the functionality of what we had before I replied to you. Alas, our backups are not functioning for some reason. Maybe what specific code we had isn't as important as what we are now trying to do on 2.3.

The old functionality of our signature setup was if you clicked anywhere on the signature it would remove it's height limit thus expanding the signature. Clicking on the signature again would contract the signature reimposing the height limit established in Messages > Message Signature style property.

What the code you provided does is when clicking on a spoiler button inside the signature it expands it, but only works on the first spoiler button. Users with multiple spoiler buttons only the first button expands it. There is also no way to contract it again. Worst case scenario we can use this code and let our users know that if they want a large signature they need to put it in a parent spoiler.

If anyone has any ideas on how to accomplish what we had for 2.3 that would be awesome.
 
Back
Top Bottom