This commit is contained in:
calzoneman 2013-06-05 16:49:54 -04:00
parent 33744da634
commit a1862496a9
4 changed files with 17 additions and 5 deletions

View File

@ -76,7 +76,8 @@ var Channel = function(name) {
customcss: "",
customjs: "",
chat_antiflood: false,
show_public: false
show_public: false,
enable_link_regex: true
};
this.filters = [
new Filter("monospace", "`([^`]+)`", "g", "<code>$1</code>"),
@ -1465,8 +1466,12 @@ Channel.prototype.trySetLock = function(user, data) {
Channel.prototype.updateFilter = function(filter) {
var found = false;
for(var i = 0; i < this.filters.length; i++) {
if(this.filters[i].name == filter.name
&& this.filters[i].source == filter.source) {
if(this.filters[i].name == "" && filter.name == ""
&& this.filters[i].source == filter.source) {
found = true;
this.filters[i] = filter;
}
else if(filter.name != "" && this.filters[i].name == filter.name) {
found = true;
this.filters[i] = filter;
}
@ -1641,7 +1646,7 @@ Channel.prototype.filterMessage = function(msg) {
var subs = msg.split(link);
// Apply other filters
for(var j = 0; j < subs.length; j++) {
if(subs[j].match(link)) {
if(this.opts.enable_link_regex && subs[j].match(link)) {
subs[j] = subs[j].replace(link, "<a href=\"$1\" target=\"_blank\">$1</a>");
continue;
}

View File

@ -204,6 +204,7 @@ Callbacks = {
$("#opt_customjs").val(opts.customjs);
$("#opt_chat_antiflood").prop("checked", opts.chat_antiflood);
$("#opt_show_public").prop("checked", opts.show_public);
$("#opt_enable_link_regex").prop("checked", opts.enable_link_regex);
$("#customCss").remove();
if(opts.customcss.trim() != "") {
$("<link/>")

View File

@ -366,7 +366,8 @@ $("#opt_submit").click(function() {
customcss: css,
customjs: $("#opt_customjs").val(),
chat_antiflood: $("#opt_chat_antiflood").prop("checked"),
show_public: $("#opt_show_public").prop("checked")
show_public: $("#opt_show_public").prop("checked"),
enable_link_regex: $("#opt_enable_link_regex").prop("checked")
};
socket.emit("channelOpts", opts);
});

View File

@ -209,6 +209,11 @@
<input type="checkbox" id="opt_show_public">
Show channel publicly
</label>
<br>
<label class="checkbox">
<input type="checkbox" id="opt_enable_link_regex">
Convert URLs to links in chat messages
</label>
</div>
<div class="span10">