-
Notifications
You must be signed in to change notification settings - Fork 0
/
arbol.js
76 lines (71 loc) · 2.46 KB
/
arbol.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
document.getElementById("exec_tree")
.addEventListener("keyup", function(event) {
event.preventDefault();
if (event.keyCode === 13) {
document.getElementById("myButton").click();
}
});
function buttonCodeTree()
{
let text = document.getElementById("exec_tree").value;
let data = {element: text};
fetch("http://127.0.0.1:5005/exec", {
method: "POST",
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(data)
},
{
mode: 'no-cors',
method: 'post',
url: `http://127.0.0.1:5005/`,
credentials: 'include'
}
).then(res => {
window.location.reload();
console.log("Request complete! response:", res);
});
}
//word graph
document.getElementById("exec_word")
.addEventListener("keyup", function(event) {
event.preventDefault();
if (event.keyCode === 13) {
document.getElementById("myWordButton").click();
}
});
function buttonCodeWord()
{
let text = document.getElementById("exec_word").value;
let data = {element: text};
fetch("http://127.0.0.1:5000/exec", {
method: "POST",
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(data)
},
{
mode: 'no-cors',
method: 'post',
url: `http://127.0.0.1:5000/`,
credentials: 'include'
}
).then(res => {
window.location.reload();
console.log("Request complete! response:", res);
});
}
//animation
document.addEventListener("click",function (e) {
var body = document.querySelector('body');
var bubbles = document.createElement("span");
var x = e.offsetX;
var y = e.offsetY;
bubbles.style.left = x+'px';
bubbles.style.top = y+'px';
var size = Math.random() * 1000;
bubbles.style.width = 20 + size+'px';
bubbles.style.height = 20 + size+'px';
body.appendChild(bubbles);
setTimeout(function () {
bubbles.remove();
},4000)
})