From b11db26edf963aaa59c5f34346be4480360ba773 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 20 May 2018 11:12:39 +0200 Subject: 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. --- view/js/acl.js | 100 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 51 insertions(+), 49 deletions(-) (limited to 'view') 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) { -- cgit v1.2.3