aboutsummaryrefslogtreecommitdiffstats
path: root/view/js/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'view/js/main.js')
-rw-r--r--view/js/main.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/view/js/main.js b/view/js/main.js
index d86b74345..07035aee3 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -616,12 +616,20 @@ function updateConvItems(mode,data) {
function collapseHeight() {
$(".wall-item-body, .contact-info").each(function() {
- if($(this).height() > divmore_height + 10) {
+ var orgHeight = $(this).height();
+ if(orgHeight > divmore_height + 10) {
if(! $(this).hasClass('divmore')) {
$(this).readmore({
collapsedHeight: divmore_height,
moreLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowmore + '</a>',
- lessLink: '<a href="#" class="divgrow-showmore">' + aStr.divgrowless + '</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: 100 } );
+ }
+ }
+ }
});
$(this).addClass('divmore');
}
@@ -666,8 +674,10 @@ function liveUpdate() {
else
update_mode = 'append';
}
- else
+ else {
update_mode = 'update';
+ var orgHeight = $("#region_2").height();
+ }
$.get(update_url, function(data) {
page_load = false;
@@ -676,6 +686,10 @@ function liveUpdate() {
$("#page-spinner").spin(false);
$("#profile-jot-text-loading").spin(false);
+ if(update_mode === 'update') {
+ $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight);
+ }
+
in_progress = false;
// FIXME - the following lines were added so that almost
@@ -1340,4 +1354,4 @@ function zid(s) {
s = s + achar + 'f=&zid=' + zid;
return s;
-} \ No newline at end of file
+}