KingNish commited on
Commit
c8cbb1a
·
verified ·
1 Parent(s): d52ce34

Rename web/index.html to index.html

Browse files
Files changed (2) hide show
  1. index.html +665 -0
  2. web/index.html +0 -71
index.html ADDED
@@ -0,0 +1,665 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>HelpingAI Search</title>
7
+ <style>
8
+ body,
9
+ html {
10
+ margin: 0;
11
+ padding: 0;
12
+ font-family: "Arial", sans-serif;
13
+ height: 100%;
14
+ background: #f2f2f2; /* Light gray background */
15
+ }
16
+
17
+ .container {
18
+ display: flex;
19
+ flex-direction: column;
20
+ min-height: 100%;
21
+ }
22
+
23
+ header {
24
+ padding: 30px;
25
+ display: flex;
26
+ justify-content: space-between;
27
+ align-items: center;
28
+ background: #fff; /* White header background */
29
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Subtle shadow */
30
+ }
31
+
32
+ .main-content {
33
+ flex-grow: 1;
34
+ display: flex;
35
+ flex-direction: column;
36
+ align-items: center;
37
+ padding: 40px 20px; /* Increased padding */
38
+ }
39
+
40
+ .logo {
41
+ font-size: 40px; /* Reduced logo size */
42
+ font-weight: bold;
43
+ margin-bottom: 20px;
44
+ color: #4285f4;
45
+ position: absolute;
46
+ left: 43vw;
47
+ top: 6px;
48
+ }
49
+
50
+ .logo span:nth-child(2) {
51
+ color: #ea4335;
52
+ }
53
+
54
+ .logo span:nth-child(3) {
55
+ color: #fbbc05;
56
+ }
57
+
58
+ .logo span:nth-child(4) {
59
+ color: #34a853;
60
+ }
61
+
62
+ .logo span:nth-child(5) {
63
+ color: #ea4335;
64
+ }
65
+
66
+ .search-container {
67
+ width: 100%;
68
+ max-width: 700px;
69
+ margin-bottom: 20px;
70
+ position: relative; /* For positioning suggestions */
71
+ }
72
+
73
+ .search-box {
74
+ display: flex;
75
+ border: 1px solid #dfe1e5;
76
+ border-radius: 24px;
77
+ padding: 5px 8px;
78
+ transition: box-shadow 0.3s;
79
+ background: #fff; /* White search box background */
80
+ }
81
+
82
+ .search-box:hover,
83
+ .search-box:focus-within {
84
+ box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
85
+ border-color: rgba(223, 225, 229, 0);
86
+ }
87
+
88
+ #search-query {
89
+ flex-grow: 1;
90
+ border: none;
91
+ outline: none;
92
+ font-size: 16px;
93
+ padding: 10px 15px;
94
+ }
95
+
96
+ button {
97
+ background: none;
98
+ border: none;
99
+ cursor: pointer;
100
+ padding: 0 15px;
101
+ }
102
+
103
+ #search-form button svg {
104
+ width: 20px; /* Reduced icon size */
105
+ height: 20px;
106
+ }
107
+
108
+ #suggestions {
109
+ width: 100%;
110
+ max-width: 700px;
111
+ border: 1px solid #dfe1e5;
112
+ border-top: none;
113
+ border-radius: 0 0 24px 24px;
114
+ box-shadow: 0 4px 6px rgba(32, 33, 36, 0.28);
115
+ display: none;
116
+ position: absolute;
117
+ background: white;
118
+ z-index: 1000;
119
+ }
120
+
121
+ #suggestions ul {
122
+ list-style-type: none;
123
+ padding: 0;
124
+ margin: 0;
125
+ }
126
+
127
+ #suggestions li {
128
+ padding: 10px 15px;
129
+ cursor: pointer;
130
+ border-bottom: 1px solid #eee; /* Subtle separator */
131
+ }
132
+
133
+ #suggestions li:hover {
134
+ background-color: #f1f3f4;
135
+ }
136
+
137
+ #results {
138
+ width: 100%;
139
+ max-width: 700px;
140
+ padding: 20px 0;
141
+ }
142
+
143
+ .result {
144
+ margin-bottom: 20px;
145
+ padding: 15px;
146
+ border-radius: 8px;
147
+ background: #fff;
148
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
149
+ }
150
+
151
+ .result h3 {
152
+ margin: 0;
153
+ font-weight: normal;
154
+ }
155
+
156
+ .result h3 a {
157
+ color: #1a0dab;
158
+ text-decoration: none;
159
+ font-size: 18px;
160
+ }
161
+
162
+ .result h3 a:hover {
163
+ text-decoration: underline;
164
+ }
165
+
166
+ .result .url {
167
+ color: #006621;
168
+ font-size: 14px;
169
+ margin-bottom: 3px;
170
+ }
171
+
172
+ .result p {
173
+ color: #545454;
174
+ font-size: 14px;
175
+ line-height: 1.58;
176
+ margin: 0;
177
+ }
178
+
179
+ .settings-icon {
180
+ background: none;
181
+ border: none;
182
+ cursor: pointer;
183
+ padding: 0;
184
+ position: absolute;
185
+ right: 5vw;
186
+ }
187
+
188
+ .settings-icon svg {
189
+ width: 24px; /* Increased icon size */
190
+ height: 24px;
191
+ fill: #333; /* Darker icon color */
192
+ }
193
+
194
+ .settings-menu {
195
+ display: none;
196
+ position: fixed;
197
+ top: 60px;
198
+ right: 20px;
199
+ background: #fff;
200
+ border: 1px solid #dfe1e5;
201
+ border-radius: 4px;
202
+ box-shadow: 0 4px 6px rgba(32, 33, 36, 0.28);
203
+ padding: 15px;
204
+ z-index: 1001;
205
+ width: 300px; /* Increased width for better visibility */
206
+ }
207
+
208
+ .settings-menu select {
209
+ display: block;
210
+ margin-bottom: 10px;
211
+ padding: 8px 12px;
212
+ border-radius: 4px;
213
+ border: 1.6px solid #2b14fa;
214
+ appearance: none;
215
+ background: #ffffff
216
+ url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path d='M4 7l6 6 6-6z'></path></svg>")
217
+ no-repeat right 10px center;
218
+ font-size: 14px;
219
+ }
220
+
221
+ .settings-menu select:focus {
222
+ outline: none;
223
+ box-shadow: 0 0 0 5px #4285f4;
224
+ }
225
+
226
+ .settings-menu h4 {
227
+ margin-top: 0;
228
+ font-weight: bold;
229
+ color: #333;
230
+ }
231
+
232
+ /* About Section Styling */
233
+ .about-section {
234
+ width: 100%;
235
+ max-width: 700px;
236
+ padding: 20px;
237
+ border-radius: 8px;
238
+ background: #fff;
239
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
240
+ margin-top: 20px;
241
+ }
242
+
243
+ .about-section h2 {
244
+ color: #333;
245
+ margin-bottom: 10px;
246
+ }
247
+
248
+ .about-section p {
249
+ color: #545454;
250
+ font-size: 14px;
251
+ line-height: 1.58;
252
+ margin: 0;
253
+ }
254
+
255
+ /* People Also Search For Styling */
256
+ .people-also-search {
257
+ width: 100%;
258
+ max-width: 700px;
259
+ padding: 20px;
260
+ border-radius: 8px;
261
+ background: #fff;
262
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
263
+ margin-top: 20px;
264
+ }
265
+
266
+ .people-also-search h3 {
267
+ color: #333;
268
+ margin-bottom: 10px;
269
+ }
270
+
271
+ .people-also-search ul {
272
+ list-style: none;
273
+ padding: 0;
274
+ margin: 0;
275
+ }
276
+
277
+ .people-also-search li {
278
+ padding: 5px 0;
279
+ cursor: pointer;
280
+ color: #545454;
281
+ font-size: 14px;
282
+ }
283
+
284
+ .people-also-search li a {
285
+ text-decoration: none;
286
+ color: #1a0dab;
287
+ }
288
+
289
+ .people-also-search li a:hover {
290
+ text-decoration: underline;
291
+ }
292
+
293
+ .sidebar {
294
+ width: 300px; /* Adjust width as needed */
295
+ padding: 20px;
296
+ background: #fff;
297
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
298
+ position: fixed;
299
+ top: 60px;
300
+ right: 20px;
301
+ height: calc(100vh - 60px); /* Adjust height as needed */
302
+ overflow-y: auto;
303
+ display: none;
304
+ }
305
+
306
+ .sidebar h2,
307
+ .sidebar h3 {
308
+ color: #333;
309
+ margin-bottom: 10px;
310
+ }
311
+
312
+ .sidebar p {
313
+ color: #545454;
314
+ font-size: 14px;
315
+ line-height: 1.58;
316
+ margin: 0;
317
+ }
318
+
319
+ .sidebar ul {
320
+ list-style: none;
321
+ padding: 0;
322
+ margin: 0;
323
+ }
324
+
325
+ .sidebar li {
326
+ padding: 5px 0;
327
+ cursor: pointer;
328
+ color: #545454;
329
+ font-size: 14px;
330
+ }
331
+
332
+ .sidebar li a {
333
+ text-decoration: none;
334
+ color: #1a0dab;
335
+ }
336
+
337
+ .sidebar li a:hover {
338
+ text-decoration: underline;
339
+ }
340
+
341
+ .main-content {
342
+ margin-right: 320px; /* Adjust based on sidebar width */
343
+ transition: margin-left 0.3s;
344
+ }
345
+ </style>
346
+ </head>
347
+ <body>
348
+ <div class="container">
349
+ <header>
350
+ <div class="logo">
351
+ <span>H</span><span>e</span><span>l</span><span>p</span><span>i</span
352
+ ><span>ng</span><span>AI</span>
353
+ </div>
354
+ <button class="settings-icon" onclick="toggleSettings()">
355
+ <svg
356
+ xmlns="http://www.w3.org/2000/svg"
357
+ width="24"
358
+ height="24"
359
+ viewBox="0 0 24 24"
360
+ fill="none"
361
+ stroke="currentColor"
362
+ stroke-width="2"
363
+ stroke-linecap="round"
364
+ stroke-linejoin="round"
365
+ class="feather feather-settings"
366
+ >
367
+ <circle cx="12" cy="12" r="3"></circle>
368
+ <path
369
+ d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"
370
+ ></path>
371
+ </svg>
372
+ </button>
373
+ <div class="settings-menu" id="settings-menu">
374
+ <h4>Time Limit</h4>
375
+ <select id="timelimit">
376
+ <option value="none">All Time</option>
377
+ <option value="d">Day</option>
378
+ <option value="w">Week</option>
379
+ <option value="m">Month</option>
380
+ <option value="y">Year</option>
381
+ </select>
382
+ <h4>Safe Search</h4>
383
+ <select id="safesearch">
384
+ <option value="off">Off</option>
385
+ <option value="moderate">Moderate</option>
386
+ <option value="on">On</option>
387
+ </select>
388
+ </div>
389
+ </header>
390
+ <div class="sidebar" id="sidebar">
391
+ <div id="about-section" style="display: none">
392
+ <h2>About</h2>
393
+ <p id="about-description"></p>
394
+ </div>
395
+ <div id="people-also-search-section" style="display: none">
396
+ <h3>People Also Search For</h3>
397
+ <ul id="people-also-search-list"></ul>
398
+ </div>
399
+ </div>
400
+ <div class="main-content">
401
+ <div class="search-container">
402
+ <form id="search-form">
403
+ <div class="search-box">
404
+ <input
405
+ type="text"
406
+ id="search-query"
407
+ placeholder="Search the web"
408
+ autocomplete="off"
409
+ />
410
+ <button type="submit">
411
+ <svg
412
+ focusable="false"
413
+ xmlns="http://www.w3.org/2000/svg"
414
+ viewBox="0 0 24 24"
415
+ width="24px"
416
+ >
417
+ <path
418
+ d="M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5 6.5 6.5 0 1 0 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"
419
+ ></path>
420
+ </svg>
421
+ </button>
422
+ </div>
423
+ </form>
424
+ <div id="suggestions"></div>
425
+ </div>
426
+ <div id="results"></div>
427
+ </div>
428
+ </div>
429
+
430
+ <script>
431
+ const searchForm = document.getElementById("search-form");
432
+ const searchQueryInput = document.getElementById("search-query");
433
+ const timelimitSelect = document.getElementById("timelimit");
434
+ const safesearchSelect = document.getElementById("safesearch");
435
+ const resultsContainer = document.getElementById("results");
436
+ const suggestionsContainer = document.getElementById("suggestions");
437
+ const peopleAlsoSearchList = document.getElementById(
438
+ "people-also-search-list"
439
+ );
440
+ const peopleAlsoSearchSection = document.getElementById(
441
+ "people-also-search-section"
442
+ );
443
+ const aboutSection = document.getElementById("about-section");
444
+ const sidebar = document.getElementById("sidebar");
445
+
446
+ const BASE_URL = "https://oevortex-webscout-api.hf.space";
447
+
448
+ searchQueryInput.addEventListener("input", async () => {
449
+ const searchQuery = searchQueryInput.value;
450
+ const apiEndpoint = `${BASE_URL}/api/suggestions`;
451
+
452
+ if (searchQuery.trim() === "") {
453
+ suggestionsContainer.style.display = "none";
454
+ return;
455
+ }
456
+
457
+ try {
458
+ const response = await fetch(
459
+ `${apiEndpoint}?q=${encodeURIComponent(searchQuery)}`
460
+ );
461
+ if (!response.ok) {
462
+ throw new Error(
463
+ `API request failed with status: ${response.status}`
464
+ );
465
+ }
466
+ const data = await response.json();
467
+ displaySuggestions(data);
468
+ } catch (error) {
469
+ console.error("Error:", error);
470
+ suggestionsContainer.style.display = "none";
471
+ }
472
+ });
473
+
474
+ searchQueryInput.addEventListener("focus", () => {
475
+ if (searchQueryInput.value.trim() !== "") {
476
+ suggestionsContainer.style.display = "block";
477
+ }
478
+ });
479
+
480
+ document.addEventListener("click", (event) => {
481
+ if (!searchForm.contains(event.target)) {
482
+ suggestionsContainer.style.display = "none";
483
+ }
484
+ });
485
+
486
+ searchForm.addEventListener("submit", async (event) => {
487
+ event.preventDefault();
488
+ const searchQuery = searchQueryInput.value;
489
+ const timelimit = timelimitSelect.value;
490
+ const safesearch = safesearchSelect.value;
491
+ await performSearch(searchQuery, timelimit, safesearch);
492
+ });
493
+
494
+ function displaySuggestions(suggestions) {
495
+ suggestionsContainer.innerHTML = "";
496
+ if (suggestions.length === 0) {
497
+ suggestionsContainer.style.display = "none";
498
+ return;
499
+ }
500
+ const suggestionList = document.createElement("ul");
501
+ suggestions.forEach((suggestion) => {
502
+ const listItem = document.createElement("li");
503
+ listItem.textContent = suggestion.phrase;
504
+ listItem.addEventListener("click", () => {
505
+ searchQueryInput.value = suggestion.phrase;
506
+ suggestionsContainer.style.display = "none";
507
+ performSearch(suggestion.phrase);
508
+ });
509
+ suggestionList.appendChild(listItem);
510
+ });
511
+ suggestionsContainer.appendChild(suggestionList);
512
+ suggestionsContainer.style.display = "block";
513
+ }
514
+
515
+ async function performSearch(query, timelimit, safesearch) {
516
+ const apiEndpoint = `${BASE_URL}/api/search`;
517
+
518
+ try {
519
+ const response = await fetch(
520
+ `${apiEndpoint}?q=${encodeURIComponent(
521
+ query
522
+ )}&max_results=100&timelimit=${timelimit}&safesearch=${safesearch}`
523
+ );
524
+
525
+ if (!response.ok) {
526
+ throw new Error(
527
+ `API request failed with status: ${response.status}`
528
+ );
529
+ }
530
+
531
+ const searchResults = await response.json();
532
+ displayResults(searchResults);
533
+ suggestionsContainer.style.display = "none";
534
+
535
+ // Get "People Also Search For" data
536
+ const peopleAlsoSearchData = await getPeopleAlsoSearch(query);
537
+
538
+ // Display "About" section
539
+ const aboutDescription = peopleAlsoSearchData.find(
540
+ (item) => item.topic === null
541
+ );
542
+ if (aboutDescription) {
543
+ document.getElementById("about-description").textContent =
544
+ aboutDescription.text;
545
+ aboutSection.style.display = "block";
546
+ } else {
547
+ aboutSection.style.display = "none";
548
+ }
549
+
550
+ // Display "People Also Search For" list (limited to 5-6 items)
551
+ const peopleAlsoSearchItems = peopleAlsoSearchData.filter(
552
+ (item) => item.topic === "See also"
553
+ );
554
+ displayPeopleAlsoSearch(peopleAlsoSearchItems.slice(0, 6));
555
+ if (peopleAlsoSearchItems.length > 0) {
556
+ peopleAlsoSearchSection.style.display = "block";
557
+ } else {
558
+ peopleAlsoSearchSection.style.display = "none";
559
+ }
560
+
561
+ if (aboutSection.style.display === "block" || peopleAlsoSearchSection.style.display === "block") {
562
+ // Show the sidebar if either section is displayed
563
+ sidebar.style.display = "block";
564
+ document.querySelector(".main-content").style.marginLeft = "320px";
565
+ } else {
566
+ // Hide the sidebar if both sections are hidden
567
+ sidebar.style.display = "none";
568
+ document.querySelector(".main-content").style.marginLeft = "0px";
569
+ }
570
+ } catch (error) {
571
+ console.error("Error:", error);
572
+ displayError("An error occurred while fetching results.");
573
+ }
574
+ }
575
+
576
+ async function getPeopleAlsoSearch(query) {
577
+ const apiEndpoint = `${BASE_URL}/api/answers`;
578
+
579
+ try {
580
+ const response = await fetch(
581
+ `${apiEndpoint}?q=${encodeURIComponent(query)}`
582
+ );
583
+ if (!response.ok) {
584
+ throw new Error(
585
+ `API request failed with status: ${response.status}`
586
+ );
587
+ }
588
+ const data = await response.json();
589
+ return data; // Return the data from the API
590
+ } catch (error) {
591
+ console.error("Error:", error);
592
+ return null; // Return null if there's an error fetching data
593
+ }
594
+ }
595
+
596
+ function displayPeopleAlsoSearch(data) {
597
+ peopleAlsoSearchList.innerHTML = ""; // Clear previous list
598
+
599
+ if (data.length === 0) {
600
+ // Handle the case where no "People Also Search For" results are found
601
+ return;
602
+ }
603
+
604
+ data.forEach((item) => {
605
+ const listItem = document.createElement("li");
606
+ const link = document.createElement("a");
607
+ link.href = item.url;
608
+ link.textContent = item.text;
609
+ link.target = "_blank";
610
+ link.rel = "noopener noreferrer";
611
+ listItem.appendChild(link);
612
+ peopleAlsoSearchList.appendChild(listItem);
613
+ });
614
+ }
615
+
616
+ function displayResults(results) {
617
+ resultsContainer.innerHTML = "";
618
+ if (results.length === 0) {
619
+ displayError("No results found.");
620
+ return;
621
+ }
622
+
623
+ results.forEach((result) => {
624
+ const resultElement = document.createElement("div");
625
+ resultElement.classList.add("result");
626
+
627
+ const titleElement = document.createElement("h3");
628
+ const titleLink = document.createElement("a");
629
+ titleLink.href = result.href;
630
+ titleLink.textContent = result.title;
631
+ titleLink.target = "_blank";
632
+ titleLink.rel = "noopener noreferrer";
633
+ titleElement.appendChild(titleLink);
634
+
635
+ const urlElement = document.createElement("div");
636
+ urlElement.classList.add("url");
637
+ urlElement.textContent = result.href;
638
+
639
+ // Correctly using result.description now
640
+ const descriptionElement = document.createElement("p");
641
+ descriptionElement.textContent = result.body;
642
+
643
+ resultElement.appendChild(titleElement);
644
+ resultElement.appendChild(urlElement);
645
+ resultElement.appendChild(descriptionElement);
646
+ resultsContainer.appendChild(resultElement);
647
+ });
648
+ }
649
+
650
+ function displayError(message) {
651
+ resultsContainer.innerHTML = "";
652
+ const errorElement = document.createElement("p");
653
+ errorElement.textContent = message;
654
+ errorElement.style.color = "red";
655
+ resultsContainer.appendChild(errorElement);
656
+ }
657
+
658
+ function toggleSettings() {
659
+ const settingsMenu = document.getElementById("settings-menu");
660
+ settingsMenu.style.display =
661
+ settingsMenu.style.display === "block" ? "none" : "block";
662
+ }
663
+ </script>
664
+ </body>
665
+ </html>
web/index.html DELETED
@@ -1,71 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>HelpingAI Search</title>
7
- <link rel="stylesheet" href="styles.css">
8
- </head>
9
- <body>
10
- <div class="container">
11
- <header>
12
- <div class="logo">
13
- <span>H</span><span>e</span><span>l</span><span>p</span><span>i</span
14
- ><span>ng</span><span>AI</span>
15
- </div>
16
- <button class="settings-icon" onclick="toggleSettings()">
17
- <svg>
18
- </svg>
19
- </button>
20
- <div class="settings-menu" id="settings-menu">
21
- <h4>Time Limit</h4>
22
- <select id="timelimit">
23
- <option value="none">All Time</option>
24
- <option value="d">Day</option>
25
- <option value="w">Week</option>
26
- <option value="m">Month</option>
27
- <option value="y">Year</option>
28
- </select>
29
- <h4>Safe Search</h4>
30
- <select id="safesearch">
31
- <option value="off">Off</option>
32
- <option value="moderate">Moderate</option>
33
- <option value="on">On</option>
34
- </select>
35
- </div>
36
- </header>
37
- <div class="sidebar" id="sidebar">
38
- <div id="about-section" style="display: none">
39
- <h2>About</h2>
40
- <p id="about-description"></p>
41
- </div>
42
- <div id="people-also-search-section" style="display: none">
43
- <h3>People Also Search For</h3>
44
- <ul id="people-also-search-list"></ul>
45
- </div>
46
- </div>
47
- <div class="main-content">
48
- <div class="search-container">
49
- <form id="search-form">
50
- <div class="search-box">
51
- <input
52
- type="text"
53
- id="search-query"
54
- placeholder="Search the web"
55
- autocomplete="off"
56
- />
57
- <button type="submit">
58
- <svg>
59
- </svg>
60
- </button>
61
- </div>
62
- </form>
63
- <div id="suggestions"></div>
64
- </div>
65
- <div id="results"></div>
66
- </div>
67
- </div>
68
-
69
- <script src="eel.js"></script> <script src="script.js"></script>
70
- </body>
71
- </html>