diff options
author | Paolo T <tuscanhobbit@users.noreply.github.com> | 2014-08-18 18:55:18 +0200 |
---|---|---|
committer | Paolo T <tuscanhobbit@users.noreply.github.com> | 2014-08-18 18:55:18 +0200 |
commit | b5d1c7865b14fa60c35618b4179eb3c91949a441 (patch) | |
tree | 38ddb2fcab0f4c2c3baf6917e3544148cbe1eb9e /view/js/main.js | |
parent | 3b979dd2a9f8bb8f569c234408d02dfd1e7039d7 (diff) | |
parent | d9ff121930554aa9bcad4f4ceffeb9b5e3b83d17 (diff) | |
download | volse-hubzilla-b5d1c7865b14fa60c35618b4179eb3c91949a441.tar.gz volse-hubzilla-b5d1c7865b14fa60c35618b4179eb3c91949a441.tar.bz2 volse-hubzilla-b5d1c7865b14fa60c35618b4179eb3c91949a441.zip |
Merge pull request #1 from friendica/master
Red master has been merged
Diffstat (limited to 'view/js/main.js')
-rw-r--r-- | view/js/main.js | 105 |
1 files changed, 102 insertions, 3 deletions
diff --git a/view/js/main.js b/view/js/main.js index 191f24b59..b5b77d473 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -156,6 +156,15 @@ } } + function closeOpen(theID) { + if(document.getElementById(theID).style.display == "none") { + document.getElementById(theID).style.display = "block" + } + else { + document.getElementById(theID).style.display = "none" + } + } + function openMenu(theID) { document.getElementById(theID).style.display = "block" } @@ -267,6 +276,23 @@ return false; } } + if(event.keyCode == '34') { + if((pageHasMoreContent) && (! loadingPage)) { + $('#more').hide(); + $('#no-more').hide(); + + next_page++; + scroll_next = true; + loadingPage = true; + + if($('.directory-end').length == 0) + liveUpdate(); + else + pageUpdate(); + return true; + } + } + if(event.keyCode == '19' || (event.ctrlKey && event.which == '32')) { event.preventDefault(); if(stopped == false) { @@ -384,6 +410,28 @@ } + +function updatePageItems(mode,data) { + + + if(mode === 'append') { + $(data).each(function() { + $('#page-end').before($(this)); + }); + + if(loadingPage) { + loadingPage = false; + } + } + + var e = document.getElementById('content-complete'); + if(e) { + pageHasMoreContent = false; + } + +} + + function updateConvItems(mode,data) { if(mode === 'update') { @@ -560,8 +608,6 @@ function updateConvItems(mode,data) { - - function liveUpdate() { if((src == null) || (stopped) || (! profile_uid)) { $('.like-rotator').spin(false); return; } if(($('.comment-edit-text-full').length) || (in_progress)) { @@ -628,6 +674,37 @@ function updateConvItems(mode,data) { } + function pageUpdate() { + + in_progress = true; + + var update_url; + var update_mode; + + if(scroll_next) { + bParam_page = next_page; + page_load = true; + } + else { + bParam_page = 1; + } + + update_url = baseurl + '/directory/?f=&aj=1&page=' + bParam_page; + + $("#page-spinner").spin('small'); + update_mode = 'append'; + + $.get(update_url,function(data) { + page_load = false; + scroll_next = false; + updatePageItems(update_mode,data); + $("#page-spinner").spin(false); + in_progress = false; + }); + + } + + function notify_popup_loader(notifyType) { /* notifications template */ @@ -1014,6 +1091,7 @@ $(document).ready(function() { $(window).scroll(function () { if(typeof buildCmd == 'function') { + // This is a content page with items and/or conversations $('#more').hide(); $('#no-more').hide(); @@ -1026,7 +1104,7 @@ $(window).scroll(function () { if((pageHasMoreContent) && (! loadingPage)) { $('#more').hide(); $('#no-more').hide(); - // alert('scroll'); + next_page++; scroll_next = true; loadingPage = true; @@ -1034,6 +1112,27 @@ $(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((pageHasMoreContent) && (! loadingPage)) { + $('#more').hide(); + $('#no-more').hide(); + + next_page++; + scroll_next = true; + loadingPage = true; + pageUpdate(); + } + } + } + }); var chanviewFullSize = false; |