-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
393 lines (343 loc) · 14.3 KB
/
index.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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
<!doctype html>
<html>
<head>
<meta name="keywords" content="search, kaffie, kaffiene, plasmmer, sniffer, dog, find, zeronet, search engine, engine, zero, zerosearch">
<meta charset="utf-8">
<!--<script type="text/javascript" src="js/all.js" async></script>-->
<style>
h1,
h2,
h3,
h4 {
font-weight: normal;
font-size: 100px;
margin: 0px;
padding: 0px
}
</style>
<script src="jquery-3.1.0.min.js"></script>
<script>
function gup(name, url) {
if (!url) url = location.href;
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(url);
return results == null ? null : results[1];
}
var kindlyfireproxy = 'https://proxy1.zn.kindlyfire.me/'
var bitnoproxy = 'http://bit.surf:43110/'
var onlyzeroproxy = 'https://onlyzero.net/'
var siteindex = 'data.txt'
var url = '/'
if (window.location.hostname == "search.kaffie.bit" || window.location.hostname == "snifferdog.bit" ||
window.location.hostname == "zerosearch.bit" || window.location.hostname == "0search.bit")
url = "http://zero/"
</script>
<title>Snifferdog</title>
<link rel="stylesheet" href="css/all.css" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="icon" href="favicon.ico" type="image/x-icon">
</head>
<body>
<script>
var splash = true;
//Grab the site information from data.txt.
var datau;
var datab;
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
datau = xmlhttp.responseText.split("\n");
datab = datau;
}
}
xmlhttp.open("GET", siteindex, false);
xmlhttp.send();
var sname = ""
function selectSearch(selected, u = "") {
var loadurl = selected.value;
sname = selected.options[selected.selectedIndex].innerHTML;
if (selected.value == "externalsource") {
if (u == "")
var loadurl = prompt("Enter the URL to the index you wish to use:", "URL");
else
loadurl = u;
sname = loadurl;
}
if (sname == "Snifferdog") {
datau = datab;
$('#curindex').html(datau.length + " <a href=\"data.txt\" target='_top'>sites</a> and growing..");
search();
return;
}
var xhr = new XMLHttpRequest();
xhr.open("GET", loadurl, true);
xhr.responseType = "text";
xhr.onload = function(event) {
rt = xhr.responseText
rt = rt.replace(/",/g, "")
rt = rt.replace(/"/g, "")
rt = rt.replace(/\{/g, "")
rt = rt.replace(/\}/g, "")
if (sname == "ZeroName") {
//rt = rt.replace(/:/g, "[:")
rt = rt.replace(/ /g, "")
}
if (sname == "Snifferdog - Full") {
datau = datab;
datau = datau.concat(rt.split("\n"));
} else {
datau = rt.split("\n");
}
$('#curindex').html("~" + datau.length + " sites loaded from " + sname);
search();
};
xhr.send();
}
function sortrank(a, b) {
var aval = a[1] == '-' ? 0 : a[1];
var bval = b[1] == '-' ? 0 : b[1];
return bval - aval;
}
//Run the search
var urldata = [];
var page = 0;
var retmax = 15;
function search() {
if (splash) {
$('#searchheader').css("height", "")
$('#head-container').addClass("hcmod")
$('#sr').detach().appendTo("#searchheader").removeClass("searchbox").addClass("topbarsearch").addClass("hcfix").focus()
$('#randbutton').detach().appendTo("#searchheader").addClass("hcfix").addClass("randbuttontopmod")
$('#selectedsearch').detach().appendTo("#sscontainer")
$('#curindex').detach().appendTo("#sscontainer")
$('#splash').remove()
$('#splashlinks').remove()
$('#logo').addClass("logo")
splash = false;
}
page = 0;
var startTime = new Date();
urldata = [];
$("#results").innerHTML = "";
var found = 0;
//Split the search term for easier searching
sra = [];
var searchterm = $("#sr").val();
var sra = searchterm.toLowerCase().split(" ");
//Loop through sites
for (var i = datau.length - 1; i >= 0; i--) {
var accept = 1;
//Loop through search terms
for (var term = 0; term < sra.length; term++) {
var patt = new RegExp(sra[term]);
if (patt.test(datau[i].toLowerCase()) == false) {
accept = 0;
break;
}
}
//If site matches search, add it to results.
if (accept) {
var data = datau[i].split(":");
if (data.length > 1) {
var addrank = data[1].split(" ");
if (addrank.length <= 1)
var addrank = [data[1], '-'];
var desc = data[0].split("[");
var str = ["<div class='entry'><span class='siterank'>", addrank[1], "<br><c>peers</c></span> <span class='resentry'><a class='sitelink' href='", url, addrank[0], "' target='_top'>", desc[0],
"</a> <span class='proxies'>Proxies: <a id='kfp' class='proxylink' href='", kindlyfireproxy, addrank[0], "' target='_top'>K</a><a id='bnp' class='proxylink' href='", bitnoproxy, addrank[0],
"' target='_top'>B</a><a id='wwp' class='proxylink' href='", onlyzeroproxy, addrank[0], "' target='_top'>O</a></span>~", desc[1], "`</span></div>"
]; //.join("");
urldata.push(str);
//document.getElementById("results").innerHTML+="<a href='"+url+data[1]+"' target='_top'>" + desc[0]+" </a> - ";
//document.getElementById("results").innerHTML+="~"+desc[1]+"`\n";
//document.getElementById("results").innerHTML+=desc[1]+"<br>";
found += 1;
}
}
}
urldata.sort(sortrank);
//urldata.length
displayResults(page, retmax);
//Display number of results
var rstring = "<center>page <span id='pagenum'>1</span> of " + found + " result";
if (found != 1) {
rstring += "s";
}
var endTime = new Date();
var timeDiff = endTime - startTime;
$("#resultsfound").html(rstring + " found in " + timeDiff + "ms. <a href='?q=" + escape($("#sr").val()) + "&i=" + sname + "'>share</a><br></center>");
}
function refreshDisplay() {
displayResults(page, retmax)
}
function displayResults(newpage, retmax) {
scroll(0, 0)
page = newpage;
$("#results").html("");
$("#pages").html("");
for (var d = page * retmax; d < (page * retmax) + retmax; d++) {
if (d >= urldata.length)
break;
$("#results").append(urldata[d].join(""));
}
var pages = urldata.length / retmax;
if (pages > 1) {
if (page != 0) {
var pagelink = '<button onclick="displayResults(' + (page - 1) + ',' + retmax + ');"' + '>Previous</button>';
$("#pages").append(pagelink);
}
var start = 0;
var end = pages;
if (pages >= 10) {
if (page >= 5)
start = page - 4;
if (page <= pages - 5) {
if (page >= 5)
end = page + 5;
else
end = 9;
} else {
start = parseInt(pages) - parseInt(9);
end = pages;
}
}
if (start > 0)
$("#pages").append("...");
for (var i = start; i < end; i++) {
var pagelink = '<a href="#" onclick="displayResults(' + i + ',' + retmax + ');"' + "> " + (i + 1) + " </a>";
if (i == page)
pagelink = i + 1;
$("#pages").append(pagelink);
}
if (end < pages)
$("#pages").append("...");
if (page < pages - 1) {
var pagelink = '<button onclick="displayResults(' + (page + 1) + ',' + retmax + ');"' + '>Next</button>';
$("#pages").append(pagelink);
}
}
$("#results").html($("#results").html().replace(/~/g, "<br><span class='tags'>"));
$("#results").html($("#results").html().replace(/`/g, "</span><c><br><br></c>"));
//Discover Mode / Tags
var elements = document.getElementsByClassName('tags');
for (var e = 0; e < elements.length; e++)
elements[e].innerHTML = elements[e].innerHTML.replace(/ ?(.+?)(,|$)/g, "<span class=\"tag\" onclick=\"searchphrase('$1')\">#$1</span> ")
if ($('#pagenum') != null)
$('#pagenum').html(page + 1);
}
function searchphrase(text) {
$("#sr").val(text);
search();
}
function randomsearch() {
var r = Math.floor(Math.random() * datau.length);
var data = datau[r].split(":");
var desc = data[0].split("[");
var nametags = desc[0].split(" ");
if (desc.length == 2) {
var tags = nametags;
if (desc[1] != '')
tags = tags.concat(desc[1].split(","));
var term = tags[Math.floor(Math.random() * tags.length)].replace(" ", "");
$("#sr").val(term);
search();
} else if (nametags.length != 0) {
var term = nametags[Math.floor(Math.random() * nametags.length)].replace(" ", "");
$("#sr").val(term);
search();
} else {
randomsearch();
}
}
</script>
<script async>
(() => { //doodle script - isolated in a function so we don't define window._
let d = new Date()
let z = n => n < 10 ? "0" + n.toString() : n //append 0
let l="./doodles/date/" + z(d.getMonth() + 1) + "-" + z(d.getDate()) + "-" + d.getFullYear()
let _=p => l+"/"+p //used for relative location
$.ajax({
url:l + "/script.js",
dataType:"text",
success:c => eval(c) //run the script
})
})()
</script>
<div id="head-container" class="topmenu">
<a href="./" target="_top" id="logo" title="Snifferdog">Home</a>
<span id="splashlinks" style="padding-left: 10px; padding-right: 10px">
<a href="settings/" target="_top">Settings</a> · <a href="http://127.0.0.1:43110/forum.snifferdog.bit" target="_top">Forum</a> · <a href="http://127.0.0.1:43110/Me.Mkg20001.bit/?Profile/1White24UrrwQrD86o6Vrc1apgZ1x1o51/1DKs7LscyE7kt4SvrpqQBUmU5nuPkryJdP/snifferdog@zeroid.bit" target="_top">Social profile</a> · <a href="https://github.com/ZeroPlasmmer/Snifferdog" target="_top">Source-code</a> · <a href="terms/" target="_top">Terms</a> · <a href="python/" target="_top">Scripts</a> · <a href="install/" target="_top">Install</a> · Other search engines: <a href="http://127.0.0.1:43110/kidsearch.bit" target="_top">Kidsearch</a>
</span>
<div id="searchheader" style="height:0px"></div>
</div>
<div id="sscontainer" class="selectboxfix">
</div>
<div id="splash" class="splashouter">
<div class="splash" id="header" align="center">
<div id="mainlogo" title="Snifferdog" alt="Snifferdog"></div>
<p>This dog can find all!
<script>
document.write("<span id='curindex'>" + datau.length + " <a href=\"data.txt\" target='_top'>sites</a> and growing..</span>");
</script>
</p><br>
<select id="selectedsearch" onchange="selectSearch(this)" title="Switch Search Index">
<option value="" disabled selected>🌎 Switch Search Index</option>
<option value="">Snifferdog</option>
<option value="newsites.txt">Snifferdog - Untagged</option>
<option value="newsites.txt">Snifferdog - Full</option>
<!--script>document.write('<option value="'+url+'1ZeroeuDnL2jNS6t1epQa1SPvC91KG8ER/data.dat">ZeroSearch</option>')</script-->
<script>document.write('<option value="http://127.0.0.1:43110/1f7fyxzwsz5yg7nd8sgshcweqgvdnvvqf/data.json">Bwoi</option>')</script>
<script>document.write('<option value="http://127.0.0.1:43110/1LC3ryygCrv94ZK4Nk8ELW6vE1hKwopE8T/data.txt">CensoredSearch</option>')</script>
<script>document.write('<option value="'+url+'1Name2NXVi1RDPDgf5617UoW7xA6YrhM9F/data/names.json">ZeroName</option>')</script>
<script>document.write('<option value="http://127.0.0.1:43110/1KKcodDy7oamxaBFKeJmyraq9KLCCdi4zo/data.txt">Kidsearch</option>')</script>
<script>document.write('<option value="http://127.0.0.1:43110/1Mr5rX9TauvaGReB4RjCaE6D37FJQaY5Ba/data.txt">Kaffiene</option>')</script>
<script>document.write('<option value="http://127.0.0.1:43110/1Mr5rX9TauvaGReB4RjCaE6D37FJQaY5Ba/newsites.txt">Kaffiene - Untagged</option>')</script>
<script>document.write('<option value="http://127.0.0.1:43110/1Mr5rX9TauvaGReB4RjCaE6D37FJQaY5Ba/newsites.txt">Kaffiene - Full</option>')</script>
<option value="zeromehubs.txt">ZeroMe Hubs</option>
<option value="externalsource">Custom/Other</option>
</select>
<input type="search" class="searchbox" name="search_input" id="sr" placeholder="Search.." required x-webkit-speech results="10" autosave="search_input" title="Press Enter to Search Zeronet" role="search" autofocus autocomplete="true" tab-index="1" />
<button id="randbutton" onclick="randomsearch()" title="Random search">R</button><br> Can't find your site? Suggestions or other discussions?
<script>
document.write('<a href="http://127.0.0.1:43110/forum.snifferdog.bit" target=\'_top\'>')
</script>Post in the Forum.
</div>
</div>
<div id="main-google-search" align="center">
<div id="resultsfound"></div>
<div id="results"></div>
<div id="pages"></div>
</div>
<script>
$('#sr').focus().keyup(e => search()).keypress(e => search())
var s = gup('q', location.href)
if (s != null)
searchphrase(decodeURIComponent(s.replace(/\+/g, " ")));
var i = gup('i', location.href).replace(/%20/g, " ")
selected = document.getElementById('selectedsearch')
if (i != null) {
var found = false
for (var j = 0; j < selected.options.length - 1; j++) {
if (selected.options[j].innerHTML.toLowerCase() == i.toLowerCase()) {
selected.selectedIndex = j;
selectSearch(selected);
found = true;
break;
}
}
if (found == false) {
selected.selectedIndex = selected.options.length - 1;
selectSearch(selected, i);
found = true;
}
}
</script>
</body>
</html>