diff --git a/scraping.go b/scraping.go
index a26649a..fbb8c62 100644
--- a/scraping.go
+++ b/scraping.go
@@ -74,6 +74,10 @@ func getFilterResult(filter *Filter, db *gorm.DB, urlCache map[string]string, us
{
getFilterResultSubstring(filter)
}
+ case filter.Type == "contains":
+ {
+ getFilterResultContains(filter)
+ }
case filter.Type == "math":
{
switch {
@@ -313,6 +317,25 @@ func getFilterResultSubstring(filter *Filter) {
}
}
+func getFilterResultContains(filter *Filter) {
+ substring := filter.Var1
+ invert, err := strconv.ParseBool(*filter.Var2)
+ if err != nil {
+ invert = false
+ }
+
+ for _, parent := range filter.Parents {
+ for _, result := range parent.Results {
+ log.Println(result, substring, invert, strings.Contains(result, substring))
+ if strings.Contains(result, substring) {
+ filter.Results = append(filter.Results, result)
+ } else if invert {
+ filter.Results = append(filter.Results, result)
+ }
+ }
+ }
+}
+
func getFilterResultSum(filter *Filter) {
var sum float64 = 0.0
for _, parent := range filter.Parents {
diff --git a/static/edit.js b/static/edit.js
index 76f3188..ecfbeee 100644
--- a/static/edit.js
+++ b/static/edit.js
@@ -277,6 +277,45 @@ function onTypeChange(node) {
var3Div.appendChild(var3Input);
break;
}
+ case "contains": {
+ var var1Input = document.createElement("input");
+ var1Input.name = "var1";
+ var1Input.id = "var1Input";
+ var1Input.value = var1Value;
+ var1Input.classList.add("form-control");
+ var1Label.innerHTML = "Substring";
+ var1Input.placeholder = "some";
+ var1Div.appendChild(var1Input);
+ var notSelect = document.createElement("select");
+ notSelect.name = "var2";
+ notSelect.id = "var2Input";
+ notSelect.classList.add("form-control");
+ var no = document.createElement("option");
+ no.value = "false";
+ no.innerHTML = "No";
+ notSelect.appendChild(no);
+ var yes = document.createElement("option");
+ yes.value = "true";
+ yes.innerHTML = "Yes";
+ notSelect.appendChild(yes);
+ var2Div.appendChild(notSelect);
+ var2Label.innerHTML = "Invert";
+ if (var2Value == "true" || var2Value == "false") {
+ notSelect.value = var2Value;
+ }
+ else {
+ notSelect.value = "false";
+ }
+ var var3Input = document.createElement("input");
+ var3Input.name = "var3";
+ var3Input.id = "var3Input";
+ var3Input.value = var3Value;
+ var3Input.classList.add("form-control");
+ var3Input.disabled = true;
+ var3Label.innerHTML = "-";
+ var3Div.appendChild(var3Input);
+ break;
+ }
case "math": {
var mathSelect = document.createElement("select");
mathSelect.name = "var1";
diff --git a/static/edit.ts b/static/edit.ts
index cd93f68..abd88de 100644
--- a/static/edit.ts
+++ b/static/edit.ts
@@ -266,6 +266,46 @@ function onTypeChange(node: DiagramNode | null = null){
var3Div.appendChild(var3Input);
break;
}
+ case "contains": {
+ let var1Input = document.createElement("input");
+ var1Input.name = "var1";
+ var1Input.id = "var1Input";
+ var1Input.value = var1Value;
+ var1Input.classList.add("form-control")
+ var1Label.innerHTML = "Substring";
+ var1Input.placeholder = "some";
+ var1Div.appendChild(var1Input);
+
+ let notSelect = document.createElement("select");
+ notSelect.name = "var2";
+ notSelect.id = "var2Input";
+ notSelect.classList.add("form-control");
+ let no = document.createElement("option");
+ no.value = "false"
+ no.innerHTML = "No";
+ notSelect.appendChild(no);
+ let yes = document.createElement("option");
+ yes.value = "true"
+ yes.innerHTML = "Yes";
+ notSelect.appendChild(yes);
+ var2Div.appendChild(notSelect);
+ var2Label.innerHTML = "Invert";
+ if (var2Value == "true" || var2Value == "false"){
+ notSelect.value = var2Value;
+ } else {
+ notSelect.value = "false";
+ }
+
+ let var3Input = document.createElement("input");
+ var3Input.name = "var3";
+ var3Input.id = "var3Input";
+ var3Input.value = var3Value;
+ var3Input.classList.add("form-control");
+ var3Input.disabled = true;
+ var3Label.innerHTML = "-";
+ var3Div.appendChild(var3Input);
+ break;
+ }
case "math": {
let mathSelect = document.createElement("select");
mathSelect.name = "var1";
diff --git a/templates/watch/view.html b/templates/watch/view.html
index 351f31b..8eac48b 100644
--- a/templates/watch/view.html
+++ b/templates/watch/view.html
@@ -64,6 +64,7 @@
+