From a1862496a9ff436b05ddf916721466291eb946b1 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Wed, 5 Jun 2013 16:49:54 -0400 Subject: [PATCH] Implement #163 --- channel.js | 13 +++++++++---- www/assets/js/callbacks.js | 1 + www/assets/js/client.js | 3 ++- www/channel.html | 5 +++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/channel.js b/channel.js index af6ec42f..2e19e294 100644 --- a/channel.js +++ b/channel.js @@ -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", "$1"), @@ -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, "$1"); continue; } diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js index 315f5fcf..b560d72d 100644 --- a/www/assets/js/callbacks.js +++ b/www/assets/js/callbacks.js @@ -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() != "") { $("") diff --git a/www/assets/js/client.js b/www/assets/js/client.js index dcf7af82..336625b4 100644 --- a/www/assets/js/client.js +++ b/www/assets/js/client.js @@ -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); }); diff --git a/www/channel.html b/www/channel.html index b3acf39e..7de2fc89 100644 --- a/www/channel.html +++ b/www/channel.html @@ -209,6 +209,11 @@ Show channel publicly +
+