diff options
author | Mario Vavti <mario@mariovavti.com> | 2018-05-20 11:12:39 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2018-05-20 22:54:02 +0200 |
commit | 18338495afcdb913a5d18782c3e9860bd9b9451c (patch) | |
tree | 936e098bbc0bd1c54b3ae98a5d411e23844bccc7 | |
parent | a3f9cf7e97e85e421faaf50d559c17279ae54691 (diff) | |
download | volse-hubzilla-18338495afcdb913a5d18782c3e9860bd9b9451c.tar.gz volse-hubzilla-18338495afcdb913a5d18782c3e9860bd9b9451c.tar.bz2 volse-hubzilla-18338495afcdb913a5d18782c3e9860bd9b9451c.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.
-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) { |