mirror of https://github.com/calzoneman/sync.git
Implement #163
This commit is contained in:
parent
33744da634
commit
a1862496a9
13
channel.js
13
channel.js
|
@ -76,7 +76,8 @@ var Channel = function(name) {
|
||||||
customcss: "",
|
customcss: "",
|
||||||
customjs: "",
|
customjs: "",
|
||||||
chat_antiflood: false,
|
chat_antiflood: false,
|
||||||
show_public: false
|
show_public: false,
|
||||||
|
enable_link_regex: true
|
||||||
};
|
};
|
||||||
this.filters = [
|
this.filters = [
|
||||||
new Filter("monospace", "`([^`]+)`", "g", "<code>$1</code>"),
|
new Filter("monospace", "`([^`]+)`", "g", "<code>$1</code>"),
|
||||||
|
@ -1465,8 +1466,12 @@ Channel.prototype.trySetLock = function(user, data) {
|
||||||
Channel.prototype.updateFilter = function(filter) {
|
Channel.prototype.updateFilter = function(filter) {
|
||||||
var found = false;
|
var found = false;
|
||||||
for(var i = 0; i < this.filters.length; i++) {
|
for(var i = 0; i < this.filters.length; i++) {
|
||||||
if(this.filters[i].name == filter.name
|
if(this.filters[i].name == "" && filter.name == ""
|
||||||
&& this.filters[i].source == filter.source) {
|
&& this.filters[i].source == filter.source) {
|
||||||
|
found = true;
|
||||||
|
this.filters[i] = filter;
|
||||||
|
}
|
||||||
|
else if(filter.name != "" && this.filters[i].name == filter.name) {
|
||||||
found = true;
|
found = true;
|
||||||
this.filters[i] = filter;
|
this.filters[i] = filter;
|
||||||
}
|
}
|
||||||
|
@ -1641,7 +1646,7 @@ Channel.prototype.filterMessage = function(msg) {
|
||||||
var subs = msg.split(link);
|
var subs = msg.split(link);
|
||||||
// Apply other filters
|
// Apply other filters
|
||||||
for(var j = 0; j < subs.length; j++) {
|
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>");
|
subs[j] = subs[j].replace(link, "<a href=\"$1\" target=\"_blank\">$1</a>");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,6 +204,7 @@ Callbacks = {
|
||||||
$("#opt_customjs").val(opts.customjs);
|
$("#opt_customjs").val(opts.customjs);
|
||||||
$("#opt_chat_antiflood").prop("checked", opts.chat_antiflood);
|
$("#opt_chat_antiflood").prop("checked", opts.chat_antiflood);
|
||||||
$("#opt_show_public").prop("checked", opts.show_public);
|
$("#opt_show_public").prop("checked", opts.show_public);
|
||||||
|
$("#opt_enable_link_regex").prop("checked", opts.enable_link_regex);
|
||||||
$("#customCss").remove();
|
$("#customCss").remove();
|
||||||
if(opts.customcss.trim() != "") {
|
if(opts.customcss.trim() != "") {
|
||||||
$("<link/>")
|
$("<link/>")
|
||||||
|
|
|
@ -366,7 +366,8 @@ $("#opt_submit").click(function() {
|
||||||
customcss: css,
|
customcss: css,
|
||||||
customjs: $("#opt_customjs").val(),
|
customjs: $("#opt_customjs").val(),
|
||||||
chat_antiflood: $("#opt_chat_antiflood").prop("checked"),
|
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);
|
socket.emit("channelOpts", opts);
|
||||||
});
|
});
|
||||||
|
|
|
@ -209,6 +209,11 @@
|
||||||
<input type="checkbox" id="opt_show_public">
|
<input type="checkbox" id="opt_show_public">
|
||||||
Show channel publicly
|
Show channel publicly
|
||||||
</label>
|
</label>
|
||||||
|
<br>
|
||||||
|
<label class="checkbox">
|
||||||
|
<input type="checkbox" id="opt_enable_link_regex">
|
||||||
|
Convert URLs to links in chat messages
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="span10">
|
<div class="span10">
|
||||||
|
|
Loading…
Reference in New Issue