Added real-time search to Ladder page.

This commit is contained in:
Brandon Cornejo committed 2014-03-04 14:39:50 -06:00
1 parent f1289e700e
commit 8c2a32d346
5 files changed
+55 -13

No files matched your search

+9 -5
View File
@@ -264,7 +264,8 @@ Currency.prototype.commands = function (data) {
break;
}
}
/*
// add currency
if (data[4] === 'add') {
if(parseInt(data[5], 10) > 0 && data[6]) {
@@ -285,6 +286,7 @@ Currency.prototype.commands = function (data) {
__self.adjust_currency('push', data[5], data[6]);
}
}
*/
}
// moderator commands
@@ -594,9 +596,6 @@ Currency.prototype.query_rank = function(data, callback) {
callback(ranks, total);
});
var file = require('fs');
file.appendFile('./../logs/error-log.txt', sql+'\n', function(d){});
};
Currency.prototype.query_top = function (data, callback) {
@@ -738,6 +737,7 @@ Currency.prototype.handout_coins = function () {
// trigger coin handout
function insert_coins() {
__self.give_coins = __self.streaming;
console.log('DATA - Inserting coins');
if (__self.give_coins) {
var time = utils.make_interval(__self.give_coins_timer);
if (time === 0) {
@@ -762,7 +762,7 @@ Currency.prototype.handout_coins = function () {
}
// execute query
__self.db.execute(sql, function () {});
__self.db.execute(sql, function () { console.log('DATA - Completed adding coins to ' + __self.viewer_list.length + ' viewers'); });
setTimeout(insert_coins, 1000);
} else {
setTimeout(insert_coins, time);
@@ -781,6 +781,7 @@ Currency.prototype.handout_coins = function () {
if(name.charAt(0) === ':') name = name.slice(1);
if (__self.viewer_list.indexOf(name) < 0 && __self.config.ignorelist.indexOf(name) < 0) {
__self.viewer_list.push(name);
console.log("[*ADD NAME*] "+name+" from /names");
}
});
}
@@ -794,6 +795,7 @@ Currency.prototype.handout_coins = function () {
}
if (__self.viewer_list.indexOf(viewer) < 0 && __self.config.ignorelist.indexOf(viewer) < 0) {
__self.viewer_list.push(viewer);
console.log("[*ADD NAME*] "+viewer+" from JOIN");
}
}
@@ -807,6 +809,7 @@ Currency.prototype.handout_coins = function () {
var viewer_idx = __self.viewer_list.indexOf(viewer);
if (viewer_idx >= 0) {
__self.viewer_list.splice(viewer_idx);
console.log("[*DEL NAME*] "+viewer+" from PART");
}
}
@@ -819,6 +822,7 @@ Currency.prototype.handout_coins = function () {
}
if (__self.viewer_list.indexOf(viewer) < 0 && __self.config.ignorelist.indexOf(viewer) < 0) {
__self.viewer_list.push(viewer);
console.log("[*ADD NAME*] "+viewer+" from CHAT");
}
if (__self.active_list.indexOf(viewer) < 0) {
__self.active_list.push(viewer);
+14 -1
View File
@@ -46,10 +46,23 @@ WEB.prototype.start = function () {
slogan: __self.slogan,
logo: __self.logo,
twitter: __self.twitter,
rows: rows
rows: rows,
});
});
});
__self.srv.get('/api/test', function(req, res) {
res.send("Hey, its Potatr. This data was pulled from the web.");
});
__self.srv.all('/api/data', function(req, res) {
sql = 'SELECT * FROM viewers ORDER BY points DESC;';
__self.db.execute(sql, function(rows) {
ladder_data = new Object();
rows.forEach(function(element, index, array){
ladder_data[element.user] = element.points;
});
res.send(ladder_data);
});
});
__self.srv.listen(__self.port);
console.log('Started website at '+__self.port);