-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths.html
541 lines (506 loc) · 19.3 KB
/
s.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
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
<!DOCTYPE html>
<html>
<head>
<title>Zearch results</title>
<link rel="icon" href="favicon.png" type="image/png"/>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Material+Icons" rel="stylesheet">
<style>
body {
background: #e8e8e8;
text-align: center;
}
* {
font-family: 'Montserrat', sans-serif;
color: grey;
}
::selection {
background: lightgrey;
}
:focus {
outline: 0;
}
#input {
width: 500px;
font-size: 18px;
height: 40px;
border-radius: 20px;
background: white;
padding-left: 15px;
padding-right: 15px;
border: none;
margin: 10px 170px;
}
#home {
font-size: 18px;
color: red;
border: 2px solid red;
border-radius: 20px;
height: 40px;
width: 150px;
cursor: pointer;
background: transparent;
position: absolute;
top: 10px;
left: 10px;
}
#home:hover {
color: white;
background: #ff0000;
}
#top {
position: fixed;
z-index: 1;
background: #e8e8e8;
left: 0px;
top: 0px;
height: 60px;
width: 100%;
overflow: hidden;
display: flex;
}
#results {
position: absolute;
top: 100px;
left: 5%;
width: 90%;
}
#results div {
width: 60%;
margin-bottom: 10px;
border-radius: 10px;
padding: 15px;
background: white;
text-align: left;
font-size: 18px;
margin-left: -15px;
}
#results div * {
margin: 5px;
}
#results div img {
height: 16px;
width: 16px;
margin: 0px 0px -1px 0px;
padding-right: 10px;
}
a {
color: red;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
#shade {
position: fixed;
top: 0px;
left: 0px;
height: 100%;
width: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 2;
visibility: hidden;
}
#shade button {
font-size: 18px;
padding: 15px;
border: none;
border-radius: 10px;
width: 350px;
margin-top: 200px;
}
#feed {
position: absolute;
top: 100px;
right: 5%;
width: 25%;
margin-bottom: 10px;
border-radius: 10px;
padding: 15px;
background: white;
text-align: left;
font-size: 18px;
margin-left: -15px;
}
#feed * {
margin: 5px;
}
.red {
font-size: 18px;
color: red;
border: 2px solid red;
border-radius: 20px;
height: 40px;
width: 150px;
cursor: pointer;
background: transparent;
}
.red:hover {
color: white;
background: #ff0000;
}
#history {
position: absolute;
top: 10px;
right: 10px;
}
#account {
position: absolute;
top: 10px;
right: 170px;
}
#complete {
position: absolute;
top: 50px;
left: 170px;
width: 530px;
font-size: 18px;
border-radius: 0px 0px 10px 10px;
background: white;
z-index: 1;
visibility: hidden;
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
}
.auto {
width: 100%;
height: 30px;
border: none;
background: transparent;
color: red;
text-align: left;
border-radius: 0px;
margin-bottom: 5px;
font-size: 18px;
}
.auto:hover {
background: #faf7f7;
cursor: pointer;
color: red;
}
.button {
font-size: 18px;
color: red;
border: 2px solid red;
border-radius: 20px;
height: 40px;
width: 150px;
cursor: pointer;
background: transparent;
margin: 10px;
}
.button:hover {
color: white;
background: #ff0000;
}
@media screen and (max-width: 1030px) {
#account {
visibility: hidden;
}
}
@media screen and (max-width: 870px) {
#history {
visibility: hidden;
}
#home {
left: 5%;
width: 20%;
}
#input {
position: absolute;
margin: 0px;
top: 10px;
left: 26%;
width: 65%;
}
#complete {
position: absolute;
margin: 0px;
top: 50px;
left: 26%;
width: 69%;
}
}
</style>
</head>
<body>
<div id="top">
<a href="index.html">
<button id="home">Zearch</button>
</a>
<form action="s.html" id="form">
<input placeholder="Search something" autocomplete="off" name="q" id="input"></input>
</form>
<button class="red" id="history" onclick="showHistory()">History</button>
<a href="account.html">
<button class="red" id="account">Account</button>
</a>
</div>
<div id="complete"></div>
<div id="results"></div>
<div id="feed">
<p>Zearch is improving its suggestions. If these aren't helpful try again later.</p>
<br>
<a href="index.html">
<button class="red">Homepage</button>
</a>
<span class="material-icons" style="float:right;user-select:none;cursor:pointer;" onclick="notify('Zearch info panel');">more_vert</span>
</div>
<div id="shade" onclick="hide()">
<button><span id="alert">This came up by accident.</span> <br><br><span style="font-size:12px;">Click anywhere to close.</span></button>
</div>
<script>
var query = location.search.split("=")[1].split("&")[0].replace(/\+/gi, " ");
var q = query.toLowerCase();
var input = document.getElementById("input");
var results = document.getElementById("results");
var feed = document.getElementById("feed");
input.value = query;
function r(title,link,domain) {
var x = document.createElement("DIV");
x.innerHTML = "<p><img src='https://t2.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=" + link + "'></img>" + title + "</p><a href='" + link + "'>" + domain + "</a> <span title='Open in new tab' class='material-icons' style='float:right;user-select:none;cursor:pointer;' onclick=\"window.open('" + link + "','_blank');\">launch</span> <span title='Copy link' class='material-icons' style='float:right;user-select:none;cursor:pointer;' onclick=\"clipboard('" + link + "');\">share</span> <span title='About suggestion' class='material-icons' style='float:right;user-select:none;cursor:pointer;' onclick=\"notify('This Zearch suggestion is from " + domain + "')\">more_vert</span>";
results.appendChild(x);
}
function notify(text) {
document.getElementById("alert").innerHTML = text;
document.getElementById("shade").style.visibility = "visible";
}
function hide() {
document.getElementById("shade").style.visibility = "hidden";
}
// for searched urls
if (q.indexOf(" ") < 0 && q.indexOf(".") > -1) {
var title = "Suggested site: " + query;
var link = "https://" + q;
var domain = q;
r(title,link,domain);
}
// for individual word searches
if (q.indexOf(" ") < 0 && q.indexOf(".") < 0) {
var title = "Suggested site: " + query + ".com";
var link = "https://" + q + ".com";
var domain = q + ".com";
r(title,link,domain);
var title = query + " - Wikipedia";
var link = "https://en.wikipedia.org/wiki/Special:Search?search=" + query;
var domain = "en.wikipedia.org";
r(title,link,domain);
}
if (q.search(" ") > 0) {
google();
}
function google() {
if (q.split(" ")[0] == "google") {
title = "Google " + q.split(" ")[1];
link = "https://" + q.split(" ")[1] + ".google.com";
domain = q.split(" ")[1] + ".google.com";
r(title,link,domain);
} else if (q.split(" ")[0] == "bing") {
title = "Bing - " + q.split(" ")[1];
link = "https://" + q.split(" ")[1] + ".bing.com";
domain = q.split(" ")[1] + ".bing.com";
r(title,link,domain);
} else if (q.split(" ")[0] == "yahoo") {
title = "Yahoo " + q.split(" ")[1];
link = "https://" + q.split(" ")[1] + ".yahoo.com";
domain = q.split(" ")[1] + ".yahoo.com";
r(title,link,domain);
} else if (q.split(" ")[0] == "yandex") {
title = "Yandex " + q.split(" ")[1];
link = "https://" + q.split(" ")[1] + ".yandex.com";
domain = q.split(" ")[1] + ".yandex.com";
r(title,link,domain);
}
}
const workWords = ["mail","docs","slides","power point","word","sheet","form","call","zoom","classroom"]
for (let i = 0; i < workWords.length ;i++) {
if (q.indexOf(workWords[i]) > -1) {
r("Google","https://google.com","www.google.com");
r("Gmail","https://mail.google.com","mail.google.com");
r("Google Classroom","https://classroom.google.com","classroom.google.com");
r("Google Docs: Sign-in","https://docs.google.com","docs.google.com");
r("Google Slides: Sign-in","https://slides.google.com","slides.google.com");
r("Google Workspace - Introducing Google Workspace.","https://workspace.google.com","workspace.google.com");
r("Word Processing Software | Microsoft 365","https://www.microsoft.com/en-us/microsoft-365/word","microsoft.com");
r("Yahoo Mail","https://mail.yahoo.com","mail.yahoo.com");
r("Video Conferencing, Cloud Phone, Webinars, Chat, Virtual Events | Zoom","https://zoom.us","zoom.us");
r("Google Forms: Sign-in","https://forms.google.com","forms.google.com");
localStorage.setItem("work",+localStorage.getItem("work") + 1);
}
}
const newsWords = ["news","current events","new york times","cnn","nbc","cbs","the washington post","washington post","guardian","yahoo","npr"];
for (let i = 0; i < newsWords.length ;i++) {
if (q.indexOf(newsWords[i]) > -1) {
r("New York Times - The New York Times - Breaking News, US News, World News","https://www.nytimes.com","www.nytimes.com");
r("CNN - Breaking News, Latest News and Videos","https://www.cnn.com","www.cnn.com");
r("NPR - Breaking News, Analysis, Music, Arts & Podcasts","https://www.npr.org","www.npr.org");
r("NBC News - Breaking News & Top Stories","https://www.nbcnews.com","www.nbcnews.com");
r("CBS News - Breaking news, 24/7 live streaming news","https://www.cbsnews.com","www.cbsnews.com");
r("News, sport and opinion from the Guardian","https://www.theguardian.com","www.theguardian.com");
r("Yahoo News - Latest News & Headlines","https://news.yahoo.com","news.yahoo.com");
r("Google News","https://news.google.com","news.google.com");
r("The Washington Post: Breaking News, World, US, DC News and Analysis","https://www.washingtonpost.com","www.washingtonpost.com");
localStorage.setItem("news",+localStorage.getItem("news") + 1);
}
}
const techWords = ["apple","google","android","iphone","chrome","mac","wired","tech","browser","microsoft","app"];
for (let i = 0; i < techWords.length ;i++) {
if (q.indexOf(techWords[i]) > -1) {
r("Apple - Official site","https://www.apple.com","www.apple.com");
r("Google","https://google.com","www.google.com");
r("Android | The platform pushing what's possible","https://www.android.com","www.android.com");
r("Google Chromebooks - Laptops, Detachables and Tablets","https://google.com/chromebook","www.google.com/chromebook");
r("Microsoft – Cloud, Computers, Apps & Gaming","https://microsoft.com","www.microsoft.com");
r("Google Play","https://play.google.com/store","play.google.com");
r("App Store - Apple","https://apps.apple.com/us/app","apps.apple.com");
r("Internet for people, not profit — Mozilla","https://www.mozilla.org/en-US/","www.mozilla.org/en-US");
r("Chrome - Download the Fast, Secure Browser from Google","https://chrome.google.com","chrome.google.com");
r("WIRED - The Latest in Technology, Science, Culture and Business | WIRED","https://wired.com","www.wired.com");
localStorage.setItem("tech",+localStorage.getItem("tech") + 1);
}
}
const musicWords = ["music","lyrics","song","listen","spotify","podcast","sound","rap","pandora","web player","play"];
for (let i = 0; i < musicWords.length ;i++) {
if (q.indexOf(musicWords[i]) > -1) {
r("Spotify - Web Player: Music for everyone","https://open.spotify.com","open.spotify.com");
r("Apple Music","https://beta.music.apple.com/us/browse","beta.music.apple.com");
r("Amazon Music Unlimited | Stream 75 Million Songs & Podcasts","https://music.amazon.com","music.amazon.com");
r("YouTube Music","https://music.youtube.com","music.youtube.com");
r("Stream and listen to music online for free with SoundCloud","https://soundcloud.com","soundcloud.com");
r("Genius | Song Lyrics & Knowledge","https://genius.com","genius.com");
r("Pandora: Music and Podcasts, Free and On-Demand","https://pandora.com","www.pandora.com");
r("Deezer | Listen to music | Online music streaming platform","https://deezer.com","www.deezer.com");
localStorage.setItem("music",+localStorage.getItem("music") + 1);
}
}
const socialWords = ["post","tweet","twitter","instagram","facebook","insta","tik","profile","account","snapchat","reddit","youtube","linkedin","whatsapp","pinterest","social","media","chat","share"];
for (let i = 0; i < socialWords.length ;i++) {
if (q.indexOf(socialWords[i]) > -1) {
r("Instagram","https://instagram.com","www.instagram.com");
r("Facebook - Log In or Sign Up","https://facebook.com","www.facebook.com");
r("Twitter. It's what's happening / Twitter","https://twitter.com","twitter.com");
r("Make Your Day - TikTok","https://www.tiktok.com","www.tiktok.com");
r("YouTube","https://youtube.com","www.youtube.com");
r("Reddit - Dive into anything","https://www.reddit.com","www.reddit.com");
r("LinkedIn: Log In or Sign Up","https://linkedin.com","www.linkedin.com");
r("Pinterest","https://pinterest.com","www.pinterest.com");
r("WhatsApp","https://whatsapp.com","www.whatsapp.com");
r("Snapchat - The fastest way to share a moment!","https://snapchat.com","www.snapchat.com");
localStorage.setItem("social",+localStorage.getItem("social") + 1);
}
}
const medicalWords = ["med","health","symptoms","md","doctor","hospital","clinic","emergency","disease","treatment","covid","coronavirus","virus","cases"];
for (let i = 0; i < medicalWords.length ;i++) {
if (q.indexOf(medicalWords[i]) > -1) {
r("Covid-19 World Map: Cases, Deaths and Global Trends - The New York Times","https://www.nytimes.com/interactive/2021/world/covid-cases.html","www.nytimes.com");
r("WebMD - Better information. Better health.","https://www.webmd.com","www.webmd.com");
r("Healthgrades | Find a Doctor - Doctor Reviews - Online Doctor Appointments","https://www.healthgrades.com","www.healthgrades.com");
r("Symptoms - Symptoms - Mayo Clinic","https://www.mayoclinic.org/symptoms","www.mayoclinic.org");
r("Drugs.com | Prescription Drug Information, Interactions & Side Effects","https://www.drugs.com","www.drugs.com");
r("Medicare.gov: the official U.S. government site for Medicare | Medicare","https://www.medicare.gov","www.medicare.gov");
localStorage.setItem("medical",+localStorage.getItem("medical") + 1);
}
}
const entertainmentWords = ["entertainment","movies","shows","streaming","netflix","disney","hbo","hulu","youtube","videos","paramount","imdb","fandom","games"];
for (let i = 0; i < entertainmentWords.length ;i++) {
if (q.indexOf(entertainmentWords[i]) > -1) {
r("YouTube","https://youtube.com","www.youtube.com");
r("Netflix - Watch TV Shows Online, Watch Movies Online","https://www.netflix.com","www.netflix.com");
r("IMDb: Ratings, Reviews, and Where to Watch the Best Movies & TV Shows","https://www.imdb.com","www.imdb.com");
r("HBO Max","https://www.hbomax.com","www.hbomax.com");
r("Disney+ - The Best Stories in One Place","https://www.disneyplus.com","www.disneyplus.com");
r("Hulu: Stream TV and Movies Live and Online","https://www.hulu.com","www.hulu.com");
r("Paramount Plus - Stream Live TV, Movies, Originals, Sports, News, and more","https://www.paramountplus.com","www.paramountplus.com");
r("Fandom","https://www.fandom.com","www.fandom.com");
r("Games - The New York Times","https://www.nytimes.com/crosswords","www.nytimes.com");
r("Epic Games Store | Download & Play PC Games, Mods, DLC & More – Epic Games","https://www.epicgames.com","www.epicgames.com");
r("Online Games on Poki — Let's play","https://poki.com","poki.com");
localStorage.setItem("entertainment",+localStorage.getItem("entertainment") + 1);
}
}
const shoppingWords = ["shopping","sale","product","buy","purchase","amazon","ebay","etsy","depop","thredup","shop","store","shoe","sweater","pants","jacket","coat","goat","sneakers","gift"];
for (let i = 0; i < shoppingWords.length ;i++) {
if (q.indexOf(shoppingWords[i]) > -1) {
r("Amazon.com. Spend less. Smile more.","https://www.amazon.com","www.amazon.com");
r("eBay: Electronics, Cars, Fashion, Collectibles & More","https://www.ebay.com","www.ebay.com");
r("Etsy - Official Site","https://www.etsy.com","www.etsy.com");
r("Google Shopping - Shop Online, Compare Prices & Where to Buy","https://shopping.google.com","shopping.google.com");
r("Depop - buy, sell, discover unique fashion","https://www.depop.com","www.depop.com");
r("GOAT: Sneakers, Apparel, Accessories","https://www.goat.com","www.goat.com");
r("thredUP | An Online Consignment & Thrift Store","https://www.thredup.com","www.thredup.com");
localStorage.setItem("shopping",+localStorage.getItem("shopping") + 1);
}
}
// welcome to search result
if (q == "welcome to zearch") {
r("Zearch is a new inpednendent search engine that respects your privacy.","https://lb123658.github.io/zearch","lb123658.github.io");
}
// page title, redirect, and search history
document.getElementsByTagName("title")[0].innerHTML = query + " - Zearch";
if (location.href.length < 39) {
location.replace("https://lb123658.github.io/zearch");
}
localStorage.setItem("last",query);
localStorage.setItem("search_count", +localStorage.getItem("search_count") + 1);
console.log("Search number recorded");
var d = new Date();
const days = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
const months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
var userData = "<div><p><a href='https://lb123658.github.io/zearch/s?q=" + query.replace(/ /gi,"+") + "' target='_blank'>" + query + "</a> - " + d.toLocaleTimeString() + " " + days[d.getDay()] + ", " + months[d.getMonth()] + " " + d.getDate() + "</p></div>";
localStorage.setItem("zearch_history",userData + localStorage.getItem("zearch_history"));
console.log("Time and page recorded");
function showHistory() {
results.innerHTML = "<div><p>Your search history <span class='material-icons' style='float:right;user-select:none;cursor:pointer;' onclick=\"notify('Your search history is never shared with anyone')\">more_vert</span></p></div>" + localStorage.getItem("zearch_history").replace("null","");
document.getElementsByTagName("title")[0].innerHTML = "Search history";
feed.innerHTML = "<p>Your search history <span class='material-icons' style='float:right;user-select:none;cursor:pointer;' onclick=\"notify('Your search history is never shared with anyone')\">more_vert</span></p><br><button class='red' onclick='clearHistory()'>Delete</button>";
}
function clearHistory() {
localStorage.setItem("zearch_history","<div><p>History cleared.<span class='material-icons' style='float:right;user-select:none;cursor:pointer;' onclick=\"notify('Your search history was cleared')\">more_vert</span></p></div>");
showHistory();
}
//copy function
function clipboard(copyText) {
navigator.clipboard.writeText(copyText);
notify("Link copied");
}
// autocomplete suggestions
var complete = document.getElementById("complete");
if(localStorage.getItem("last")) {
var last = localStorage.getItem("last");
} else {
var last = "Welcome to Zearch";
}
input.onkeyup = function() {auto(); };
input.focus();
document.body.onresize = function() {deleteAuto(); };
function hid() {
complete.style.visibility = "hidden";
input.style.borderRadius = "20px";
}
function lastSearch() {
location.replace("https://lb123658.github.io/zearch/s.html?q=" + last.replace(/ /gi, "+"));
}
function auto() {
if (input.value.length > 0) {
complete.innerHTML = "<button class='auto' type='submit' form='form'>" + input.value + "</button> <button class='auto' onclick='lastSearch()'>" + last + "</button><br><button class='button' type='submit' form='form'>Search</button> <button class='button' onclick='hid();'>Close</button>";
complete.style.visibility = "visible";
input.style.borderRadius = "20px 20px 0px 0px";
} else {
complete.style.visibility = "hidden";
input.style.borderRadius = "20px";
}
}
//check to see of there are results
if (results.innerHTML.length == 0) {
r("No results came up for that search","https://lb123658.github.io/zearch/index.html","Try again");
}
// security
const blockedWords = ["trump","truth social","parler","gab","gettr","maga","qanon","q anon","dark web","joe manchin","kyrsten sinema","fox news","infowars","conspiracy","tucker carlson","brandon"];
for (let i = 0; i < blockedWords.length ;i++) {
if (q.indexOf(blockedWords[i]) > -1) {
location.replace("security.html");
}
}
</script>
</body>
</html>