(function(){DUI.SnConnector=function(b,a,c){this.connectPopup=this.disconnectBtn=this.connectBtn=a=null;this.context=$(b);this.invitationCode=c;this.snName=this.context.attr("rel");this.attachDOM();this.connectMode=!a&&a=="register/login"?"register":"addSnConnection";this.context.removeClass("loading")};DUI.SnConnector.prototype.setState=function(b){switch(b){case "connected":this.disconnectBtn.show();this.connectBtn.hide();break;case "disconnected":default:this.disconnectBtn.hide();this.connectBtn.show();
break}};DUI.SnConnector.prototype.attachDOM=function(){var b=this,a=this.context;this.connectBtn=a.find(".btn.auth");this.disconnectBtn=a.find(".btn.revokeauth");this.connectBtn.click(function(){DUI.Auth.connect({network:b.snName,connectMode:"addSnConnection"})});this.disconnectBtn.click(function(){DUI.Auth.disconnect(b.snName,a)});a.bind("digg:deauthorized",function(){b.setState("disconnected")})}})();
