From 71afae411c388ab8d84b5dd12740137288bdb2da Mon Sep 17 00:00:00 2001 From: BroodjeAap Date: Mon, 1 Aug 2022 17:19:47 +0000 Subject: [PATCH] removed tree stuff --- main.go | 8 ---- static/graph.js | 71 --------------------------------- static/graph.ts | 85 ---------------------------------------- static/script.js | 20 ---------- static/script.ts | 25 ------------ static/style.css | 37 ----------------- templates/watchTree.html | 60 ---------------------------- 7 files changed, 306 deletions(-) delete mode 100644 static/graph.js delete mode 100644 static/graph.ts delete mode 100644 templates/watchTree.html diff --git a/main.go b/main.go index 008292d..6b976ff 100644 --- a/main.go +++ b/main.go @@ -140,10 +140,6 @@ func (web Web) updateQuery(c *gin.Context) { c.Redirect(http.StatusSeeOther, fmt.Sprintf("/query/edit/%d", +query.ID)) } -func (web Web) watchTree(c *gin.Context) { - c.HTML(http.StatusOK, "tree", gin.H{}) -} - func passiveBot(bot *tgbotapi.BotAPI) { u := tgbotapi.NewUpdate(0) u.Timeout = 60 @@ -211,8 +207,6 @@ func main() { templates.AddFromFiles("viewWatch", "templates/base.html", "templates/viewWatch.html") templates.AddFromFiles("editQuery", "templates/base.html", "templates/editQuery.html") - templates.AddFromFiles("tree", "templates/base.html", "templates/watchTree.html") - templates.AddFromFiles("500", "templates/base.html", "templates/500.html") router.HTMLRender = templates @@ -227,7 +221,5 @@ func main() { router.POST("/query/update", web.updateQuery) router.POST("/filter/create/", web.createFilter) - router.GET("/watch/tree/", web.watchTree) - router.Run("0.0.0.0:8080") } diff --git a/static/graph.js b/static/graph.js deleted file mode 100644 index 69afb69..0000000 --- a/static/graph.js +++ /dev/null @@ -1,71 +0,0 @@ -var DragPosition = /** @class */ (function () { - function DragPosition(e) { - this.x = 0; - this.y = 0; - this.oldX = 0; - this.oldY = 0; - this.elem = e; - } - return DragPosition; -}()); -var position; -function startDrag(e) { - e = e || window.Event; - e.preventDefault(); - var elem = e.target; - while (!elem.classList.contains("node-card")) { - if (elem.parentElement === null) { - return; - } - elem = elem.parentElement; - } - position = new DragPosition(elem); - position.oldX = e.clientX; - position.oldY = e.clientY; - document.onmouseup = stopDrag; - document.onmousemove = dragging; -} -function dragging(e) { - e = e || window.Event; - e.preventDefault(); - position.x = position.oldX - e.clientX; - position.y = position.oldY - e.clientY; - position.oldX = e.clientX; - position.oldY = e.clientY; - position.elem.style.top = (position.elem.offsetTop - position.y) + "px"; - position.elem.style.left = (position.elem.offsetLeft - position.x) + "px"; -} -function stopDrag(e) { - document.onmouseup = null; - document.onmousemove = null; -} -function log(e) { - e.stopPropagation(); - console.log(e.target); -} -document.addEventListener("DOMContentLoaded", function (event) { - var node_cards = document.getElementsByClassName("node-card"); - [].forEach.call(node_cards, function (node_card) { - node_card.onmousedown = startDrag; - }); - var inputs = document.getElementsByClassName("node-input"); - [].forEach.call(inputs, function (input) { - input.onmousedown = log; - }); - var outputs = document.getElementsByClassName("node-output"); - [].forEach.call(outputs, function (output) { - output.onmousedown = log; - }); - var c = document.getElementById("node-canvas"); - var ctx = c.getContext("2d"); - if (ctx === null) { - return; - } - ctx.beginPath(); - ctx.moveTo(50, 50); - ctx.lineTo(1000, 1000); - ctx.lineWidth = 10; - // set line color - ctx.strokeStyle = '#ff0000'; - ctx.stroke(); -}); diff --git a/static/graph.ts b/static/graph.ts deleted file mode 100644 index 5f751c1..0000000 --- a/static/graph.ts +++ /dev/null @@ -1,85 +0,0 @@ -class DragPosition { - x: number; - y: number; - oldX: number; - oldY: number; - elem: HTMLElement; - - constructor(e: HTMLElement){ - this.x = 0; - this.y = 0; - this.oldX = 0; - this.oldY = 0; - this.elem = e; - } -} -var position: DragPosition; - -function startDrag(e: MouseEvent){ - e = e || window.Event - e.preventDefault() - var elem = e.target as HTMLElement; - while (!elem.classList.contains("node-card")){ - if (elem.parentElement === null){ - return - } - elem = elem.parentElement; - } - position = new DragPosition(elem); - position.oldX = e.clientX; - position.oldY = e.clientY; - document.onmouseup = stopDrag; - document.onmousemove = dragging; -} - -function dragging(e: MouseEvent){ - e = e || window.Event - e.preventDefault(); - - position.x = position.oldX - e.clientX; - position.y = position.oldY - e.clientY; - position.oldX = e.clientX; - position.oldY = e.clientY; - position.elem.style.top = `${(position.elem.offsetTop - position.y)}px`; - position.elem.style.left = `${(position.elem.offsetLeft - position.x)}px`; -} - -function stopDrag(e: MouseEvent){ - document.onmouseup = null; - document.onmousemove = null; -} - -function log(e: MouseEvent){ - e.stopPropagation(); - console.log(e.target); -} - -document.addEventListener("DOMContentLoaded", function(event) { - let node_cards = document.getElementsByClassName("node-card"); - [].forEach.call(node_cards, function(node_card: HTMLElement) { - node_card.onmousedown = startDrag; - }); - - let inputs = document.getElementsByClassName("node-input"); - [].forEach.call(inputs, function(input: HTMLElement){ - input.onmousedown = log; - }); - let outputs = document.getElementsByClassName("node-output"); - [].forEach.call(outputs, function(output: HTMLElement){ - output.onmousedown = log; - }); - - let c = document.getElementById("node-canvas") as HTMLCanvasElement; - let ctx = c.getContext("2d"); - if (ctx === null){ - return - } - ctx.beginPath(); - ctx.moveTo(50, 50); - ctx.lineTo(1000, 1000); - ctx.lineWidth = 10; - - // set line color - ctx.strokeStyle = '#ff0000'; - ctx.stroke(); -}); \ No newline at end of file diff --git a/static/script.js b/static/script.js index 47914a6..e69de29 100644 --- a/static/script.js +++ b/static/script.js @@ -1,20 +0,0 @@ -function submitNewUrlForm() { - var nameFrom = document.getElementById("urlNameFrom"); - var nameTo = document.getElementById("urlNameTo"); - nameTo.value = nameFrom.value; - var urlFrom = document.getElementById("urlFrom"); - var urlTo = document.getElementById("urlTo"); - urlTo.value = urlFrom.value; - var newUrlForm = document.getElementById("newUrlForm"); - newUrlForm.submit(); -} -function submitNewQueryForm() { - var queryNameFrom = document.getElementById("queryNameFrom"); - var queryNameTo = document.getElementById("queryNameTo"); - queryNameTo.value = queryNameFrom.value; - var queryFrom = document.getElementById("queryFrom"); - var queryTo = document.getElementById("queryTo"); - queryTo.value = queryFrom.value; - var newQueryForm = document.getElementById("newQueryForm"); - newQueryForm.submit(); -} diff --git a/static/script.ts b/static/script.ts index 6573607..e69de29 100644 --- a/static/script.ts +++ b/static/script.ts @@ -1,25 +0,0 @@ -function submitNewUrlForm(){ - let nameFrom = document.getElementById("urlNameFrom") as HTMLInputElement; - let nameTo = document.getElementById("urlNameTo") as HTMLInputElement; - nameTo.value = nameFrom.value; - - let urlFrom = document.getElementById("urlFrom") as HTMLInputElement; - let urlTo = document.getElementById("urlTo") as HTMLInputElement; - urlTo.value = urlFrom.value; - - let newUrlForm = document.getElementById("newUrlForm") as HTMLFormElement; - newUrlForm.submit(); -} - -function submitNewQueryForm() { - let queryNameFrom = document.getElementById("queryNameFrom") as HTMLInputElement; - let queryNameTo = document.getElementById("queryNameTo") as HTMLInputElement; - queryNameTo.value = queryNameFrom.value; - - let queryFrom = document.getElementById("queryFrom") as HTMLInputElement; - let queryTo = document.getElementById("queryTo") as HTMLInputElement; - queryTo.value = queryFrom.value; - - let newQueryForm = document.getElementById("newQueryForm") as HTMLFormElement; - newQueryForm.submit(); -} \ No newline at end of file diff --git a/static/style.css b/static/style.css index edc1974..7d99361 100644 --- a/static/style.css +++ b/static/style.css @@ -19,41 +19,4 @@ .pointer { cursor: pointer; -} - -.node-card { - width: 18rem; - position: absolute; -} - -.node-inputs { - float: left; -} - -.node-input { - background-color: red; - -webkit-user-select:none; - -moz-user-select:-moz-none; - -ms-user-select:none; - user-select:none; - cursor: pointer; -} - -.node-outputs { - float: right; - -} - -.node-output { - margin-bottom: 1rem; - background-color: red; - -webkit-user-select:none; - -moz-user-select:-moz-none; - -ms-user-select:none; - user-select:none; - cursor: pointer; -} - -#node-canvas { - position: absolute; } \ No newline at end of file diff --git a/templates/watchTree.html b/templates/watchTree.html deleted file mode 100644 index 1fe0139..0000000 --- a/templates/watchTree.html +++ /dev/null @@ -1,60 +0,0 @@ -{{define "content"}} - -
-
- - - -
-
- - -
-
-
Tweakers LG C2 42"
-
-
- https://tweakers.net/pricewatch/1799060/lg-c2-42-inch-donkerzilveren-voet-zwart.html -
-
-
-
-
-
-
-
-
-
- -
-
-
XPath
-
-
- //td[@class='shop-price']//a -
-
-
-
- Input -
-
-
-
- Output -
-
- Output -
-
- Output -
-
-
-
- -{{end}} - -{{define "scripts"}} - -{{end}} \ No newline at end of file