friendica/view/theme/frost-mobile/js/jquery.divgrow-1.3.1.f1.min.js

30 lines
2.3 KiB
JavaScript

/*
* Copyright (c) 2010 Simon Hibbard
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*//*
* Version: V1.3.1-f1
* Release: 22-12-2010
* Based on jQuery 1.4.2
*
* 2012-10-29: Modified by Zach Prezkuta to allow dynamic full heights
*/(function(e){var t=0;e.fn.divgrow=function(n){var n=e.extend({},{initialHeight:100,moreText:"+ Show More",lessText:"- Show Less",speed:1e3,showBrackets:!0},n);return this.each(function(){t++,obj=e(this),obj.css("height",n.initialHeight).css("overflow","hidden"),n.showBrackets?obj.after('<p class="divgrow-brackets">[&hellip;]</p><a href="#" class="divgrow-showmore divgrow-obj-'+t+'"'+"></a>"):obj.after('<a href="#" class="divgrow-showmore divgrow-obj-'+t+'"'+"></a>"),e("a.divgrow-showmore").html(n.moreText),e(".divgrow-obj-"+t).toggle(function(){var t=e(this).prevAll("div:first")[0].scrollHeight+10;e(this).prevAll("div:first").animate({height:t+"px"},n.speed,function(){n.showBrackets&&e(this).nextAll("p.divgrow-brackets:first").fadeOut(),e(this).nextAll("a.divgrow-showmore:first").html(n.lessText)})},function(){e(this).prevAll("div:first").stop(!0,!1).animate({height:n.initialHeight},n.speed,function(){n.showBrackets&&e(this).nextAll("p.divgrow-brackets:first").stop(!0,!1).fadeIn(),e(this).nextAll("a.divgrow-showmore:first").stop(!0,!1).html(n.moreText)})})})}})(jQuery);