]> git.mxchange.org Git - friendica.git/blobdiff - js/acl.js
Merge pull request #523 from balderino/master
[friendica.git] / js / acl.js
index 82b631ee9444f0a98f666a08b4e31010a1ccfb08..e383224ca8aba067bd952b59e0f04e089b67a314 100644 (file)
--- a/js/acl.js
+++ b/js/acl.js
@@ -58,7 +58,9 @@ ACL.prototype.on_search = function(event){
 }
 
 ACL.prototype.on_showall = function(event){
+       event.preventDefault()
        event.stopPropagation();
+       
        if (that.showall.hasClass("selected")){
                return false;
        }
@@ -69,12 +71,14 @@ ACL.prototype.on_showall = function(event){
        that.deny_cid  = [];
        that.deny_gid  = [];
        
-       that.updateview();
+       that.update_view();
        
        return false;
 }
 
 ACL.prototype.on_button_show = function(event){
+       event.preventDefault()
+       event.stopImmediatePropagation()
        event.stopPropagation();
 
        /*that.showall.removeClass("selected");
@@ -86,6 +90,8 @@ ACL.prototype.on_button_show = function(event){
        return false;
 }
 ACL.prototype.on_button_hide = function(event){
+       event.preventDefault()
+       event.stopImmediatePropagation()
        event.stopPropagation();
 
        /*that.showall.removeClass("selected");
@@ -118,7 +124,7 @@ ACL.prototype.set_allow = function(itemid){
                        if (that.deny_cid.indexOf(id)>=0) that.deny_cid.remove(id);                     
                        break;
        }
-       that.updateview();
+       that.update_view();
 }
 
 ACL.prototype.set_deny = function(itemid){
@@ -142,10 +148,10 @@ ACL.prototype.set_deny = function(itemid){
                        if (that.allow_cid.indexOf(id)>=0) that.allow_cid.remove(id);
                        break;
        }
-       that.updateview();
+       that.update_view();
 }
 
-ACL.prototype.updateview = function(){
+ACL.prototype.update_view = function(){
        if (that.allow_gid.length==0 && that.allow_cid.length==0 &&
                that.deny_gid.length==0 && that.deny_cid.length==0){
                        that.showall.addClass("selected");
@@ -153,7 +159,7 @@ ACL.prototype.updateview = function(){
                                $('#jot-perms-icon').removeClass('lock').addClass('unlock');
                                $('#jot-public').show();
                                $('.profile-jot-net input').attr('disabled', false);                    
-                               if(editor != false) {
+                               if(typeof editor != 'undefined' && editor != false) {
                                        $('#profile-jot-desc').html(ispublic);
                                }
                        
@@ -165,6 +171,9 @@ ACL.prototype.updateview = function(){
                                $('.profile-jot-net input').attr('disabled', 'disabled');                       
                                $('#profile-jot-desc').html(' ');
        }
+       $("#acl-list-content .acl-list-item").each(function(){
+               $(this).removeClass("groupshow grouphide");
+       });
        
        $("#acl-list-content .acl-list-item").each(function(){
                itemid = $(this).attr('id');
@@ -188,8 +197,17 @@ ACL.prototype.updateview = function(){
                                        uclass="grouphide";
                                }
                                
-                               $(that.group_uids[id]).each(function(i,v){
-                                       $("#c"+v).removeClass("groupshow grouphide").addClass(uclass);
+                               $(that.group_uids[id]).each(function(i,v) {
+                                       if(uclass == "grouphide")
+                                               $("#c"+v).removeClass("groupshow");
+                                       if(uclass != "") {
+                                               var cls = $("#c"+v).attr('class');
+                                               if( cls == undefined)
+                                                       return true;
+                                               var hiding = cls.indexOf('grouphide');
+                                               if(hiding == -1)
+                                                       $("#c"+v).addClass(uclass);
+                                       }
                                });
                                
                                break;
@@ -229,12 +247,12 @@ ACL.prototype.populate = function(data){
        var height = Math.ceil(data.tot / that.nw) * 42;
        that.list_content.height(height);
        $(data.items).each(function(){
-               html = "<div class='acl-list-item {4} {5}' id='{2}{3}'>"+that.item_tpl+"</div>";
-               html = html.format( this.photo, this.name, this.type, this.id, '', this.network );
+               html = "<div class='acl-list-item {4} {5}' title='{6}' id='{2}{3}'>"+that.item_tpl+"</div>";
+               html = html.format( this.photo, this.name, this.type, this.id, '', this.network, this.link );
                if (this.uids!=undefined) that.group_uids[this.id] = this.uids;
                //console.log(html);
                that.list_content.append(html);
        });
-       that.updateview();
+       that.update_view();
 }