-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinkeditor.html
198 lines (163 loc) · 6.07 KB
/
linkeditor.html
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--
TRASH MAGIC
EVERYTHING IS PHYSICAL
EVERYTHING IS FRACTAL
EVERYTHING IS RECURSIVE
NO MONEY
NO MINING
NO PROPERTY
LOOK AT THE FUNGI
LOOK AT THE INSECTS
LANGUAGE IS HOW THE MIND PARSES REALITY
All Code, text, art, media, technology, and ideas CC0 PUBLIC DOMAIN
-->
<link href="data:image/x-icon;base64,AAABAAEAEBAQAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAA4A8AAO/vAADqrwAA6q8AAOqvAADqrwAA6q8AAOqvAADqrwAA7+8AAMAHAADf9wAAwAcAAPu/AAD4PwAA" rel="icon" type="image/x-icon" />
<!--Stop Google:-->
<META NAME="robots" CONTENT="noindex,nofollow">
<script src = "trashmagic.js"></script>
<title>TRASHNET LINK EDITOR</title>
</head>
<body>
<a id = "homelink" href = "index.html">HOME</a>
<table id = "maintable">
</table>
<div id = "links"></div>
<script>
maintable = document.getElementById("maintable");
links = [];
var httpc2 = new XMLHttpRequest();
httpc2.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("links").innerHTML = this.responseText;
links = document.getElementById("links").getElementsByTagName("A");
drawtable();
}
};
httpc2.open("GET", "fileloader.php?filename=links.html", true);
httpc2.send();
function drawtable(){
maintable.innerHTML = "";
for(var index = 0;index < links.length;index++){
var newtr = document.createElement("TR");
maintable.appendChild(newtr);
newtr.id = "link" + index.toString();
var newtd = document.createElement("TD");
newtd.innerHTML = "TEXT:";
newtr.appendChild(newtd);
var newtd = document.createElement("TD");
var newinput = document.createElement("INPUT");
newtd.appendChild(newinput);
newinput.value = links[index].innerHTML;
newinput.onchange = function(){
linkindex = parseInt(this.parentNode.parentNode.id.substring(4));
links[linkindex].innerHTML = this.value;
savelinks();
}
newtr.appendChild(newtd);
var newtd = document.createElement("TD");
newtd.innerHTML = "URL:";
newtr.appendChild(newtd);
var newtd = document.createElement("TD");
var newinput = document.createElement("INPUT");
newinput.value = links[index].href;
newinput.onchange = function(){
linkindex = parseInt(this.parentNode.parentNode.id.substring(4));
links[linkindex].href = this.value;
savelinks();
}
newtd.appendChild(newinput);
newtr.appendChild(newtd);
var newtd = document.createElement("TD");
newtd.innerHTML = "COPY";
newtd.className = "button";
newtr.appendChild(newtd);
newtd.onclick = function(){
//copy
linkindex = parseInt(this.parentNode.id.substring(4));
var newa = document.createElement("A");
newa.innerHTML = links[linkindex].innerHTML;
newa.href = links[linkindex].href;
document.getElementById("links").insertBefore(newa,links[linkindex]);
links = document.getElementById("links").getElementsByTagName("A");
drawtable();
savelinks();
}
var newtd = document.createElement("TD");
newtd.innerHTML = "DELETE";
newtd.className = "button";
newtr.appendChild(newtd);
newtd.onclick = function(){
//delete
if(links.length > 1){
linkindex = parseInt(this.parentNode.id.substring(4));
links[linkindex].remove();
links = document.getElementById("links").getElementsByTagName("A");
drawtable();
savelinks();
}
else{
//if it has only one element, clear and repopulate with default
links[0].remove();
var newa = document.createElement("A");
newa.innerHTML = "UP A LEVEL";
newa.href = "../";
document.getElementById("links").appendChild(newa);
var newa = document.createElement("A");
newa.innerHTML = "LINK EDITOR";
newa.href = "linkeditor.html";
document.getElementById("links").appendChild(newa);
var newa = document.createElement("A");
newa.innerHTML = "QR CODE";
newa.href = "qrcode.html";
document.getElementById("links").appendChild(newa);
var newa = document.createElement("A");
newa.innerHTML = "WEB EDITOR";
newa.href = "webeditor.html";
document.getElementById("links").appendChild(newa);
links = document.getElementById("links").getElementsByTagName("A");
drawtable();
savelinks();
}
}
}
}
function savelinks(){
linkhtml = document.getElementById("links").innerHTML;
linkhtml = linkhtml.replace(/<\/a><a>/gi,"</a>\n<a>");
var httpc = new XMLHttpRequest();
var url = "filesaver.php";
httpc.open("POST", url, true);
httpc.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
httpc.send("data="+encodeURIComponent(linkhtml)+"&filename=links.html");//send text to filesaver.php
}
</script>
<style>
body,input,table{
background-color:#9f8767;
font-family:Comic Sans MS;
}
a{
display:block;
color:blue;
margin-left:1em;
margin-top:1em;
margin-bottom:1em;
font-size:2em;
}
.button{
cursor:pointer;
border:solid;
}
.button:hover{
background-color:green;
}
.button:active{
background-color:yellow;
}
</style>
</body>
</html>