TODO |
------+
Moderation features:
- * Lista righe di chat
+ * First and incremental list population
+ * Ban per nick/sessione/IP & calculation
+
* Richiesta di verifica
- * Ban per nick/sessione/IP
* Silent cancer behaviour management
+DONE * Manage list update (remove too old lines)
DONE * Select row
DONE * Filtra per tavolo e/o room
DONE * BUG: after disable/enable moderation filters stop to work
+DONE * Lista righe di chat
- moderation
. turn off moderation when moder win is closed or if window creation fails
{
var tr, td, date;
+ date = new Date();
+
this.time = item_ar[0];
this.usrid = item_ar[1];
this.table = item_ar[2];
this.name = item_ar[3];
this.cont = item_ar[4];
- date = new Date();
+ this.loctm = date.getTime();
+
date.setTime(this.time * 1000);
tr = document.createElement("tr");
}
ModerateItem.prototype = {
- time: 0,
+ time: 0, // (sec)
+ loctm: 0, // (msec)
usrid: 0,
table: -1,
name: "",
room_show: true,
table_show: -1,
+ // max_dt: 1800000, // (msec) maximum delta between current and line time
+ max_dt: 15000, // (msec) FIXME: DEV VERSION maximum delta between current and line time
+
cur: -1,
disable: function () {
add: function(item) {
var mi;
+ this.item_gc();
+
mi = new ModerateItem(item);
mi.tr.className = 'normal';
this.table.appendChild(mi.tr_get());
},
+ item_remove: function(idx) {
+ var old;
+
+ old = this.item.splice(idx,1);
+
+ if (!old[0].hide)
+ this.table.removeChild(old[0].tr_get());
+
+ delete old;
+ }
+
+ // moderation items garbage collector: after this.max_dt a line is removed
+ item_gc: function() {
+ var date, time;
+
+ date = new Date();
+ time = date.getTime();
+
+ for (i = 0 ; i < this.item.length ; i++) {
+ if (time - this.item[i].loctm > this.max_dt) {
+ this.item_remove(i);
+ i--;
+ }
+ }
+ },
+
row_select: function(mi) {
for (i = 0 ; i < this.item.length ; i++) {
if (this.item[i] == mi) {