jaketrent/jquery-readmore — pull request #4 by OsakaWebbie (2013-04-02 13:15:56+00:00)
Title: New feature: reversion of expansion ("Read less"), plus a couple minor things

This is my first ever act on Github, so pardon me if I didn't do this correctly. (Feel free to instruct me in proper etiquette or procedures as necessary.)

After leaving a comment on http://rockycode.com/blog/jquery-plugin-readmore/ that included a wish for an added feature, I realized that the plugin is quite small and easy to understand, so I made the modification myself, and a couple other small things while I was at it. I don't know if you'll like these changes or not, but here they are for your review:
- added option (and corresponding code) to reverse the expansion ("Read less")
- added option for user to change animation time
- minor edit to allow multiple calls on same set of elements, so that dynamically added elements can still be covered

To keep the code simple, I used the same hyperlink for "Read more" and "Read less" - for that reason I needed the text inside the hyperlink separately accessible. Since you already have an option for the class name, it seemed redundant (and a bit dangerous - a user can cause it to stop working if they set more_link to something other than a hyperlink with the right class in it) to have an option with the whole markup, so I changed it to more_text (and less_text) and let the code construct the markup. I think that's safer. But I included code to check for the old option setting as well, for backward compatibility.

I don't have a minimize tool, so I only edited the full version of the file - I didn't touch the minimized one.

I also don't know the proper protocol for the comment area at the top of the file - I put today's date, added my name, and incremented the version number, but if that's not the right way to do it, just fix it. I don't even care if I get credit or not - I just figured I'm probably supposed to be noted for the sake of the "paper trail".