From 8dc3446be4ae26afdbf42cbaeb8b572f5a4658a0 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 22 Jul 2014 20:20:01 -0700 Subject: when telling somebody that permissions have changed but not yet submitted, give them a submit button *right there* so they don't have to look for it. --- view/css/mod_connedit.css | 4 ++++ view/js/mod_connedit.js | 32 ++++++++++++++++---------------- view/tpl/abook_edit.tpl | 4 ++++ 3 files changed, 24 insertions(+), 16 deletions(-) (limited to 'view') diff --git a/view/css/mod_connedit.css b/view/css/mod_connedit.css index 8b80b4e70..5bf598062 100644 --- a/view/css/mod_connedit.css +++ b/view/css/mod_connedit.css @@ -21,6 +21,10 @@ padding: 20px 5px 10px; } +.abook-permssave { + margin-left: 10px; +} + #contact-slider { width: 600px !important; } diff --git a/view/js/mod_connedit.js b/view/js/mod_connedit.js index 4d25bb8c4..6231dbd0c 100644 --- a/view/js/mod_connedit.js +++ b/view/js/mod_connedit.js @@ -1,4 +1,10 @@ +function abook_perms_msg() { + $('.abook-permschange').show(); + $('.abook-permschange').html(aStr['permschange']); + $('.abook-permssave').show(); +} + $(document).ready(function() { if(typeof(after_following) !== 'undefined' && after_following) connectFullShare(); @@ -8,13 +14,12 @@ $(document).ready(function() { }); $('.abook-edit-me').click(function() { - $('.abook-permschange').show(); - $('.abook-permschange').html(aStr['permschange']); + abook_perms_msg(); }); - }); + function connectFullShare() { $('.abook-edit-me').each(function() { if(! $(this).is(':disabled')) @@ -34,9 +39,7 @@ function connectFullShare() { $('#me_id_perms_view_storage').attr('checked','checked'); $('#me_id_perms_republish').attr('checked','checked'); $('#me_id_perms_post_like').attr('checked','checked'); - - $('.abook-permschange').show(); - $('.abook-permschange').html(aStr['permschange']); + abook_perms_msg(); } function connectCautiousShare() { @@ -54,8 +57,7 @@ function connectCautiousShare() { $('#me_id_perms_post_comments').attr('checked','checked'); $('#me_id_perms_post_mail').attr('checked','checked'); $('#me_id_perms_post_like').attr('checked','checked'); - $('.abook-permschange').show(); - $('.abook-permschange').html(aStr['permschange']); + abook_perms_msg(); } @@ -78,8 +80,7 @@ function connectForum() { $('#me_id_perms_tag_deliver').attr('checked','checked'); $('#me_id_perms_republish').attr('checked','checked'); $('#me_id_perms_post_like').attr('checked','checked'); - $('.abook-permschange').show(); - $('.abook-permschange').html(aStr['permschange']); + abook_perms_msg(); } @@ -88,8 +89,8 @@ function connectClear() { if(! $(this).is(':disabled')) $(this).removeAttr('checked'); }); - $('.abook-permschange').show(); - $('.abook-permschange').html(aStr['permschange']); + abook_perms_msg(); + } function connectSoapBox() { @@ -104,8 +105,8 @@ function connectSoapBox() { $('#me_id_perms_view_contacts').attr('checked','checked'); $('#me_id_perms_view_storage').attr('checked','checked'); $('#me_id_perms_view_pages').attr('checked','checked'); - $('.abook-permschange').show(); - $('.abook-permschange').html(aStr['permschange']); + abook_perms_msg(); + } @@ -116,8 +117,7 @@ function connectFollowOnly() { }); $('#me_id_perms_send_stream').attr('checked','checked'); - $('.abook-permschange').show(); - $('.abook-permschange').html(aStr['permschange']); + abook_perms_msg(); } diff --git a/view/tpl/abook_edit.tpl b/view/tpl/abook_edit.tpl index 9b12b5f29..f7bcb56c3 100755 --- a/view/tpl/abook_edit.tpl +++ b/view/tpl/abook_edit.tpl @@ -35,6 +35,10 @@ + + {{if $is_pending}}
-- cgit v1.2.3 From 5c6a251213c7ec28ac113633cdc41f532bb6a7da Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 22 Jul 2014 22:15:34 -0700 Subject: some backend JS support for an endless scroll directory --- view/js/main.js | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 3 deletions(-) (limited to 'view') diff --git a/view/js/main.js b/view/js/main.js index 191f24b59..c803ad538 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -384,6 +384,20 @@ } + +function updatePageItems(mode,data) { + if(mode === 'append') { + $(data).each(function() { + $('#page-end').before($(this)); + }); + + if(loadingPage) { + loadingPage = false; + } + } +} + + function updateConvItems(mode,data) { if(mode === 'update') { @@ -560,8 +574,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 +640,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=&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 +1057,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 +1070,7 @@ $(window).scroll(function () { if((pageHasMoreContent) && (! loadingPage)) { $('#more').hide(); $('#no-more').hide(); - // alert('scroll'); + next_page++; scroll_next = true; loadingPage = true; @@ -1034,6 +1078,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; -- cgit v1.2.3