Merge pull request #1157 from tugelbend/master

bug fix #1135, "show more" is usable again
This commit is contained in:
fabrixxm 2014-09-22 17:12:34 +02:00
commit c965792c07
10 changed files with 206 additions and 111 deletions

View file

@ -1,92 +0,0 @@
/*
* 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 ($) {
var divgrowid = 0;
$.fn.divgrow = function (options) {
var options = $.extend({}, { initialHeight: 100, moreText: "+ Show More", lessText: "- Show Less", speed: 1000, showBrackets: true }, options);
return this.each(function () {
divgrowid++;
obj = $(this);
//var fullHeight = obj.height() + 10;
obj.css('height', options.initialHeight).css('overflow', 'hidden');
if (options.showBrackets) {
obj.after('<p class="divgrow-brackets">[&hellip;]</p><a href="#" class="divgrow-showmore' + " divgrow-obj-" + divgrowid + '"' + '></a>');
}
else {
obj.after('<a href="#" class="divgrow-showmore' + " divgrow-obj-" + divgrowid + '"' + '></a>');
}
$("a.divgrow-showmore").html(options.moreText);
$("." + "divgrow-obj-" + divgrowid).toggle(function () {
//alert(obj.attr('class'));
// Set the height from the elements rel value
//var height = $(this).prevAll("div:first").attr('rel');
var fullHeight = $(this).prevAll("div:first")[0].scrollHeight + 10;
$(this).prevAll("div:first").animate({ height: fullHeight + "px" }, options.speed, function () { // Animation complete.
// Hide the overlay text when expanded, change the link text
if (options.showBrackets) {
$(this).nextAll("p.divgrow-brackets:first").fadeOut();
}
$(this).nextAll("a.divgrow-showmore:first").html(options.lessText);
});
}, function () {
$(this).prevAll("div:first").stop(true, false).animate({ height: options.initialHeight }, options.speed, function () { // Animation complete.
// show the overlay text while closed, change the link text
if (options.showBrackets) {
$(this).nextAll("p.divgrow-brackets:first").stop(true, false).fadeIn();
}
$(this).nextAll("a.divgrow-showmore:first").stop(true, false).html(options.moreText);
});
});
});
};
})(jQuery);

View file

@ -1 +0,0 @@
(function($){var divgrowid=0;$.fn.divgrow=function(options){var options=$.extend({},{initialHeight:100,moreText:"+ Show More",lessText:"- Show Less",speed:1e3,showBrackets:true},options);return this.each(function(){divgrowid++;obj=$(this);obj.css("height",options.initialHeight).css("overflow","hidden");if(options.showBrackets){obj.after('<p class="divgrow-brackets">[&hellip;]</p><a href="#" class="divgrow-showmore'+" divgrow-obj-"+divgrowid+'"'+"></a>")}else{obj.after('<a href="#" class="divgrow-showmore'+" divgrow-obj-"+divgrowid+'"'+"></a>")}$("a.divgrow-showmore").html(options.moreText);$("."+"divgrow-obj-"+divgrowid).toggle(function(){var fullHeight=$(this).prevAll("div:first")[0].scrollHeight+10;$(this).prevAll("div:first").animate({height:fullHeight+"px"},options.speed,function(){if(options.showBrackets){$(this).nextAll("p.divgrow-brackets:first").fadeOut()}$(this).nextAll("a.divgrow-showmore:first").html(options.lessText)})},function(){$(this).prevAll("div:first").stop(true,false).animate({height:options.initialHeight},options.speed,function(){if(options.showBrackets){$(this).nextAll("p.divgrow-brackets:first").stop(true,false).fadeIn()}$(this).nextAll("a.divgrow-showmore:first").stop(true,false).html(options.moreText)})})})}})(jQuery);

View file

@ -1 +0,0 @@
(function ($) { var divgrowid = 0; $.fn.divgrow = function (options) { var options = $.extend({}, { initialHeight: 100, moreText: "+ Show More", lessText: "- Show Less", speed: 1000, showBrackets: true }, options); return this.each(function () { divgrowid++; obj = $(this); var fullHeight = obj.height() + 10; obj.css('height', options.initialHeight).css('overflow', 'hidden'); if (options.showBrackets) { obj.after('<p class="divgrow-brackets">[&hellip;]</p><a href="#" class="divgrow-showmore' + " divgrow-obj-" + divgrowid + '"' + '></a>') } else { obj.after('<a href="#" class="divgrow-showmore' + " divgrow-obj-" + divgrowid + '"' + '></a>') } $("a.divgrow-showmore").html(options.moreText); $("." + "divgrow-obj-" + divgrowid).toggle(function () { $(this).prevAll("div:first").animate({ height: fullHeight + "px" }, options.speed, function () { if (options.showBrackets) { $(this).nextAll("p.divgrow-brackets:first").fadeOut() } $(this).nextAll("a.divgrow-showmore:first").html(options.lessText) }) }, function () { $(this).prevAll("div:first").stop(true, false).animate({ height: options.initialHeight }, options.speed, function () { if (options.showBrackets) { $(this).nextAll("p.divgrow-brackets:first").stop(true, false).fadeIn() } $(this).nextAll("a.divgrow-showmore:first").stop(true, false).html(options.moreText) }) }) }) } })(jQuery);

View file

@ -48,7 +48,7 @@
$(function() {
$.ajaxSetup({cache: false});
collapseHeight();
//collapseHeight();
/* setup tooltips *//*
$("a,.tt").each(function(){
@ -402,12 +402,10 @@
elemName = elems + ' ' + elemName;
}
$(elemName).each(function() {
if($(this).height() > 350) {
$('html').height($('html').height());
$(this).divgrow({ initialHeight: 300, showBrackets: false, speed: 0 });
$(this).addClass('divmore');
$('html').height('auto');
}
$('html').height($('html').height());
$(this).readmore({maxheight:350 , moreLink:'<a href="#" class="showmore">+ Show more</a>', lessLink:'<a href="#" class="showmore">+ Show less</a>'});
$(this).addClass('divmore');
$('html').height('auto');
});
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,192 @@
/*!
* Readmore.js jQuery plugin
* Author: @jed_foster
* Project home: jedfoster.github.io/Readmore.js
* Licensed under the MIT license
*/
;(function($) {
var readmore = 'readmore',
defaults = {
speed: 100,
maxHeight: 200,
heightMargin: 16,
moreLink: '<a href="#">Read More</a>',
lessLink: '<a href="#">Close</a>',
embedCSS: true,
sectionCSS: 'display: block; width: 100%;',
startOpen: false,
expandedClass: 'readmore-js-expanded',
collapsedClass: 'readmore-js-collapsed',
// callbacks
beforeToggle: function(){},
afterToggle: function(){}
},
cssEmbedded = false;
function Readmore( element, options ) {
this.element = element;
this.options = $.extend( {}, defaults, options);
$(this.element).data('max-height', this.options.maxHeight);
$(this.element).data('height-margin', this.options.heightMargin);
delete(this.options.maxHeight);
if(this.options.embedCSS && ! cssEmbedded) {
var styles = '.readmore-js-toggle, .readmore-js-section { ' + this.options.sectionCSS + ' } .readmore-js-section { overflow: hidden; }';
(function(d,u) {
var css=d.createElement('style');
css.type = 'text/css';
if(css.styleSheet) {
css.styleSheet.cssText = u;
}
else {
css.appendChild(d.createTextNode(u));
}
d.getElementsByTagName('head')[0].appendChild(css);
}(document, styles));
cssEmbedded = true;
}
this._defaults = defaults;
this._name = readmore;
this.init();
}
Readmore.prototype = {
init: function() {
var $this = this;
$(this.element).each(function() {
var current = $(this),
maxHeight = (current.css('max-height').replace(/[^-\d\.]/g, '') > current.data('max-height')) ? current.css('max-height').replace(/[^-\d\.]/g, '') : current.data('max-height'),
heightMargin = current.data('height-margin');
if(current.css('max-height') != 'none') {
current.css('max-height', 'none');
}
$this.setBoxHeight(current);
if(current.outerHeight(true) <= maxHeight + heightMargin) {
// The block is shorter than the limit, so there's no need to truncate it.
return true;
}
else {
current.addClass('readmore-js-section ' + $this.options.collapsedClass).data('collapsedHeight', maxHeight);
var useLink = $this.options.startOpen ? $this.options.lessLink : $this.options.moreLink;
current.after($(useLink).on('click', function(event) { $this.toggleSlider(this, current, event) }).addClass('readmore-js-toggle'));
if(!$this.options.startOpen) {
current.css({height: maxHeight});
}
}
});
$(window).on('resize', function(event) {
$this.resizeBoxes();
});
},
toggleSlider: function(trigger, element, event)
{
event.preventDefault();
var $this = this,
newHeight = newLink = sectionClass = '',
expanded = false,
collapsedHeight = $(element).data('collapsedHeight');
if ($(element).height() <= collapsedHeight) {
newHeight = $(element).data('expandedHeight') + 'px';
newLink = 'lessLink';
expanded = true;
sectionClass = $this.options.expandedClass;
}
else {
newHeight = collapsedHeight;
newLink = 'moreLink';
sectionClass = $this.options.collapsedClass;
}
// Fire beforeToggle callback
$this.options.beforeToggle(trigger, element, expanded);
$(element).animate({'height': newHeight}, {duration: $this.options.speed, complete: function() {
// Fire afterToggle callback
$this.options.afterToggle(trigger, element, expanded);
$(trigger).replaceWith($($this.options[newLink]).on('click', function(event) { $this.toggleSlider(this, element, event) }).addClass('readmore-js-toggle'));
$(this).removeClass($this.options.collapsedClass + ' ' + $this.options.expandedClass).addClass(sectionClass);
}
});
},
setBoxHeight: function(element) {
var el = element.clone().css({'height': 'auto', 'width': element.width(), 'overflow': 'hidden'}).insertAfter(element),
height = el.outerHeight(true);
el.remove();
element.data('expandedHeight', height);
},
resizeBoxes: function() {
var $this = this;
$('.readmore-js-section').each(function() {
var current = $(this);
$this.setBoxHeight(current);
if(current.height() > current.data('expandedHeight') || (current.hasClass($this.options.expandedClass) && current.height() < current.data('expandedHeight')) ) {
current.css('height', current.data('expandedHeight'));
}
});
},
destroy: function() {
var $this = this;
$(this.element).each(function() {
var current = $(this);
current.removeClass('readmore-js-section ' + $this.options.collapsedClass + ' ' + $this.options.expandedClass).css({'max-height': '', 'height': 'auto'}).next('.readmore-js-toggle').remove();
current.removeData();
});
}
};
$.fn[readmore] = function( options ) {
var args = arguments;
if (options === undefined || typeof options === 'object') {
return this.each(function () {
if ($.data(this, 'plugin_' + readmore)) {
var instance = $.data(this, 'plugin_' + readmore);
instance['destroy'].apply(instance);
}
$.data(this, 'plugin_' + readmore, new Readmore( this, options ));
});
} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
return this.each(function () {
var instance = $.data(this, 'plugin_' + readmore);
if (instance instanceof Readmore && typeof instance[options] === 'function') {
instance[options].apply( instance, Array.prototype.slice.call( args, 1 ) );
}
});
}
}
})(jQuery);

View file

@ -0,0 +1,7 @@
(function(c){function g(b,a){this.element=b;this.options=c.extend({},h,a);c(this.element).data("max-height",this.options.maxHeight);c(this.element).data("height-margin",this.options.heightMargin);delete this.options.maxHeight;if(this.options.embedCSS&&!k){var d=".readmore-js-toggle, .readmore-js-section { "+this.options.sectionCSS+" } .readmore-js-section { overflow: hidden; }",e=document.createElement("style");e.type="text/css";e.styleSheet?e.styleSheet.cssText=d:e.appendChild(document.createTextNode(d));
document.getElementsByTagName("head")[0].appendChild(e);k=!0}this._defaults=h;this._name=f;this.init()}var f="readmore",h={speed:100,maxHeight:200,heightMargin:16,moreLink:'<a href="#">Read More</a>',lessLink:'<a href="#">Close</a>',embedCSS:!0,sectionCSS:"display: block; width: 100%;",startOpen:!1,expandedClass:"readmore-js-expanded",collapsedClass:"readmore-js-collapsed",beforeToggle:function(){},afterToggle:function(){}},k=!1;g.prototype={init:function(){var b=this;c(this.element).each(function(){var a=
c(this),d=a.css("max-height").replace(/[^-\d\.]/g,"")>a.data("max-height")?a.css("max-height").replace(/[^-\d\.]/g,""):a.data("max-height"),e=a.data("height-margin");"none"!=a.css("max-height")&&a.css("max-height","none");b.setBoxHeight(a);if(a.outerHeight(!0)<=d+e)return!0;a.addClass("readmore-js-section "+b.options.collapsedClass).data("collapsedHeight",d);a.after(c(b.options.startOpen?b.options.lessLink:b.options.moreLink).on("click",function(c){b.toggleSlider(this,a,c)}).addClass("readmore-js-toggle"));
b.options.startOpen||a.css({height:d})});c(window).on("resize",function(a){b.resizeBoxes()})},toggleSlider:function(b,a,d){d.preventDefault();var e=this;d=newLink=sectionClass="";var f=!1;d=c(a).data("collapsedHeight");c(a).height()<=d?(d=c(a).data("expandedHeight")+"px",newLink="lessLink",f=!0,sectionClass=e.options.expandedClass):(newLink="moreLink",sectionClass=e.options.collapsedClass);e.options.beforeToggle(b,a,f);c(a).animate({height:d},{duration:e.options.speed,complete:function(){e.options.afterToggle(b,
a,f);c(b).replaceWith(c(e.options[newLink]).on("click",function(b){e.toggleSlider(this,a,b)}).addClass("readmore-js-toggle"));c(this).removeClass(e.options.collapsedClass+" "+e.options.expandedClass).addClass(sectionClass)}})},setBoxHeight:function(b){var a=b.clone().css({height:"auto",width:b.width(),overflow:"hidden"}).insertAfter(b),c=a.outerHeight(!0);a.remove();b.data("expandedHeight",c)},resizeBoxes:function(){var b=this;c(".readmore-js-section").each(function(){var a=c(this);b.setBoxHeight(a);
(a.height()>a.data("expandedHeight")||a.hasClass(b.options.expandedClass)&&a.height()<a.data("expandedHeight"))&&a.css("height",a.data("expandedHeight"))})},destroy:function(){var b=this;c(this.element).each(function(){var a=c(this);a.removeClass("readmore-js-section "+b.options.collapsedClass+" "+b.options.expandedClass).css({"max-height":"",height:"auto"}).next(".readmore-js-toggle").remove();a.removeData()})}};c.fn[f]=function(b){var a=arguments;if(void 0===b||"object"===typeof b)return this.each(function(){if(c.data(this,
"plugin_"+f)){var a=c.data(this,"plugin_"+f);a.destroy.apply(a)}c.data(this,"plugin_"+f,new g(this,b))});if("string"===typeof b&&"_"!==b[0]&&"init"!==b)return this.each(function(){var d=c.data(this,"plugin_"+f);d instanceof g&&"function"===typeof d[b]&&d[b].apply(d,Array.prototype.slice.call(a,1))})}})(jQuery);

File diff suppressed because one or more lines are too long

View file

@ -1468,7 +1468,7 @@ input#dfrn-url {
overflow: hidden;
}
.divgrow-showmore {
.showmore {
display: block;
clear: both;
text-align: center;

View file

@ -1,15 +1,9 @@
<!--[if IE]>
<script type="text/javascript" src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
{{*<!--<script type="text/javascript" src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce.js" ></script>
<script type="text/javascript">
tinyMCE.init({ mode : "none"});
</script>-->*}}
<script type="text/javascript" src="{{$baseurl}}/js/jquery.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/view/theme/frost-mobile/js/jquery.divgrow-1.3.1.f1.min.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/view/theme/frost-mobile/js/readmore.min.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/jquery.textinputs.js" ></script>
{{*<!--<script type="text/javascript" src="{{$baseurl}}/library/colorbox/jquery.colorbox-min.js"></script>-->*}}
{{*<!--<script type="text/javascript" src="{{$baseurl}}/library/tiptip/jquery.tipTip.minified.js"></script>-->*}}
<script type="text/javascript" src="{{$baseurl}}/library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="{{$baseurl}}/js/fk.autocomplete.js" ></script>