From 99f146aa1de49726ddf7a7681dad44f7211446d7 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 18 May 2024 12:34:26 +0200 Subject: [PATCH] Simple config logic --- src/index.html | 2 +- src/views/config/config.html | 12 +++++----- src/views/config/config.js | 46 ++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 7 deletions(-) diff --git a/src/index.html b/src/index.html index a0717d2..87836fb 100644 --- a/src/index.html +++ b/src/index.html @@ -2,7 +2,7 @@ - NeutralinoJs sample app + Cooperate Cleaner diff --git a/src/views/config/config.html b/src/views/config/config.html index e983029..9228be2 100644 --- a/src/views/config/config.html +++ b/src/views/config/config.html @@ -7,7 +7,7 @@

Create and manage filtering rules

-
+
' + + ' ' + + ' '; + +$("document").ready(function() { + $("#add-rule-btn").click(function() { + appendRow(generateRowTemplate("", "", true)); + }); +}); + +function appendRow(rowTemplate) { + $(".table").append(rowTemplate); + $(".rule-trash-btn").click(function() { + $(this).closest("tr").remove(); + }); +} + + +function generateRowTemplate(str, outputStr, enabled) { + var row = ruleRowTemplate; + row = row.replaceAll("[INDEX]", $(".table tr").length); + row = row.replace("[STR-TO-REPLACE]", str); + row = row.replace("[REPLACE-STR]", outputStr); + if (!enabled) { + row = row.replace("checked", ""); + } + return row; +} \ No newline at end of file