diff options
author | Mario Vavti <mario@mariovavti.com> | 2018-05-20 11:12:39 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2018-05-20 11:12:39 +0200 |
commit | b11db26edf963aaa59c5f34346be4480360ba773 (patch) | |
tree | bac9604957351827fe73c498644dd3bd7f8cb7f6 /view/js/acl.js | |
parent | 6d7e364a0dbbd15aba8d09f1c584a59ecef0702d (diff) | |
download | volse-hubzilla-b11db26edf963aaa59c5f34346be4480360ba773.tar.gz volse-hubzilla-b11db26edf963aaa59c5f34346be4480360ba773.tar.bz2 volse-hubzilla-b11db26edf963aaa59c5f34346be4480360ba773.zip |
do not update #acl-list-content on every click in jot. we just need this updated when in cutom mode (which is rarely the case). jot interaction was getting sluggish due to this when having lots of contacts.
Diffstat (limited to 'view/js/acl.js')
-rw-r--r-- | view/js/acl.js | 100 |
1 files changed, 51 insertions, 49 deletions
diff --git a/view/js/acl.js b/view/js/acl.js index 29652acb5..730b515a0 100644 --- a/view/js/acl.js +++ b/view/js/acl.js @@ -326,59 +326,61 @@ ACL.prototype.update_view = function(value) { } } - $("#acl-list-content .acl-list-item").each(function() { - $(this).removeClass("groupshow grouphide"); - }); + if(value === 'custom') { + $("#acl-list-content .acl-list-item").each(function() { + $(this).removeClass("groupshow grouphide"); + }); - $("#acl-list-content .acl-list-item").each(function() { - itemid = $(this).attr('id'); - type = itemid[0]; - id = itemid.substr(1); - - btshow = $(this).children(".acl-button-show").removeClass("btn-success").addClass("btn-outline-success"); - bthide = $(this).children(".acl-button-hide").removeClass("btn-danger").addClass("btn-outline-danger"); - - switch(type) { - case "g": - var uclass = ""; - if (that.allow_gid.indexOf(id)>=0) { - btshow.removeClass("btn-outline-success").addClass("btn-success"); - bthide.removeClass("btn-danger").addClass("btn-outline-danger"); - uclass="groupshow"; - } - if (that.deny_gid.indexOf(id)>=0) { - btshow.removeClass("btn-success").addClass("btn-outline-success"); - bthide.removeClass("btn-outline-danger").addClass("btn-danger"); - uclass = "grouphide"; - } - $(that.group_uids[id]).each(function(i, v) { - if(uclass == "grouphide") - // we need attr selection here because the id can include an @ (diaspora/friendica xchans) - $('[id="c' + v + '"]').removeClass("groupshow"); - if(uclass !== "") { - var cls = $('[id="c' + v + '"]').attr('class'); - if( cls === undefined) - return true; - var hiding = cls.indexOf('grouphide'); - if(hiding == -1) - $('[id="c' + v + '"]').addClass(uclass); - } - }); - break; - case "c": - if (that.allow_cid.indexOf(id)>=0){ - if(!$(this).hasClass("grouphide") ) { + $("#acl-list-content .acl-list-item").each(function() { + itemid = $(this).attr('id'); + type = itemid[0]; + id = itemid.substr(1); + + btshow = $(this).children(".acl-button-show").removeClass("btn-success").addClass("btn-outline-success"); + bthide = $(this).children(".acl-button-hide").removeClass("btn-danger").addClass("btn-outline-danger"); + + switch(type) { + case "g": + var uclass = ""; + if (that.allow_gid.indexOf(id)>=0) { btshow.removeClass("btn-outline-success").addClass("btn-success"); bthide.removeClass("btn-danger").addClass("btn-outline-danger"); + uclass="groupshow"; } - } - if (that.deny_cid.indexOf(id)>=0){ - btshow.removeClass("btn-success").addClass("btn-outline-success"); - bthide.removeClass("btn-outline-danger").addClass("btn-danger"); - $(this).removeClass("groupshow"); - } - } - }); + if (that.deny_gid.indexOf(id)>=0) { + btshow.removeClass("btn-success").addClass("btn-outline-success"); + bthide.removeClass("btn-outline-danger").addClass("btn-danger"); + uclass = "grouphide"; + } + $(that.group_uids[id]).each(function(i, v) { + if(uclass == "grouphide") + // we need attr selection here because the id can include an @ (diaspora/friendica xchans) + $('[id="c' + v + '"]').removeClass("groupshow"); + if(uclass !== "") { + var cls = $('[id="c' + v + '"]').attr('class'); + if( cls === undefined) + return true; + var hiding = cls.indexOf('grouphide'); + if(hiding == -1) + $('[id="c' + v + '"]').addClass(uclass); + } + }); + break; + case "c": + if (that.allow_cid.indexOf(id)>=0){ + if(!$(this).hasClass("grouphide") ) { + btshow.removeClass("btn-outline-success").addClass("btn-success"); + bthide.removeClass("btn-danger").addClass("btn-outline-danger"); + } + } + if (that.deny_cid.indexOf(id)>=0){ + btshow.removeClass("btn-success").addClass("btn-outline-success"); + bthide.removeClass("btn-outline-danger").addClass("btn-danger"); + $(this).removeClass("groupshow"); + } + } + }); + } }; ACL.prototype.get = function(start, count, search) { |