From d7abacb7b2737699d983862aa03628ee3d758545 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 30 Jan 2016 00:30:49 +0100 Subject: it is not perfect but it still may ease the collapsing of items above the viewport a little... --- view/js/main.js | 50 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index d670b704a..3906953f6 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -630,14 +630,29 @@ function updateConvItems(mode,data) { } else { collapseHeight(); } + } +var contentHeightDiff = 0; function collapseHeight() { + var origContentHeight = parseInt($("#region_2").height()); + var cDiff = 0; + var i = 0; $(".wall-item-content, .directory-collapse").each(function() { - var orgHeight = $(this).outerHeight(true); - if(orgHeight > divmore_height + 10) { + var orgHeight = parseInt($(this).height()); + if(orgHeight > divmore_height) { if(! $(this).hasClass('divmore')) { + + // check if we will collapse some content above the visible content and compensate the diff later + if(($(this).offset().top + orgHeight - $(window).scrollTop()) < 50) { + diff = orgHeight - divmore_height; + //console.log('diff: ' + diff); + + cDiff = cDiff + diff; + i++; + } + $(this).readmore({ speed: 0, heightMargin: 50, @@ -653,9 +668,38 @@ function collapseHeight() { } }); $(this).addClass('divmore'); + } } }); + + var collapsedContentHeight = parseInt($("#region_2").height()); + contentHeightDiff = origContentHeight - collapsedContentHeight; + + if(i){ + + var position = $(window).scrollTop(); + + //console.log('cDiff: ' + cDiff); + + //console.log('position: ' + position); + + //console.log('origContentHeight: ' + origContentHeight); + + //console.log('collapsedContentHeight: ' + collapsedContentHeight); + + //console.log('contentHeightDiff: ' + contentHeightDiff); + + var sval = position - cDiff + (i*3); // i*3 is possibly some border or margin/padding which might not be calculated correct + + //console.log('sval: ' + sval); + console.log('collapsed above content count: ' + i); + + $(window).scrollTop(sval); + + //var nposition = $(document).scrollTop(); + //console.log('nposition: ' + nposition); + } } function liveUpdate() { @@ -708,7 +752,7 @@ function liveUpdate() { $("#profile-jot-text-loading").spin(false); if(update_mode === 'update') { - $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight); + $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff); } in_progress = false; -- cgit v1.2.3 From da198fdda50389d79f1c792d6e11369ec869a88e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 30 Jan 2016 01:28:01 +0100 Subject: more on collapsing --- view/js/main.js | 73 ++++++++++++++++----------------------------------------- 1 file changed, 20 insertions(+), 53 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 3906953f6..a37c23cf0 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}); @@ -624,7 +625,7 @@ function updateConvItems(mode,data) { bimgs.load(function() { bimgcount--; if (! bimgcount) { - collapseHeight(); + collapseHeight(true); } }); } else { @@ -633,42 +634,29 @@ function updateConvItems(mode,data) { } - -var contentHeightDiff = 0; -function collapseHeight() { +function collapseHeight(below=false) { var origContentHeight = parseInt($("#region_2").height()); - var cDiff = 0; - var i = 0; $(".wall-item-content, .directory-collapse").each(function() { var orgHeight = parseInt($(this).height()); if(orgHeight > divmore_height) { if(! $(this).hasClass('divmore')) { - - // check if we will collapse some content above the visible content and compensate the diff later - if(($(this).offset().top + orgHeight - $(window).scrollTop()) < 50) { - diff = orgHeight - divmore_height; - //console.log('diff: ' + diff); - - cDiff = cDiff + diff; - i++; - } - - $(this).readmore({ - speed: 0, - heightMargin: 50, - collapsedHeight: divmore_height, - moreLink: '' + aStr.divgrowmore + '', - lessLink: '' + aStr.divgrowless + '', - 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((below=true) && ($(window).scrollTop() + ($(window).height() - divmore_height) < $(this).offset().top)) { + $(this).readmore({ + speed: 0, + heightMargin: 50, + collapsedHeight: divmore_height, + moreLink: '' + aStr.divgrowmore + '', + lessLink: '' + aStr.divgrowless + '', + 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'); + } } } }); @@ -676,30 +664,7 @@ function collapseHeight() { var collapsedContentHeight = parseInt($("#region_2").height()); contentHeightDiff = origContentHeight - collapsedContentHeight; - if(i){ - var position = $(window).scrollTop(); - - //console.log('cDiff: ' + cDiff); - - //console.log('position: ' + position); - - //console.log('origContentHeight: ' + origContentHeight); - - //console.log('collapsedContentHeight: ' + collapsedContentHeight); - - //console.log('contentHeightDiff: ' + contentHeightDiff); - - var sval = position - cDiff + (i*3); // i*3 is possibly some border or margin/padding which might not be calculated correct - - //console.log('sval: ' + sval); - console.log('collapsed above content count: ' + i); - - $(window).scrollTop(sval); - - //var nposition = $(document).scrollTop(); - //console.log('nposition: ' + nposition); - } } function liveUpdate() { @@ -751,6 +716,8 @@ 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 + contentHeightDiff); } -- cgit v1.2.3 From b6543beca2f0e5e353b497099e3fa6b29bf47233 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 30 Jan 2016 01:34:27 +0100 Subject: do not make a difference if there are images or not for now --- view/js/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index a37c23cf0..16f6b9213 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -625,7 +625,7 @@ function updateConvItems(mode,data) { bimgs.load(function() { bimgcount--; if (! bimgcount) { - collapseHeight(true); + collapseHeight(); } }); } else { @@ -634,13 +634,13 @@ function updateConvItems(mode,data) { } -function collapseHeight(below=false) { +function collapseHeight() { var origContentHeight = parseInt($("#region_2").height()); $(".wall-item-content, .directory-collapse").each(function() { var orgHeight = parseInt($(this).height()); if(orgHeight > divmore_height) { if(! $(this).hasClass('divmore')) { - if((below=true) && ($(window).scrollTop() + ($(window).height() - divmore_height) < $(this).offset().top)) { + if($(window).scrollTop() + ($(window).height() - divmore_height) < $(this).offset().top) { $(this).readmore({ speed: 0, heightMargin: 50, -- cgit v1.2.3 From 0405a49df19663d92a8e660a4193dbf2f582f04d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 30 Jan 2016 13:47:58 +0100 Subject: fix a slight regression --- view/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 16f6b9213..220898efd 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -637,7 +637,7 @@ function updateConvItems(mode,data) { function collapseHeight() { var origContentHeight = parseInt($("#region_2").height()); $(".wall-item-content, .directory-collapse").each(function() { - var orgHeight = parseInt($(this).height()); + var orgHeight = parseInt($(this).css('height')); if(orgHeight > divmore_height) { if(! $(this).hasClass('divmore')) { if($(window).scrollTop() + ($(window).height() - divmore_height) < $(this).offset().top) { -- cgit v1.2.3 From f1245206ceadd60fec4bd00948c115f74ad6dbd7 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 2 Feb 2016 12:40:40 +0100 Subject: change aside width to reflect recent widget style changes --- view/js/main.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 220898efd..2b13acc3d 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -640,7 +640,10 @@ function collapseHeight() { var orgHeight = parseInt($(this).css('height')); if(orgHeight > divmore_height) { if(! $(this).hasClass('divmore')) { - if($(window).scrollTop() + ($(window).height() - divmore_height) < $(this).offset().top) { + + var trigger = $(window).scrollTop() + ($(window).height() - divmore_height) < $(this).offset().top ? true : false; + + if(trigger) { $(this).readmore({ speed: 0, heightMargin: 50, -- cgit v1.2.3 From 48963f62f974ce4f2d8e26c344b65e87f704e4d6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 8 Feb 2016 22:19:38 +0100 Subject: avoid collapsing only above the viewport --- view/js/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 2b13acc3d..d1bf34699 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -641,7 +641,7 @@ function collapseHeight() { if(orgHeight > divmore_height) { if(! $(this).hasClass('divmore')) { - var trigger = $(window).scrollTop() + ($(window).height() - divmore_height) < $(this).offset().top ? true : false; + var trigger = $(window).scrollTop() < $(this).offset().top ? true : false; if(trigger) { $(this).readmore({ @@ -653,7 +653,7 @@ function collapseHeight() { 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 } ); + $(window).scrollTop($(window).scrollTop() - (orgHeight - divmore_height)); } } } -- cgit v1.2.3 From 0b487122f6463b5918207cde99b7ba3ad55d5bcc Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 12 Feb 2016 11:00:50 +0100 Subject: tryout: introduce loading of images before rendering content and provide some detailed logging in js-console --- view/js/main.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index d1bf34699..f75f1f095 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -617,7 +617,7 @@ function updateConvItems(mode,data) { /* autocomplete @nicknames */ $(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl?f=&n=1"); - +/* var bimgs = $(".wall-item-body img").not(function() { return this.complete; }); var bimgcount = bimgs.length; @@ -631,6 +631,8 @@ function updateConvItems(mode,data) { } else { collapseHeight(); } +*/ + collapseHeight(); } @@ -666,6 +668,7 @@ function collapseHeight() { var collapsedContentHeight = parseInt($("#region_2").height()); contentHeightDiff = origContentHeight - collapsedContentHeight; + console.log('collapseHeight() - contentHeightDiff: ' + contentHeightDiff + 'px'); } @@ -712,15 +715,24 @@ function liveUpdate() { var orgHeight = $("#region_2").height(); } + + var dstart = new Date(); + console.log('LOADING data...'); $.get(update_url, function(data) { + var dready = new Date(); + console.log('DATA ready in: ' + (dready - dstart)/1000 + ' seconds.'); + console.log('LOADING images...'); + + $('.wall-item-body, .wall-photo-item',data).imagesLoaded( function() { + var iready = new Date(); + console.log('IMAGES ready in: ' + (iready - dready)/1000 + ' seconds.'); + page_load = false; scroll_next = false; updateConvItems(update_mode,data); $("#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 + contentHeightDiff); } @@ -740,6 +752,9 @@ function liveUpdate() { updateCountsOnly = true; if(timer) clearTimeout(timer); timer = setTimeout(NavUpdate,10); + + }); + }); } -- cgit v1.2.3 From afb86aa90896c04101e384edcb4fef6514fbefcc Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 15 Feb 2016 22:20:55 +0100 Subject: clean up some unused stuff and start loading content a bit earlier --- view/js/main.js | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index f75f1f095..cf367ec87 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1231,21 +1231,8 @@ function zFormError(elm,x) { $(window).scroll(function () { if(typeof buildCmd == 'function') { // This is a content page with items and/or conversations - $('#more').hide(); - $('#no-more').hide(); - - if($(window).scrollTop() + $(window).height() > $(document).height() - 200) { - $('#more').css("top","400"); - $('#more').show(); - } - - if($(window).scrollTop() + $(window).height() > $(document).height() - 100) { -// if($(window).scrollTop() > $(document).height() - ($(window).height() * 1.5 )) { - + if($(window).scrollTop() + $(window).height() > $(document).height() - 300) { if((pageHasMoreContent) && (! loadingPage)) { - $('#more').hide(); - $('#no-more').hide(); - next_page++; scroll_next = true; loadingPage = true; @@ -1255,18 +1242,8 @@ $(window).scroll(function () { } else { // This is some other kind of page - perhaps a directory - - if($(window).scrollTop() + $(window).height() > $(document).height() - 200) { - $('#more').css("top","400"); - $('#more').show(); - } - - if($(window).scrollTop() + $(window).height() > $(document).height() - 100) { -// if($(window).scrollTop() > ($(document).height() - $(window).height() * 1.5 )) { + if($(window).scrollTop() + $(window).height() > $(document).height() - 300) { if((pageHasMoreContent) && (! loadingPage) && (! justifiedGalleryActive)) { - $('#more').hide(); - $('#no-more').hide(); - next_page++; scroll_next = true; loadingPage = true; -- cgit v1.2.3 From 3be6ef6bfcf662616b37da85fbeb2a7a08a1bd4e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 16 Feb 2016 14:42:13 +0100 Subject: since we preload images now we also can collapse and calculate posts above the viewport --- view/js/main.js | 68 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 25 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index cf367ec87..f9f88aec6 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -638,12 +638,24 @@ function updateConvItems(mode,data) { function collapseHeight() { var origContentHeight = parseInt($("#region_2").height()); + var cDiff = 0; + var i = 0; + var position = $(window).scrollTop(); + $(".wall-item-content, .directory-collapse").each(function() { var orgHeight = parseInt($(this).css('height')); if(orgHeight > divmore_height) { if(! $(this).hasClass('divmore')) { - var trigger = $(window).scrollTop() < $(this).offset().top ? true : false; + //var trigger = $(window).scrollTop() < $(this).offset().top ? true : false; + var trigger = true; + + // check if we will collapse some content above the visible content and compensate the diff later + if($(window).scrollTop() > $(this).offset().top) { + diff = orgHeight - divmore_height; + cDiff = cDiff + diff; + i++; + } if(trigger) { $(this).readmore({ @@ -670,6 +682,12 @@ function collapseHeight() { contentHeightDiff = origContentHeight - collapsedContentHeight; console.log('collapseHeight() - contentHeightDiff: ' + contentHeightDiff + 'px'); + if(i){ + var sval = position - cDiff + $(".divgrow-showmore").height(); + console.log('collapsed above content count: ' + i); + $(window).scrollTop(sval); + } + } @@ -724,34 +742,34 @@ function liveUpdate() { console.log('LOADING images...'); $('.wall-item-body, .wall-photo-item',data).imagesLoaded( function() { - var iready = new Date(); - console.log('IMAGES ready in: ' + (iready - dready)/1000 + ' seconds.'); + var iready = new Date(); + console.log('IMAGES ready in: ' + (iready - dready)/1000 + ' seconds.'); - page_load = false; - scroll_next = false; - updateConvItems(update_mode,data); - $("#page-spinner").spin(false); - $("#profile-jot-text-loading").spin(false); + page_load = false; + scroll_next = false; + updateConvItems(update_mode,data); + $("#page-spinner").spin(false); + $("#profile-jot-text-loading").spin(false); - if(update_mode === 'update') { - $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff); - } + if(update_mode === 'update') { + $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff); + } - in_progress = false; + in_progress = false; - // FIXME - the following lines were added so that almost - // immediately after we update the posts on the page, we - // re-check and update the notification counts. - // As it turns out this causes a bit of an inefficiency - // as we're pinging twice for every update, once before - // and once after. A btter way to do this is to rewrite - // NavUpdate and perhaps LiveUpdate so that we check for - // post updates first and only call the notification ping - // once. - - updateCountsOnly = true; - if(timer) clearTimeout(timer); - timer = setTimeout(NavUpdate,10); + // FIXME - the following lines were added so that almost + // immediately after we update the posts on the page, we + // re-check and update the notification counts. + // As it turns out this causes a bit of an inefficiency + // as we're pinging twice for every update, once before + // and once after. A btter way to do this is to rewrite + // NavUpdate and perhaps LiveUpdate so that we check for + // post updates first and only call the notification ping + // once. + + updateCountsOnly = true; + if(timer) clearTimeout(timer); + timer = setTimeout(NavUpdate,10); }); -- cgit v1.2.3 From 45247d1595f4478bf9bb684efd210afbcc36f018 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 16 Feb 2016 20:53:38 +0100 Subject: only prefetch images on update_mode update --- view/js/main.js | 83 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 29 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index f9f88aec6..19f0eb79c 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -617,7 +617,7 @@ function updateConvItems(mode,data) { /* autocomplete @nicknames */ $(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl?f=&n=1"); -/* + var bimgs = $(".wall-item-body img").not(function() { return this.complete; }); var bimgcount = bimgs.length; @@ -631,8 +631,8 @@ function updateConvItems(mode,data) { } else { collapseHeight(); } -*/ - collapseHeight(); + + //collapseHeight(); } @@ -648,7 +648,6 @@ function collapseHeight() { if(! $(this).hasClass('divmore')) { //var trigger = $(window).scrollTop() < $(this).offset().top ? true : false; - var trigger = true; // check if we will collapse some content above the visible content and compensate the diff later if($(window).scrollTop() > $(this).offset().top) { @@ -657,23 +656,23 @@ function collapseHeight() { i++; } - if(trigger) { - $(this).readmore({ - speed: 0, - heightMargin: 50, - collapsedHeight: divmore_height, - moreLink: '' + aStr.divgrowmore + '', - lessLink: '' + aStr.divgrowless + '', - beforeToggle: function(trigger, element, expanded) { - if(expanded) { - if((($(element).offset().top + divmore_height) - $(window).scrollTop()) < 65 ) { - $(window).scrollTop($(window).scrollTop() - (orgHeight - divmore_height)); - } + //if(trigger) { + $(this).readmore({ + speed: 0, + heightMargin: 50, + collapsedHeight: divmore_height, + moreLink: '' + aStr.divgrowmore + '', + lessLink: '' + aStr.divgrowless + '', + beforeToggle: function(trigger, element, expanded) { + if(expanded) { + if((($(element).offset().top + divmore_height) - $(window).scrollTop()) < 65 ) { + $(window).scrollTop($(window).scrollTop() - (orgHeight - divmore_height)); } } - }); - $(this).addClass('divmore'); - } + } + }); + $(this).addClass('divmore'); + //} } } }); @@ -683,7 +682,7 @@ function collapseHeight() { console.log('collapseHeight() - contentHeightDiff: ' + contentHeightDiff + 'px'); if(i){ - var sval = position - cDiff + $(".divgrow-showmore").height(); + var sval = position - cDiff + ($(".divgrow-showmore").outerHeight() * i); console.log('collapsed above content count: ' + i); $(window).scrollTop(sval); } @@ -739,22 +738,48 @@ function liveUpdate() { $.get(update_url, function(data) { var dready = new Date(); console.log('DATA ready in: ' + (dready - dstart)/1000 + ' seconds.'); - console.log('LOADING images...'); - $('.wall-item-body, .wall-photo-item',data).imagesLoaded( function() { - var iready = new Date(); - console.log('IMAGES ready in: ' + (iready - dready)/1000 + ' seconds.'); + if(update_mode === 'update') { + console.log('LOADING images...'); + + $('.wall-item-body, .wall-photo-item',data).imagesLoaded( function() { + var iready = new Date(); + console.log('IMAGES ready in: ' + (iready - dready)/1000 + ' seconds.'); + + page_load = false; + scroll_next = false; + updateConvItems(update_mode,data); + $("#page-spinner").spin(false); + $("#profile-jot-text-loading").spin(false); + + $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff); + + in_progress = false; + + // FIXME - the following lines were added so that almost + // immediately after we update the posts on the page, we + // re-check and update the notification counts. + // As it turns out this causes a bit of an inefficiency + // as we're pinging twice for every update, once before + // and once after. A btter way to do this is to rewrite + // NavUpdate and perhaps LiveUpdate so that we check for + // post updates first and only call the notification ping + // once. + + updateCountsOnly = true; + if(timer) clearTimeout(timer); + timer = setTimeout(NavUpdate,10); + + }); + } + else { page_load = false; scroll_next = false; updateConvItems(update_mode,data); $("#page-spinner").spin(false); $("#profile-jot-text-loading").spin(false); - if(update_mode === 'update') { - $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff); - } - in_progress = false; // FIXME - the following lines were added so that almost @@ -771,7 +796,7 @@ function liveUpdate() { if(timer) clearTimeout(timer); timer = setTimeout(NavUpdate,10); - }); + } }); } -- cgit v1.2.3 From 679fb7d0d2ce56d1e67c9aa08441c95828d96463 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 16 Feb 2016 20:58:10 +0100 Subject: content -> viewport --- view/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 19f0eb79c..1fb61ebab 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -683,7 +683,7 @@ function collapseHeight() { if(i){ var sval = position - cDiff + ($(".divgrow-showmore").outerHeight() * i); - console.log('collapsed above content count: ' + i); + console.log('collapsed above vieport count: ' + i); $(window).scrollTop(sval); } -- cgit v1.2.3 From 0eb0256502f4091858f3773c92fd63b83eb9a5a9 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 16 Feb 2016 21:02:28 +0100 Subject: typo --- view/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 1fb61ebab..2ae542ed8 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -683,7 +683,7 @@ function collapseHeight() { if(i){ var sval = position - cDiff + ($(".divgrow-showmore").outerHeight() * i); - console.log('collapsed above vieport count: ' + i); + console.log('collapsed above viewport count: ' + i); $(window).scrollTop(sval); } -- cgit v1.2.3 From 364972a2925ee9545364e53b79d5a3d50149119d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 16 Feb 2016 21:29:09 +0100 Subject: Thats probably better but there are still edge cases... --- view/js/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 2ae542ed8..ca2f3bbcb 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -650,7 +650,7 @@ function collapseHeight() { //var trigger = $(window).scrollTop() < $(this).offset().top ? true : false; // check if we will collapse some content above the visible content and compensate the diff later - if($(window).scrollTop() > $(this).offset().top) { + if(($(this).offset().top + orgHeight - $(window).scrollTop()) < 50) { diff = orgHeight - divmore_height; cDiff = cDiff + diff; i++; @@ -753,7 +753,7 @@ function liveUpdate() { $("#page-spinner").spin(false); $("#profile-jot-text-loading").spin(false); - $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff); + //$(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff); in_progress = false; -- cgit v1.2.3 From b8c7b2f81df61e5068366cbdb0f18940ff5d4bf1 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 17 Feb 2016 11:07:47 +0100 Subject: more refinement on collapsing --- view/js/main.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index ca2f3bbcb..6bc7d9e91 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -648,9 +648,12 @@ function collapseHeight() { if(! $(this).hasClass('divmore')) { //var trigger = $(window).scrollTop() < $(this).offset().top ? true : false; + //console.log($(this).offset().top + divmore_height - $(window).scrollTop() + cDiff - ($(".divgrow-showmore").outerHeight() * i)); // check if we will collapse some content above the visible content and compensate the diff later - if(($(this).offset().top + orgHeight - $(window).scrollTop()) < 50) { + if($(this).offset().top + divmore_height - $(window).scrollTop() + cDiff - ($(".divgrow-showmore").outerHeight() * i) < 65) { + //$(this).css('color', 'red'); + //console.log($(this).offset().top + divmore_height + ' / ' + $(window).scrollTop()); diff = orgHeight - divmore_height; cDiff = cDiff + diff; i++; @@ -753,7 +756,8 @@ function liveUpdate() { $("#page-spinner").spin(false); $("#profile-jot-text-loading").spin(false); - //$(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff); + // adjust scroll position if new content was added above viewport + $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff); in_progress = false; -- cgit v1.2.3 From ddbe3c7426a551420bb6ead09984333e956b3a58 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 17 Feb 2016 12:32:12 +0100 Subject: make always preload images before rendering the page a display setting --- view/js/main.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 6bc7d9e91..04b317914 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -618,7 +618,7 @@ function updateConvItems(mode,data) { /* autocomplete @nicknames */ $(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl?f=&n=1"); - var bimgs = $(".wall-item-body img").not(function() { return this.complete; }); + var bimgs = ((preloadImages) ? false : $(".wall-item-body img").not(function() { return this.complete; })); var bimgcount = bimgs.length; if (bimgcount) { @@ -632,8 +632,6 @@ function updateConvItems(mode,data) { collapseHeight(); } - //collapseHeight(); - } function collapseHeight() { @@ -742,8 +740,7 @@ function liveUpdate() { var dready = new Date(); console.log('DATA ready in: ' + (dready - dstart)/1000 + ' seconds.'); - - if(update_mode === 'update') { + if(update_mode === 'update' || preloadImages) { console.log('LOADING images...'); $('.wall-item-body, .wall-photo-item',data).imagesLoaded( function() { @@ -757,7 +754,9 @@ function liveUpdate() { $("#profile-jot-text-loading").spin(false); // adjust scroll position if new content was added above viewport - $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff); + if(update_mode === 'update') { + $(window).scrollTop($(window).scrollTop() + $("#region_2").height() - orgHeight + contentHeightDiff); + } in_progress = false; -- cgit v1.2.3 From 90a5ba01a35aeb3629ebe76069e68c64b913a4d5 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 31 Mar 2016 23:13:40 +0200 Subject: make fullscreen mode available for other modules and some cleanup --- view/js/main.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 04b317914..d6d1238d4 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1451,3 +1451,16 @@ function zid(s) { return s; } + +function makeFullScreen(full) { + if(typeof full=='undefined' || full == true) { + $('#fullscreen, aside').hide(); + $('#inline').show(); + $('.generic-content-wrapper').addClass('fullscreen'); + } + else { + $('#fullscreen, aside').show(); + $('#inline').hide(); + $('.generic-content-wrapper').removeClass('fullscreen'); + } +} -- cgit v1.2.3 From 50d9b2934742ad9fb0dc8354d405789e3c14cd00 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 1 Apr 2016 00:16:39 +0200 Subject: slightly change the way fullscreen works and bring it to mod mail --- view/js/main.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index d6d1238d4..4e99bf1aa 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1454,13 +1454,15 @@ function zid(s) { function makeFullScreen(full) { if(typeof full=='undefined' || full == true) { - $('#fullscreen, aside').hide(); - $('#inline').show(); + $('#fullscreen-btn, header, nav, aside').hide(); + $('main').css({'width': '100%', 'max-width': 'none'}); + $('#inline-btn').show(); $('.generic-content-wrapper').addClass('fullscreen'); } else { - $('#fullscreen, aside').show(); - $('#inline').hide(); + $('#fullscreen-btn, header, nav, aside').show(); + $('main').removeAttr('style'); + $('#inline-btn').hide(); $('.generic-content-wrapper').removeClass('fullscreen'); } } -- cgit v1.2.3 From 60bb8f25f7bd1e857f8e70769b83f9c75521db29 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 1 Apr 2016 08:56:51 +0200 Subject: move fullscreen js code to redbasic.js where it belongs to --- view/js/main.js | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 4e99bf1aa..04b317914 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -1451,18 +1451,3 @@ function zid(s) { return s; } - -function makeFullScreen(full) { - if(typeof full=='undefined' || full == true) { - $('#fullscreen-btn, header, nav, aside').hide(); - $('main').css({'width': '100%', 'max-width': 'none'}); - $('#inline-btn').show(); - $('.generic-content-wrapper').addClass('fullscreen'); - } - else { - $('#fullscreen-btn, header, nav, aside').show(); - $('main').removeAttr('style'); - $('#inline-btn').hide(); - $('.generic-content-wrapper').removeClass('fullscreen'); - } -} -- cgit v1.2.3 From ec651f219e10c71a493e0cd2b4737077aee826dc Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 4 Apr 2016 17:12:23 +0200 Subject: a simple autocomplete for bbcode or comanche - partly implemented --- view/js/main.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index 04b317914..ba476b576 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -617,6 +617,8 @@ function updateConvItems(mode,data) { /* autocomplete @nicknames */ $(".comment-edit-form textarea").editor_autocomplete(baseurl+"/acl?f=&n=1"); + /* autocomplete bbcode */ + $(".comment-edit-form textarea").bbco_autocomplete('bbcode'); var bimgs = ((preloadImages) ? false : $(".wall-item-body img").not(function() { return this.complete; })); var bimgcount = bimgs.length; -- cgit v1.2.3 From 5cb3143c0448834f7bd164320bec15ef2a030c52 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 10 Apr 2016 21:30:35 -0700 Subject: issue #331 use timeago.js for reshared publish date instead of relative_date() which does not play well with other networks. --- view/js/main.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'view/js/main.js') diff --git a/view/js/main.js b/view/js/main.js index ba476b576..799ae82bc 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -491,6 +491,7 @@ function updateConvItems(mode,data) { if(isVisible) showHideComments(itmId); $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago(); + $("> .shared_header .autotime",this).timeago(); } else { $('img',this).each(function() { @@ -502,6 +503,7 @@ function updateConvItems(mode,data) { if(isVisible) showHideComments(itmId); $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago(); + $("> .shared_header .autotime",this).timeago(); } prev = ident; }); @@ -529,6 +531,7 @@ function updateConvItems(mode,data) { if(isVisible) showHideComments(itmId); $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago(); + $("> .shared_header .autotime",this).timeago(); } else { $('img',this).each(function() { @@ -540,6 +543,7 @@ function updateConvItems(mode,data) { if(isVisible) showHideComments(itmId); $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago(); + $("> .shared_header .autotime",this).timeago(); } }); @@ -573,6 +577,7 @@ function updateConvItems(mode,data) { if(isVisible) showHideComments(itmId); $("> .wall-item-outside-wrapper .autotime, > .thread-wrapper .autotime",this).timeago(); + $("> .shared_header .autotime",this).timeago(); } prev = ident; }); @@ -1048,6 +1053,7 @@ function preview_comment(id) { function(data) { if(data.preview) { $("#comment-edit-preview-" + id).html(data.preview); + $("#comment-edit-preview-" + id + " .autotime").timeago(); $("#comment-edit-preview-" + id + " a").click(function() { return false; }); } }, @@ -1078,6 +1084,7 @@ function preview_post() { function(data) { if(data.preview) { $("#jot-preview-content").html(data.preview); + $("#jot-preview-content .autotime").timeago(); $("#jot-preview-content" + " a").click(function() { return false; }); } }, -- cgit v1.2.3