removed tree stuff
This commit is contained in:
parent
7064e04bbb
commit
71afae411c
7 changed files with 0 additions and 306 deletions
8
main.go
8
main.go
|
@ -140,10 +140,6 @@ func (web Web) updateQuery(c *gin.Context) {
|
||||||
c.Redirect(http.StatusSeeOther, fmt.Sprintf("/query/edit/%d", +query.ID))
|
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) {
|
func passiveBot(bot *tgbotapi.BotAPI) {
|
||||||
u := tgbotapi.NewUpdate(0)
|
u := tgbotapi.NewUpdate(0)
|
||||||
u.Timeout = 60
|
u.Timeout = 60
|
||||||
|
@ -211,8 +207,6 @@ func main() {
|
||||||
templates.AddFromFiles("viewWatch", "templates/base.html", "templates/viewWatch.html")
|
templates.AddFromFiles("viewWatch", "templates/base.html", "templates/viewWatch.html")
|
||||||
templates.AddFromFiles("editQuery", "templates/base.html", "templates/editQuery.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")
|
templates.AddFromFiles("500", "templates/base.html", "templates/500.html")
|
||||||
router.HTMLRender = templates
|
router.HTMLRender = templates
|
||||||
|
|
||||||
|
@ -227,7 +221,5 @@ func main() {
|
||||||
router.POST("/query/update", web.updateQuery)
|
router.POST("/query/update", web.updateQuery)
|
||||||
router.POST("/filter/create/", web.createFilter)
|
router.POST("/filter/create/", web.createFilter)
|
||||||
|
|
||||||
router.GET("/watch/tree/", web.watchTree)
|
|
||||||
|
|
||||||
router.Run("0.0.0.0:8080")
|
router.Run("0.0.0.0:8080")
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
|
||||||
});
|
|
|
@ -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();
|
|
||||||
});
|
|
|
@ -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();
|
|
||||||
}
|
|
|
@ -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();
|
|
||||||
}
|
|
|
@ -19,41 +19,4 @@
|
||||||
|
|
||||||
.pointer {
|
.pointer {
|
||||||
cursor: 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;
|
|
||||||
}
|
}
|
|
@ -1,60 +0,0 @@
|
||||||
{{define "content"}}
|
|
||||||
|
|
||||||
<div class="sec1">
|
|
||||||
<div class="svg-container">
|
|
||||||
<canvas id="node-canvas" width="10000" height="10000">
|
|
||||||
|
|
||||||
</canvas>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="card node-card">
|
|
||||||
<div class="card-header text-center">
|
|
||||||
<div class="h5">Tweakers LG C2 42"</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
https://tweakers.net/pricewatch/1799060/lg-c2-42-inch-donkerzilveren-voet-zwart.html
|
|
||||||
</div>
|
|
||||||
<div class="node-inputs">
|
|
||||||
<div class="node-input">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="node-outputs">
|
|
||||||
<div class="node-output">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card node-card">
|
|
||||||
<div class="card-header text-center">
|
|
||||||
<div class="h5">XPath</div>
|
|
||||||
</div>
|
|
||||||
<div class="card-header text-center">
|
|
||||||
<code>//td[@class='shop-price']//a </code>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="node-inputs">
|
|
||||||
<div class="node-input">
|
|
||||||
Input
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="node-outputs">
|
|
||||||
<div class="node-output">
|
|
||||||
Output
|
|
||||||
</div>
|
|
||||||
<div class="node-output">
|
|
||||||
Output
|
|
||||||
</div>
|
|
||||||
<div class="node-output">
|
|
||||||
Output
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
{{define "scripts"}}
|
|
||||||
<script src="/static/graph.js"></script>
|
|
||||||
{{end}}
|
|
Loading…
Add table
Reference in a new issue