ami/src/ami.js/ts_10_user.js

41 lines
1.1 KiB
JavaScript

#include common.js
var User = (function () {
function User(id, u, c, p, v) {
if (v === void 0) { v = true; }
this.username = u;
this.id = id;
this.color = c;
this.permstr = p;
this.perms = p.split(p.indexOf("\f") < 0 ? ' ' : "\f");
this.visible = v;
}
User.prototype.EvaluatePermString = function () {
this.perms = this.permstr.split(this.permstr.indexOf("\f") < 0 ? ' ' : "\f");
};
User.prototype.getRank = function () {
return parseInt(this.perms[0]);
};
User.prototype.canModerate = function () {
return this.perms[1] == "1";
};
User.prototype.isBot = function() {
return this.id === '-1';
};
User.prototype.getAvatarUrl = function() {
if(this.isBot())
return '/images/alert.png';
return futami.get('avatar')
.replace('{resolution}', '160')
.replace('{user:id}', this.id)
.replace('{user:avatar_change}', '9001');
};
return User;
})();
var UserContext = (function () {
function UserContext() {
}
UserContext.users = {};
return UserContext;
})();