mirror of https://github.com/calzoneman/sync.git
Fix #175
This commit is contained in:
parent
072695995e
commit
223f18a556
13
user.js
13
user.js
|
@ -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 = {};
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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("");
|
||||
});
|
||||
})();
|
||||
|
|
Loading…
Reference in New Issue