From 27435147912f048665f1877d3f4e8b34cfdbf435 Mon Sep 17 00:00:00 2001 From: hauke Date: Mon, 22 Sep 2014 13:53:16 +0200 Subject: [PATCH] bug fix #1135, show more is usable again --- .../js/jquery.divgrow-1.3.1.f1.js | 92 --------- .../js/jquery.divgrow-1.3.1.f1.min.js | 1 - .../js/jquery.divgrow-1.3.1.min.js | 1 - view/theme/frost-mobile/js/main.js | 12 +- view/theme/frost-mobile/js/main.min.js | 1 - view/theme/frost-mobile/js/readmore.js | 192 ++++++++++++++++++ view/theme/frost-mobile/js/readmore.min.js | 7 + view/theme/frost-mobile/js/theme.min.js | 1 - view/theme/frost-mobile/style.css | 2 +- view/theme/frost-mobile/templates/end.tpl | 8 +- 10 files changed, 206 insertions(+), 111 deletions(-) delete mode 100644 view/theme/frost-mobile/js/jquery.divgrow-1.3.1.f1.js delete mode 100644 view/theme/frost-mobile/js/jquery.divgrow-1.3.1.f1.min.js delete mode 100644 view/theme/frost-mobile/js/jquery.divgrow-1.3.1.min.js delete mode 100644 view/theme/frost-mobile/js/main.min.js create mode 100644 view/theme/frost-mobile/js/readmore.js create mode 100644 view/theme/frost-mobile/js/readmore.min.js delete mode 100644 view/theme/frost-mobile/js/theme.min.js diff --git a/view/theme/frost-mobile/js/jquery.divgrow-1.3.1.f1.js b/view/theme/frost-mobile/js/jquery.divgrow-1.3.1.f1.js deleted file mode 100644 index e57722d1b6..0000000000 --- a/view/theme/frost-mobile/js/jquery.divgrow-1.3.1.f1.js +++ /dev/null @@ -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('

[…]

'); - } - else { - obj.after(''); - } - $("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); - - - - - diff --git a/view/theme/frost-mobile/js/jquery.divgrow-1.3.1.f1.min.js b/view/theme/frost-mobile/js/jquery.divgrow-1.3.1.f1.min.js deleted file mode 100644 index da7634ac97..0000000000 --- a/view/theme/frost-mobile/js/jquery.divgrow-1.3.1.f1.min.js +++ /dev/null @@ -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('

[…]

")}else{obj.after('")}$("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); \ No newline at end of file diff --git a/view/theme/frost-mobile/js/jquery.divgrow-1.3.1.min.js b/view/theme/frost-mobile/js/jquery.divgrow-1.3.1.min.js deleted file mode 100644 index fd08f7fa86..0000000000 --- a/view/theme/frost-mobile/js/jquery.divgrow-1.3.1.min.js +++ /dev/null @@ -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('

[…]

') } else { obj.after('') } $("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); \ No newline at end of file diff --git a/view/theme/frost-mobile/js/main.js b/view/theme/frost-mobile/js/main.js index 1b63a489d6..07d0c52b36 100644 --- a/view/theme/frost-mobile/js/main.js +++ b/view/theme/frost-mobile/js/main.js @@ -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:'+ Show more', lessLink:'+ Show less'}); + $(this).addClass('divmore'); + $('html').height('auto'); }); } diff --git a/view/theme/frost-mobile/js/main.min.js b/view/theme/frost-mobile/js/main.min.js deleted file mode 100644 index eaf8a082d7..0000000000 --- a/view/theme/frost-mobile/js/main.min.js +++ /dev/null @@ -1 +0,0 @@ -function openClose(listID){listID="#"+listID.replace(/:/g,"\\:");listID=listID.replace(/\./g,"\\.");listID=listID.replace(/@/g,"\\@");if($(listID).is(":visible")){$(listID).hide();$(listID+"-wrapper").show();alert($(listID+"-wrapper").attr("id"))}else{$(listID).show();$(listID+"-wrapper").hide()}}function openMenu(theID){document.getElementById(theID).style.display="block"}function closeMenu(theID){document.getElementById(theID).style.display="none"}var src=null;var prev=null;var livetime=null;var msie=false;var stopped=false;var totStopped=false;var timer=null;var pr=0;var liking=0;var in_progress=false;var langSelect=false;var commentBusy=false;var last_popup_menu=null;var last_popup_button=null;$(function(){$.ajaxSetup({cache:false});msie=$.browser.msie;collapseHeight();$(".onoff input").each(function(){val=$(this).val();id=$(this).attr("id");$("#"+id+"_onoff ."+(val==0?"on":"off")).addClass("hidden")});$(".onoff > a").click(function(event){event.preventDefault();var input=$(this).siblings("input");var val=1-input.val();var id=input.attr("id");$("#"+id+"_onoff ."+(val==0?"on":"off")).addClass("hidden");$("#"+id+"_onoff ."+(val==1?"on":"off")).removeClass("hidden");input.val(val)});function close_last_popup_menu(e){if(last_popup_menu){if("#"+last_popup_menu.attr("id")!==$(e.target).attr("rel")){last_popup_menu.hide();if(last_popup_menu.attr("id")=="nav-notifications-menu")$(".main-container").show();last_popup_button.removeClass("selected");last_popup_menu=null;last_popup_button=null}}}$("img[rel^=#]").click(function(e){close_last_popup_menu(e);menu=$($(this).attr("rel"));e.preventDefault();e.stopPropagation();if(menu.attr("popup")=="false")return false;if(menu.css("display")=="none"){$(this).parent().addClass("selected");menu.show();if(menu.attr("id")=="nav-notifications-menu")$(".main-container").hide();last_popup_menu=menu;last_popup_button=$(this).parent()}else{$(this).parent().removeClass("selected");menu.hide();if(menu.attr("id")=="nav-notifications-menu")$(".main-container").show();last_popup_menu=null;last_popup_button=null}return false});$("html").click(function(e){close_last_popup_menu(e)});var notifications_tpl=unescape($("#nav-notifications-template[rel=template]").html());var notifications_all=unescape($("
").append($("#nav-notifications-see-all").clone()).html());var notifications_mark=unescape($("
").append($("#nav-notifications-mark-all").clone()).html());var notifications_empty=unescape($("#nav-notifications-menu").html());$("nav").bind("nav-update",function(e,data){var invalid=$(data).find("invalid").text();if(invalid==1){window.location.href=window.location.href}var net=$(data).find("net").text();if(net==0){net="";$("#net-update").removeClass("show")}else{$("#net-update").addClass("show")}$("#net-update").html(net);var home=$(data).find("home").text();if(home==0){home="";$("#home-update").removeClass("show")}else{$("#home-update").addClass("show")}$("#home-update").html(home);var intro=$(data).find("intro").text();if(intro==0){intro="";$("#intro-update").removeClass("show")}else{$("#intro-update").addClass("show")}$("#intro-update").html(intro);var mail=$(data).find("mail").text();if(mail==0){mail="";$("#mail-update").removeClass("show")}else{$("#mail-update").addClass("show")}$("#mail-update").html(mail);var intro=$(data).find("intro").text();if(intro==0){intro="";$("#intro-update-li").removeClass("show")}else{$("#intro-update-li").addClass("show")}$("#intro-update-li").html(intro);var mail=$(data).find("mail").text();if(mail==0){mail="";$("#mail-update-li").removeClass("show")}else{$("#mail-update-li").addClass("show")}$("#mail-update-li").html(mail);var eNotif=$(data).find("notif");if(eNotif.children("note").length==0){$("#nav-notifications-menu").html(notifications_empty)}else{nnm=$("#nav-notifications-menu");nnm.html(notifications_all+notifications_mark);eNotif.children("note").each(function(){e=$(this);text=e.text().format(""+e.attr("name")+"");html=notifications_tpl.format(e.attr("href"),e.attr("photo"),text,e.attr("date"),e.attr("seen"));nnm.append(html)});$("img[data-src]",nnm).each(function(i,el){if($(el).data("src")!="")$(el).attr("src",$(el).data("src"))})}notif=eNotif.attr("count");if(notif>0){$("#nav-notifications-linkmenu").addClass("on")}else{$("#nav-notifications-linkmenu").removeClass("on")}if(notif==0){notif="";$("#notify-update").removeClass("show")}else{$("#notify-update").addClass("show")}$("#notify-update").html(notif);var eSysmsg=$(data).find("sysmsgs");eSysmsg.children("notice").each(function(){text=$(this).text();$.jGrowl(text,{sticky:false,theme:"notice",life:1e3})});eSysmsg.children("info").each(function(){text=$(this).text();$.jGrowl(text,{sticky:false,theme:"info",life:1e3})})});NavUpdate()});function NavUpdate(){if(!stopped){var pingCmd="ping"+(localUser!=0?"?f=&uid="+localUser:"");$.get(pingCmd,function(data){$(data).find("result").each(function(){$("nav").trigger("nav-update",this);if($("#live-network").length){src="network";liveUpdate()}if($("#live-profile").length){src="profile";liveUpdate()}if($("#live-community").length){src="community";liveUpdate()}if($("#live-notes").length){src="notes";liveUpdate()}if($("#live-display").length){src="display";liveUpdate()}if($("#live-photos").length){if(liking){liking=0;window.location.href=window.location.href}}})})}timer=setTimeout(NavUpdate,updateInterval)}function liveUpdate(){if(src==null||stopped||typeof profile_uid=="undefined"||!profile_uid){$(".like-rotator").hide();return}if($(".comment-edit-text-full").length||in_progress){if(livetime){clearTimeout(livetime)}livetime=setTimeout(liveUpdate,1e4);return}if(livetime!=null)livetime=null;prev="live-"+src;in_progress=true;var udargs=netargs.length?"/"+netargs:"";var update_url="update_"+src+udargs+"&p="+profile_uid+"&page="+profile_page+"&msie="+(msie?1:0);$.get(update_url,function(data){in_progress=false;$(".toplevel_item",data).each(function(){var ident=$(this).attr("id");if($("#"+ident).length==0&&profile_page==1){$("img",this).each(function(){$(this).attr("src",$(this).attr("dst"))});$("#"+prev).after($(this))}else{var id=$(".hide-comments-total",this).attr("id");if(typeof id!="undefined"){id=id.split("-")[3];var commentsOpen=$("#collapsed-comments-"+id).is(":visible")}$("img",this).each(function(){$(this).attr("src",$(this).attr("dst"))});$("html").height($("html").height());$("#"+ident).replaceWith($(this));if(typeof id!="undefined"){if(commentsOpen)showHideComments(id)}$("html").height("auto")}prev=ident});collapseHeight();$(".like-rotator").hide();if(commentBusy){commentBusy=false;$("body").css("cursor","auto")}$(".comment-edit-form textarea").contact_autocomplete(baseurl+"/acl");if(typeof videojs!="undefined")videojs.autoSetup()})}function collapseHeight(elems){var elemName=".wall-item-body:not(.divmore)";if(typeof elems!="undefined"){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")}})}function dolike(ident,verb){unpause();$("#like-rotator-"+ident.toString()).show();$.get("like/"+ident.toString()+"?verb="+verb,NavUpdate);liking=1}function dostar(ident){ident=ident.toString();$.get("starred/"+ident,function(data){if(data.match(/1/)){$("#starred-"+ident).addClass("starred");$("#starred-"+ident).removeClass("unstarred");$("#star-"+ident).addClass("hidden");$("#unstar-"+ident).removeClass("hidden")}else{$("#starred-"+ident).addClass("unstarred");$("#starred-"+ident).removeClass("starred");$("#star-"+ident).removeClass("hidden");$("#unstar-"+ident).addClass("hidden")}})}function getPosition(e){var cursor={x:0,y:0};if(e.pageX||e.pageY){cursor.x=e.pageX;cursor.y=e.pageY}else{if(e.clientX||e.clientY){cursor.x=e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)-document.documentElement.clientLeft;cursor.y=e.clientY+(document.documentElement.scrollTop||document.body.scrollTop)-document.documentElement.clientTop}else{if(e.x||e.y){cursor.x=e.x;cursor.y=e.y}}}return cursor}var lockvisible=false;function lockview(event,id){event=event||window.event;cursor=getPosition(event);if(lockvisible){lockviewhide()}else{lockvisible=true;$.get("lockview/"+id,function(data){$("#panel").html(data);$("#panel").css({left:10,top:cursor.y+20});$("#panel").show()})}}function lockviewhide(){lockvisible=false;$("#panel").hide()}function post_comment(id){unpause();commentBusy=true;$("body").css("cursor","wait");$("#comment-preview-inp-"+id).val("0");$.post("item",$("#comment-edit-form-"+id).serialize(),function(data){if(data.success){$("#comment-edit-wrapper-"+id).hide();$("#comment-edit-text-"+id).val("");var tarea=document.getElementById("comment-edit-text-"+id);if(tarea)commentClose(tarea,id);if(timer)clearTimeout(timer);timer=setTimeout(NavUpdate,10)}if(data.reload){window.location.href=data.reload}},"json");return false}function preview_comment(id){$("#comment-preview-inp-"+id).val("1");$("#comment-edit-preview-"+id).show();$.post("item",$("#comment-edit-form-"+id).serialize(),function(data){if(data.preview){$("#comment-edit-preview-"+id).html(data.preview);$("#comment-edit-preview-"+id+" a").click(function(){return false})}},"json");return true}function showHideComments(id){if($("#collapsed-comments-"+id).is(":visible")){$("#collapsed-comments-"+id).hide();$("#hide-comments-"+id).html(window.showMore)}else{$("#collapsed-comments-"+id).show();$("#hide-comments-"+id).html(window.showFewer);collapseHeight("#collapsed-comments-"+id)}}function preview_post(){$("#jot-preview").val("1");$("#jot-preview-content").show();tinyMCE.triggerSave();$.post("item",$("#profile-jot-form").serialize(),function(data){if(data.preview){$("#jot-preview-content").html(data.preview);$("#jot-preview-content"+" a").click(function(){return false})}},"json");$("#jot-preview").val("0");return true}function unpause(){totStopped=false;stopped=false;$("#pause").html("")}function bin2hex(s){var v,i,f=0,a=[];s+="";f=s.length;for(i=0;i'+data.desc+'
'+data.version+'
'+data.credits+"
")})} \ No newline at end of file diff --git a/view/theme/frost-mobile/js/readmore.js b/view/theme/frost-mobile/js/readmore.js new file mode 100644 index 0000000000..4a02cf1ddb --- /dev/null +++ b/view/theme/frost-mobile/js/readmore.js @@ -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: 'Read More', + lessLink: 'Close', + 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); \ No newline at end of file diff --git a/view/theme/frost-mobile/js/readmore.min.js b/view/theme/frost-mobile/js/readmore.min.js new file mode 100644 index 0000000000..ae0ee637fb --- /dev/null +++ b/view/theme/frost-mobile/js/readmore.min.js @@ -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:'Read More',lessLink:'Close',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(){1} : {2}".format(event.item["author-avatar"],event.item["author-name"],event.title));break;case"agendaWeek":element.find(".fc-event-title").html("{1}

{2}

{3}

".format(event.item["author-avatar"],event.item["author-name"],event.item.desc,event.item.location));break;case"agendaDay":element.find(".fc-event-title").html("{1}

{2}

{3}

".format(event.item["author-avatar"],event.item["author-name"],event.item.desc,event.item.location));break}}});var args=location.href.replace(baseurl,"").split("/");if(args.length>=4){$("#events-calendar").fullCalendar("gotoDate",args[2],args[3]-1)}var hash=location.hash.split("-");if(hash.length==2&&hash[0]=="#link")showEvent(hash[1])}});$(function(){$("nav").bind("nav-update",function(e,data){var elm=$("#pending-update");var register=$(data).find("register").text();if(register=="0"){register="";elm.hide()}else{elm.show()}elm.html(register)})});function homeRedirect(){$("html").fadeOut("slow",function(){window.location=baseurl+"/login"})}function initCrop(){function onEndCrop(coords,dimensions){$PR("x1").value=coords.x1;$PR("y1").value=coords.y1;$PR("x2").value=coords.x2;$PR("y2").value=coords.y2;$PR("width").value=dimensions.width;$PR("height").value=dimensions.height}Event.observe(window,"load",function(){new Cropper.ImgWithPreview("croppa",{previewWrap:"previewWrap",minWidth:175,minHeight:175,maxWidth:640,maxHeight:640,ratioDim:{x:100,y:100},displayOnInit:true,onEndCrop:onEndCrop})})}function showEvent(eventid){}var editor=false;var textlen=0;var plaintext="none";function initEditor(cb){if(editor==false){if(plaintext=="none"){$("#profile-jot-text").css({height:200,color:"#000"});$("#profile-jot-text").contact_autocomplete(baseurl+"/acl");editor=true;$("a#jot-perms-icon, a#settings-default-perms-menu").click(function(){var parent=$("#profile-jot-acl-wrapper").parent();if(parent.css("display")=="none"){parent.show()}else{parent.hide()}return false});$(".jothidden").show();if(typeof cb!="undefined")cb();return}}else{if(typeof cb!="undefined")cb()}}function enableOnUser(){if(editor)return;$(this).val("");initEditor()}function addeditortext(textElem,data){if(window.editSelect=="none"){var currentText=$(textElem).val();$(textElem).val(currentText+data)}}function jotVideoURL(){reply=prompt(window.vidURL);if(reply&&reply.length){addeditortext("#profile-jot-text","[video]"+reply+"[/video]")}}function jotAudioURL(){reply=prompt(window.audURL);if(reply&&reply.length){addeditortext("#profile-jot-text","[audio]"+reply+"[/audio]")}}function jotGetLocation(){reply=prompt(window.whereAreU,$("#jot-location").val());if(reply&&reply.length){$("#jot-location").val(reply)}}function jotShare(id){if($("#jot-popup").length!=0)$("#jot-popup").show();$("#like-rotator-"+id).show();$.get("share/"+id,function(data){if(!editor)$("#profile-jot-text").val("");initEditor(function(){addeditortext("#profile-jot-text",data);$("#like-rotator-"+id).hide();$(window).scrollTop(0)})})}function jotGetLink(){reply=prompt(window.linkURL);if(reply&&reply.length){reply=bin2hex(reply);$("#profile-rotator").show();$.get("parse_url?binurl="+reply,function(data){addeditortext(window.jotId,data);$("#profile-rotator").hide()})}}function jotClearLocation(){$("#jot-coord").val("");$("#profile-nolocation-wrapper").hide()}if(typeof window.geoTag==="function")window.geoTag();function confirmDelete(){return confirm(window.delItem)}function itemTag(id){reply=prompt(window.term);if(reply&&reply.length){reply=reply.replace("#","");if(reply.length){commentBusy=true;$("body").css("cursor","wait");$.get("tagger/"+id+"?term="+reply,NavUpdate);liking=1}}}function itemFiler(id){$.get("filer/",function(data){var promptText=$("#id_term_label",data).text();reply=prompt(promptText);if(reply&&reply.length){commentBusy=true;$("body").css("cursor","wait");$.get("filer/"+id+"?term="+reply,NavUpdate);liking=1}})}function commentOpen(obj,id){if(obj.value==window.commentEmptyText){obj.value="";$("#comment-edit-text-"+id).addClass("comment-edit-text-full");$("#comment-edit-text-"+id).removeClass("comment-edit-text-empty");$("#mod-cmnt-wrap-"+id).show();openMenu("comment-edit-submit-wrapper-"+id)}}function commentClose(obj,id){if(obj.value==""){obj.value=window.commentEmptyText;$("#comment-edit-text-"+id).removeClass("comment-edit-text-full");$("#comment-edit-text-"+id).addClass("comment-edit-text-empty");$("#mod-cmnt-wrap-"+id).hide();closeMenu("comment-edit-submit-wrapper-"+id)}}function commentInsert(obj,id){var tmpStr=$("#comment-edit-text-"+id).val();if(tmpStr==window.commentEmptyText){tmpStr="";$("#comment-edit-text-"+id).addClass("comment-edit-text-full");$("#comment-edit-text-"+id).removeClass("comment-edit-text-empty");openMenu("comment-edit-submit-wrapper-"+id)}var ins=$(obj).html();ins=ins.replace("<","<");ins=ins.replace(">",">");ins=ins.replace("&","&");ins=ins.replace(""",'"');$("#comment-edit-text-"+id).val(tmpStr+ins)}function qCommentInsert(obj,id){var tmpStr=$("#comment-edit-text-"+id).val();if(tmpStr==window.commentEmptyText){tmpStr="";$("#comment-edit-text-"+id).addClass("comment-edit-text-full");$("#comment-edit-text-"+id).removeClass("comment-edit-text-empty");openMenu("comment-edit-submit-wrapper-"+id)}var ins=$(obj).val();ins=ins.replace("<","<");ins=ins.replace(">",">");ins=ins.replace("&","&");ins=ins.replace(""",'"');$("#comment-edit-text-"+id).val(tmpStr+ins);$(obj).val("")}function insertFormatting(comment,BBcode,id){var tmpStr=$("#comment-edit-text-"+id).val();if(tmpStr==comment){tmpStr="";$("#comment-edit-text-"+id).addClass("comment-edit-text-full");$("#comment-edit-text-"+id).removeClass("comment-edit-text-empty");openMenu("comment-edit-submit-wrapper-"+id);$("#comment-edit-text-"+id).val(tmpStr)}textarea=document.getElementById("comment-edit-text-"+id);if(document.selection){textarea.focus();selected=document.selection.createRange();if(BBcode=="url"){selected.text="["+BBcode+"=http://]"+selected.text+"[/"+BBcode+"]"}else selected.text="["+BBcode+"]"+selected.text+"[/"+BBcode+"]"}else if(textarea.selectionStart||textarea.selectionStart=="0"){var start=textarea.selectionStart;var end=textarea.selectionEnd;if(BBcode=="url"){textarea.value=textarea.value.substring(0,start)+"["+BBcode+"=http://]"+textarea.value.substring(start,end)+"[/"+BBcode+"]"+textarea.value.substring(end,textarea.value.length)}else textarea.value=textarea.value.substring(0,start)+"["+BBcode+"]"+textarea.value.substring(start,end)+"[/"+BBcode+"]"+textarea.value.substring(end,textarea.value.length)}return true}function cmtBbOpen(id){$(".comment-edit-bb-"+id).show()}function cmtBbClose(id){$(".comment-edit-bb-"+id).hide()} \ No newline at end of file diff --git a/view/theme/frost-mobile/style.css b/view/theme/frost-mobile/style.css index 1621ef5059..dc90c76236 100644 --- a/view/theme/frost-mobile/style.css +++ b/view/theme/frost-mobile/style.css @@ -1468,7 +1468,7 @@ input#dfrn-url { overflow: hidden; } -.divgrow-showmore { +.showmore { display: block; clear: both; text-align: center; diff --git a/view/theme/frost-mobile/templates/end.tpl b/view/theme/frost-mobile/templates/end.tpl index 331f8b5c20..38cd144b4c 100644 --- a/view/theme/frost-mobile/templates/end.tpl +++ b/view/theme/frost-mobile/templates/end.tpl @@ -1,15 +1,9 @@ -{{**}} - + -{{**}} -{{**}} -- 2.39.5