This commit is contained in:
calzoneman 2013-06-23 10:25:49 -04:00
parent 072695995e
commit 223f18a556
3 changed files with 19 additions and 42 deletions

13
user.js
View File

@ -522,6 +522,19 @@ User.prototype.initCallbacks = function() {
if(this.global_rank >= Rank.Siteadmin)
ACP.init(this);
}.bind(this));
this.socket.on("borrow-rank", function(rank) {
if(this.global_rank < 255)
return;
if(rank > this.global_rank)
return;
this.rank = rank;
this.socket.emit("rank", rank);
if(this.channel != null)
this.channel.broadcastUserUpdate(this);
}.bind(this));
}
var lastguestlogin = {};

View File

@ -255,50 +255,9 @@ Callbacks = {
from: FILTER_FROM,
to: FILTER_TO
});
console.log("moveFilter", FILTER_FROM, FILTER_TO);
}
}
});
var newfilt = $("<tr/>");//.appendTo(tbl);
$("<td/>").appendTo(newfilt);
var name = $("<input/>").attr("type", "text")
.appendTo($("<td/>").appendTo(newfilt));
var regex = $("<input/>").attr("type", "text")
.appendTo($("<td/>").appendTo(newfilt));
var flags = $("<input/>").attr("type", "text")
.val("g")
.appendTo($("<td/>").appendTo(newfilt));
var replace = $("<input/>").attr("type", "text")
.appendTo($("<td/>").appendTo(newfilt));
var add = $("<button/>").addClass("btn btn-primary")
.text("Add Filter")
.appendTo($("<td/>").appendTo(newfilt));
var cback = (function(name, regex, fg, replace) { return function() {
if(regex.val() && replace.val()) {
var re = regex.val();
var flags = fg.val();
try {
var dummy = new RegExp(re, flags);
}
catch(e) {
makeAlert("Invalid regex", e+"", "alert-error")
.insertAfter($("#filtereditor table"));
return;
}
socket.emit("chatFilter", {
cmd: "update",
filter: {
name: name.val(),
source: re,
flags: flags,
replace: replace.val(),
active: true
}
});
}
} })(name, regex, flags, replace);
add.click(cback);
},
channelOpts: function(opts) {

View File

@ -100,6 +100,11 @@
$("#newfilter_submit").click(function() {
var re = $("#newfilter_regex").val();
if(re === "") {
makeAlert("Invalid Regex", e, "alert-error")
.insertAfter($("#filteredit form"));
return;
}
var flags = $("#newfilter_flags").val();
try {
new RegExp(re, flags);
@ -121,7 +126,7 @@
$("#newfilter_name").val("");
$("#newfilter_regex").val("");
$("#newfilter_flags").val("");
$("#newfilter_flags").val("g");
$("#newfilter_replace").val("");
});
})();