nicolive-api
Version:
api client for live.nicovideo.jp
66 lines (54 loc) • 2.1 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Comment = function () {
function Comment(element, room) {
_classCallCheck(this, Comment);
this.attr = element.attr();
this.text = element.text();
this.room = room;
}
_createClass(Comment, [{
key: 'isEject',
value: function isEject() {
return this.isSystem() && this.text.includes('/hb ifseetno');
}
}, {
key: 'isUser',
value: function isUser() {
var premium = this.attr.premium;
return !premium || premium === '1';
}
}, {
key: 'isSystem',
value: function isSystem() {
var premium = this.attr.premium;
return premium === '2' || premium === '3' || premium === '6';
}
}, {
key: 'isBSP',
value: function isBSP() {
return this.attr.premium === '7';
}
}, {
key: 'isOrigin',
value: function isOrigin() {
var origin = this.attr.origin;
return !origin;
}
}, {
key: 'userIcon',
get: function get() {
var _attr = this.attr,
anonymity = _attr.anonymity,
user_id = _attr.user_id;
if (!anonymity && user_id) return 'http://usericon.nimg.jp/usericon/' + user_id.slice(0, 2) + '/' + user_id + '.jpg';
return 'http://uni.res.nimg.jp/img/user/thumb/blank.jpg';
}
}]);
return Comment;
}();
exports.default = Comment;
;