forked from GitHub/dbot
Add stats to userlist [#117]
This commit is contained in:
parent
e36d99a6af
commit
292b917527
@ -33,26 +33,27 @@ var pages = function(dbot) {
|
|||||||
if(channelUsers[i] == dbot.config.name){
|
if(channelUsers[i] == dbot.config.name){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var user = dbot.api.stats.getUserStats(connection, channelUsers[i], channel);
|
||||||
if(onlineNicks.hasOwnProperty(channelUsers[i])){
|
if(onlineNicks.hasOwnProperty(channelUsers[i])){
|
||||||
var user = dbot.api.users.resolveUser(connection, channelUsers[i]);
|
|
||||||
if(dbot.api.stats.isActive({'server': connection,
|
if(dbot.api.stats.isActive({'server': connection,
|
||||||
'user': user,
|
'user': channelUsers[i],
|
||||||
'channel': channel
|
'channel': channel
|
||||||
})){
|
})){
|
||||||
userData.active.push(channelUsers[i]);
|
userData.active.push(user);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
userData.inactive.push(channelUsers[i]);
|
userData.inactive.push(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
userData.offline.push(channelUsers[i]);
|
userData.offline.push(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var userSort = function(a, b){
|
var userSort = function(a, b){
|
||||||
var x = a.toLowerCase();
|
var x = a.display.toLowerCase();
|
||||||
var y = b.toLowerCase();
|
var y = b.display.toLowerCase();
|
||||||
if(x > y) return 1;
|
if(x > y) return 1;
|
||||||
if(x < y) return -1;
|
if(x < y) return -1;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -14,3 +14,12 @@ wget http://twitter.github.com/bootstrap/assets/bootstrap.zip
|
|||||||
unzip bootstrap.zip
|
unzip bootstrap.zip
|
||||||
rm bootstrap.zip
|
rm bootstrap.zip
|
||||||
```
|
```
|
||||||
|
###d3.js
|
||||||
|
```
|
||||||
|
cd depressionbot/public/
|
||||||
|
mkdir d3
|
||||||
|
cd d3
|
||||||
|
wget http://d3js.org/d3.v3.zip
|
||||||
|
unzip d3.v3.zip
|
||||||
|
rm d3.v3.zip
|
||||||
|
```
|
||||||
|
@ -14,5 +14,6 @@ html(lang='en')
|
|||||||
div#main
|
div#main
|
||||||
block content
|
block content
|
||||||
script(type="text/javascript", src="/bootstrap/js/bootstrap.min.js")
|
script(type="text/javascript", src="/bootstrap/js/bootstrap.min.js")
|
||||||
|
script(type="text/javascript", src="/d3/d3.v3.min.js")
|
||||||
script(type="text/javascript", src="/script.js")
|
script(type="text/javascript", src="/script.js")
|
||||||
|
|
||||||
|
@ -7,26 +7,62 @@ block content
|
|||||||
div#row
|
div#row
|
||||||
table.table.table-striped
|
table.table.table-striped
|
||||||
thead
|
thead
|
||||||
tr: th Users
|
tr
|
||||||
|
th Users
|
||||||
|
th Lines
|
||||||
|
th Words
|
||||||
|
th Lincent
|
||||||
|
th Verbosity
|
||||||
|
th Mentions
|
||||||
tbody
|
tbody
|
||||||
-each nick in nicks.active
|
-each nick in nicks.active
|
||||||
tr
|
tr
|
||||||
td
|
td
|
||||||
a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick)
|
a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick.primary)
|
||||||
#{nick}
|
#{nick.display}
|
||||||
span
|
span
|
||||||
span.label.label-success Active
|
span.label.label-success Active
|
||||||
|
td
|
||||||
|
#{nick.total_lines}
|
||||||
|
td
|
||||||
|
#{nick.total_words}
|
||||||
|
td
|
||||||
|
#{nick.lincent}
|
||||||
|
td
|
||||||
|
#{nick.wpl}
|
||||||
|
td
|
||||||
|
#{nick.in_mentions}
|
||||||
-each nick in nicks.inactive
|
-each nick in nicks.inactive
|
||||||
tr
|
tr
|
||||||
td
|
td
|
||||||
a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick)
|
a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick.primary)
|
||||||
#{nick}
|
#{nick.display}
|
||||||
span
|
span
|
||||||
span.label.label-important Inactive
|
span.label.label-important Inactive
|
||||||
|
td
|
||||||
|
#{nick.total_lines}
|
||||||
|
td
|
||||||
|
#{nick.total_words}
|
||||||
|
td
|
||||||
|
#{nick.lincent}
|
||||||
|
td
|
||||||
|
#{nick.wpl}
|
||||||
|
td
|
||||||
|
#{nick.in_mentions}
|
||||||
-each nick in nicks.offline
|
-each nick in nicks.offline
|
||||||
tr
|
tr
|
||||||
td
|
td
|
||||||
a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick)
|
a(href='/user/'+connection+'/'+channel.substr(1,channel.length)+'/'+nick.primary)
|
||||||
#{nick}
|
#{nick.display}
|
||||||
span
|
span
|
||||||
span.label Offline
|
span.label Offline
|
||||||
|
td
|
||||||
|
#{nick.total_lines}
|
||||||
|
td
|
||||||
|
#{nick.total_words}
|
||||||
|
td
|
||||||
|
#{nick.lincent}
|
||||||
|
td
|
||||||
|
#{nick.wpl}
|
||||||
|
td
|
||||||
|
#{nick.in_mentions}
|
||||||
|
Loading…
Reference in New Issue
Block a user