X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=view%2Ftheme%2Ffrost%2Fjs%2Fmain.js;h=91e79ffc383164f9619dd44e4e663fd8a0c7be49;hb=dbf8f711cffbc7b659a06856b2301820c66274ca;hp=d4741bc6ec9e9e3c89a6b170d8448a19346bec6c;hpb=04c31d194f07e3b7a39ab7c8d5690da840c11fb7;p=friendica.git diff --git a/view/theme/frost/js/main.js b/view/theme/frost/js/main.js index d4741bc6ec..91e79ffc38 100644 --- a/view/theme/frost/js/main.js +++ b/view/theme/frost/js/main.js @@ -1,20 +1,32 @@ - function openClose(theID) { - if(document.getElementById(theID).style.display == "block") { - document.getElementById(theID).style.display = "none" - } - else { - document.getElementById(theID).style.display = "block" - } - } + function openClose(listID) { +/* if(document.getElementById(theID).style.display == "block") { + document.getElementById(theID).style.display = "none" + } + else { + document.getElementById(theID).style.display = "block" + }*/ + listID = "#" + listID.replace(/:/g, "\\:"); + listID = listID.replace(/\./g, "\\."); + listID = listID.replace(/@/g, "\\@"); + + if($j(listID).is(":visible")) { + $j(listID).hide(); + $j(listID+"-wrapper").show(); + } + else { + $j(listID).show(); + $j(listID+"-wrapper").hide(); + } + } - function openMenu(theID) { - document.getElementById(theID).style.display = "block" - } + function openMenu(theID) { + document.getElementById(theID).style.display = "block" + } - function closeMenu(theID) { - document.getElementById(theID).style.display = "none" - } + function closeMenu(theID) { + document.getElementById(theID).style.display = "none" + } @@ -38,6 +50,8 @@ msie = $j.browser.msie ; + collapseHeight(); + /* setup tooltips *//* $j("a,.tt").each(function(){ var e = $j(this); @@ -165,6 +179,12 @@ 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){ + // Replace data-src attribute with src attribute for every image + $(el).attr('src', $(el).data("src")); + $(el).removeAttr("data-src"); + }); } notif = eNotif.attr('count'); if (notif>0){ @@ -178,11 +198,11 @@ var eSysmsg = $j(data).find('sysmsgs'); eSysmsg.children("notice").each(function(){ text = $j(this).text(); - $j.jGrowl(text, { sticky: false, theme: 'notice', life: 2000 }); // originally: sticky: true, + $j.jGrowl(text, { sticky: false, theme: 'notice', life: 3000 }); // originally: sticky: true, }); eSysmsg.children("info").each(function(){ text = $j(this).text(); - $j.jGrowl(text, { sticky: false, theme: 'info', life: 1500 }); + $j.jGrowl(text, { sticky: false, theme: 'info', life: 1000 }); }); }); @@ -236,12 +256,13 @@ if($j('#live-profile').length) { src = 'profile'; liveUpdate(); } if($j('#live-community').length) { src = 'community'; liveUpdate(); } if($j('#live-notes').length) { src = 'notes'; liveUpdate(); } - if($j('#live-display').length) { + if($j('#live-display').length) { src = 'display'; liveUpdate(); } + /*if($j('#live-display').length) { if(liking) { liking = 0; window.location.href=window.location.href } - } + }*/ if($j('#live-photos').length) { if(liking) { liking = 0; @@ -290,7 +311,7 @@ // add a new thread - $j('.tread-wrapper',data).each(function() { + $j('.toplevel_item',data).each(function() { var ident = $j(this).attr('id'); if($j('#' + ident).length == 0 && profile_page == 1) { @@ -300,10 +321,26 @@ $j('#' + prev).after($j(this)); } else { + // Find out if the hidden comments are open, so we can keep it that way + // if a new comment has been posted + var id = $j('.hide-comments-total', this).attr('id'); + if(typeof id != 'undefined') { + id = id.split('-')[3]; + var commentsOpen = $j("#collapsed-comments-" + id).is(":visible"); + } + $j('img',this).each(function() { $j(this).attr('src',$j(this).attr('dst')); }); + //vScroll = $j(document).scrollTop(); + $j('html').height($j('html').height()); $j('#' + ident).replaceWith($j(this)); + + if(typeof id != 'undefined') { + if(commentsOpen) showHideComments(id); + } + $j('html').height('auto'); + //$j(document).scrollTop(vScroll); } prev = ident; }); @@ -342,6 +379,24 @@ } /* autocomplete @nicknames */ $j(".comment-edit-form textarea").contact_autocomplete(baseurl+"/acl"); + + collapseHeight(); + + }); + } + + function collapseHeight(elems) { + var elemName = '.wall-item-body:not(.divmore)'; + if(typeof elems != 'undefined') { + elemName = elems + ' ' + elemName; + } + $j(elemName).each(function() { + if($j(this).height() > 450) { + $j('html').height($j('html').height()); + $j(this).divgrow({ initialHeight: 400, showBrackets: false, speed: 0 }); + $j(this).addClass('divmore'); + $j('html').height('auto'); + } }); } @@ -483,6 +538,18 @@ } + function showHideComments(id) { + if( $j("#collapsed-comments-" + id).is(":visible")) { + $j("#collapsed-comments-" + id).hide(); + $j("#hide-comments-" + id).html(window.showMore); + } + else { + $j("#collapsed-comments-" + id).show(); + $j("#hide-comments-" + id).html(window.showFewer); + collapseHeight("#collapsed-comments-" + id); + } + } + function preview_post() { $j("#jot-preview").val("1");