Simple config logic
This commit is contained in:
parent
401a2921c8
commit
99f146aa1d
@ -2,7 +2,7 @@
|
|||||||
<html data-bs-theme="dark">
|
<html data-bs-theme="dark">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>NeutralinoJs sample app</title>
|
<title>Cooperate Cleaner</title>
|
||||||
<link rel="stylesheet" href="styles.css">
|
<link rel="stylesheet" href="styles.css">
|
||||||
<link rel="stylesheet" href="lib/bootstrap.min.css">
|
<link rel="stylesheet" href="lib/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="lib/animate.min.css">
|
<link rel="stylesheet" href="lib/animate.min.css">
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<p class="lead mb-5">Create and manage filtering rules</p>
|
<p class="lead mb-5">Create and manage filtering rules</p>
|
||||||
|
|
||||||
<!-- CONTENT -->
|
<!-- CONTENT -->
|
||||||
<div class="d-flex justify-content-center">
|
<div class="d-flex justify-content-center" id="add-rule-btn">
|
||||||
<button class="btn btn-success mx-2">
|
<button class="btn btn-success mx-2">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-lg" viewBox="0 0 16 16">
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-plus-lg" viewBox="0 0 16 16">
|
||||||
<path fill-rule="evenodd" d="M8 2a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 8 2"/>
|
<path fill-rule="evenodd" d="M8 2a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 8 2"/>
|
||||||
@ -31,20 +31,20 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="border-bottom">
|
<tr class="border-bottom" id="rule-1">
|
||||||
<td scope="row" class="align-middle"><p class="mb-0">1</p></td>
|
<td scope="row" class="align-middle"><p class="mb-0">1</p></td>
|
||||||
<td class="align-middle"><input type="text" class="form-control" placeholder="String to replace"></td>
|
<td class="align-middle"><input type="text" class="form-control rule-input-str-input" placeholder="String to replace"></td>
|
||||||
<td class="align-middle"><input type="text" class="form-control" placeholder="Replace with"></td>
|
<td class="align-middle"><input type="text" class="form-control rule-output-str-input" placeholder="Replace with"></td>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
<label class="toggle-switch">
|
<label class="toggle-switch">
|
||||||
<input type="checkbox" checked>
|
<input class="rule-enabled-by-default-toggle" type="checkbox" checked>
|
||||||
<div class="toggle-switch-background">
|
<div class="toggle-switch-background">
|
||||||
<div class="toggle-switch-handle"></div>
|
<div class="toggle-switch-handle"></div>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
<button class="btn btn-danger">
|
<button class="btn btn-danger rule-trash-btn">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16">
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16">
|
||||||
<path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"/>
|
<path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"/>
|
||||||
<path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"/>
|
<path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"/>
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
var ruleRowTemplate = '<tr class="border-bottom" id="rule-[INDEX]">' +
|
||||||
|
' <td scope="row" class="align-middle"><p class="mb-0">[INDEX]</p></td>' +
|
||||||
|
' <td class="align-middle"><input type="text" class="form-control rule-input-str-input" placeholder="String to replace" value="[STR-TO-REPLACE]"></td>' +
|
||||||
|
' <td class="align-middle"><input type="text" class="form-control rule-output-str-input" placeholder="Replace with" value="[REPLACE-STR]"></td>' +
|
||||||
|
' <td class="align-middle">' +
|
||||||
|
' <label class="toggle-switch">' +
|
||||||
|
' <input class="rule-enabled-by-default-toggle" type="checkbox" checked>' +
|
||||||
|
' <div class="toggle-switch-background">' +
|
||||||
|
' <div class="toggle-switch-handle"></div>' +
|
||||||
|
' </div>' +
|
||||||
|
' </label>' +
|
||||||
|
' </td>' +
|
||||||
|
' <td class="align-middle">' +
|
||||||
|
' <button class="btn btn-danger rule-trash-btn">' +
|
||||||
|
' <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16">' +
|
||||||
|
' <path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"/>' +
|
||||||
|
' <path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"/>' +
|
||||||
|
' </svg>' +
|
||||||
|
' </button>' +
|
||||||
|
' </td>' +
|
||||||
|
' </tr>';
|
||||||
|
|
||||||
|
$("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;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user