diff options
author | mrjive <mrjive@mrjive.it> | 2016-02-01 11:25:07 +0100 |
---|---|---|
committer | mrjive <mrjive@mrjive.it> | 2016-02-01 11:25:07 +0100 |
commit | 337735094b944fd31ed96e36c869227a0d63e5d1 (patch) | |
tree | 763577a8373b26426dc131c58f6a7f8c9c9213bf /view/js/main.js | |
parent | 28943af494eae225b256b9771a5699a1b05d7a2f (diff) | |
parent | 01b5b1347521951ca78b1718b03c45897800bf5e (diff) | |
download | volse-hubzilla-337735094b944fd31ed96e36c869227a0d63e5d1.tar.gz volse-hubzilla-337735094b944fd31ed96e36c869227a0d63e5d1.tar.bz2 volse-hubzilla-337735094b944fd31ed96e36c869227a0d63e5d1.zip |
Merge pull request #20 from redmatrix/master
updating from original codebase
Diffstat (limited to 'view/js/main.js')
-rw-r--r-- | view/js/main.js | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/view/js/main.js b/view/js/main.js index d670b704a..220898efd 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -248,6 +248,7 @@ var updateCountsOnly = false; var divmore_height = 400; var last_filestorage_id = null; var mediaPlaying = false; +var contentHeightDiff = 0; $(function() { $.ajaxSetup({cache: false}); @@ -630,32 +631,40 @@ function updateConvItems(mode,data) { } else { collapseHeight(); } -} +} function collapseHeight() { + var origContentHeight = parseInt($("#region_2").height()); $(".wall-item-content, .directory-collapse").each(function() { - var orgHeight = $(this).outerHeight(true); - if(orgHeight > divmore_height + 10) { + var orgHeight = parseInt($(this).css('height')); + if(orgHeight > divmore_height) { if(! $(this).hasClass('divmore')) { - $(this).readmore({ - speed: 0, - heightMargin: 50, - collapsedHeight: divmore_height, - moreLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowmore + '</a>', - lessLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowless + '</a>', - beforeToggle: function(trigger, element, expanded) { - if(expanded) { - if((($(element).offset().top + divmore_height) - $(window).scrollTop()) < 65 ) { - $('html, body').animate( { scrollTop: $(window).scrollTop() - (orgHeight - divmore_height) }, {duration: 0 } ); + if($(window).scrollTop() + ($(window).height() - divmore_height) < $(this).offset().top) { + $(this).readmore({ + speed: 0, + heightMargin: 50, + collapsedHeight: divmore_height, + moreLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowmore + '</a>', + lessLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowless + '</a>', + beforeToggle: function(trigger, element, expanded) { + if(expanded) { + if((($(element).offset().top + divmore_height) - $(window).scrollTop()) < 65 ) { + $('html, body').animate( { scrollTop: $(window).scrollTop() - (orgHeight - divmore_height) }, {duration: 0 } ); + } } } - } - }); - $(this).addClass('divmore'); + }); + $(this).addClass('divmore'); + } } } }); + + var collapsedContentHeight = parseInt($("#region_2").height()); + contentHeightDiff = origContentHeight - collapsedContentHeight; + + } function liveUpdate() { @@ -707,8 +716,10 @@ function liveUpdate() { $("#page-spinner").spin(false); $("#profile-jot-text-loading").spin(false); + console.log('contentHeightDiff: ' + contentHeightDiff); + if(update_mode === 'update') { - $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight); + $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff); } in_progress = false; |