diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js
index f624966a..14764a80 100644
--- a/www/assets/js/callbacks.js
+++ b/www/assets/js/callbacks.js
@@ -114,12 +114,10 @@ Callbacks = {
}, 100);
return;
}
- if(tbl.children().length > 1) {
- $(tbl.children()[1]).remove();
- }
+ tbl.find(".filter-row").remove();
for(var i = 0; i < entries.length; i++) {
var f = entries[i];
- var tr = $("
").appendTo(tbl);
+ var tr = $(" ").appendTo(tbl).addClass("filter-row");
var remove = $(" ").addClass("btn btn-mini btn-danger")
.appendTo($(" ").appendTo(tr));
$(" ").addClass("icon-trash").appendTo(remove);
diff --git a/www/assets/js/channelsettings.js b/www/assets/js/channelsettings.js
index ec62a4ad..49df1834 100644
--- a/www/assets/js/channelsettings.js
+++ b/www/assets/js/channelsettings.js
@@ -81,4 +81,31 @@
js: $("#jstext").val()
});
});
+
+ $("#newfilter_submit").click(function() {
+ var re = $("#newfilter_regex").val();
+ var flags = $("#newfilter_flags").val();
+ try {
+ new RegExp(re, flags);
+ }
+ catch(e) {
+ makeAlert("Invalid Regex", e, "alert-error")
+ .insertAfter($("#filteredit form"));
+ return;
+ }
+
+ socket.emit("updateFilter", {
+ name: $("#newfilter_name").val(),
+ source: re,
+ flags: flags,
+ replace: $("#newfilter_replace").val(),
+ filterlinks: $("#newfilter_filterlinks").prop("checked"),
+ active: true
+ });
+
+ $("#newfilter_name").val("");
+ $("#newfilter_regex").val("");
+ $("#newfilter_flags").val("");
+ $("#newfilter_replace").val("");
+ });
})();
diff --git a/www/channeloptions.html b/www/channeloptions.html
index 148d1dd7..d8910c3b 100644
--- a/www/channeloptions.html
+++ b/www/channeloptions.html
@@ -92,7 +92,7 @@
Filters will be processed in the order that they are listed here. Click and drag a row to rearrange the order. Click a regex, flags, or replacement field to edit a filter. Changes are automatically saved when you finish editing.
-
+
Delete
@@ -105,6 +105,54 @@
+ Add Filter
+
Max 20KB. If you need more space, host the file externally and use the External CSS option