KingNish commited on
Commit
5f3d908
·
verified ·
1 Parent(s): d403354

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +262 -648
templates/index.html CHANGED
@@ -1,665 +1,279 @@
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>
 
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, html { margin: 0; padding: 0; font-family: 'Arial', sans-serif; height: 100%; background: #f2f2f2; }
9
+ .container { display: flex; flex-direction: column; min-height: 100%; }
10
+ header { padding: 30px; display: flex; justify-content: space-between; align-items: center; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
11
+ .main-content { flex-grow: 1; display: flex; flex-direction: column; align-items: center; padding: 40px 20px; transition: margin-left 0.3s; }
12
+ .logo { font-size: 40px; font-weight: bold; margin-bottom: 20px; color: #4285f4; position: absolute; left: 43vw; top: 6px; }
13
+ .logo span:nth-child(2) { color: #ea4335; }
14
+ .logo span:nth-child(3) { color: #fbbc05; }
15
+ .logo span:nth-child(4) { color: #34a853; }
16
+ .logo span:nth-child(5) { color: #ea4335; }
17
+ .search-container { width: 100%; max-width: 700px; margin-bottom: 20px; position: relative; }
18
+ .search-box { display: flex; border: 1px solid #dfe1e5; border-radius: 24px; padding: 5px 8px; transition: box-shadow 0.3s; background: #fff; }
19
+ .search-box:hover, .search-box:focus-within { box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28); border-color: rgba(223, 225, 229, 0); }
20
+ #search-query { flex-grow: 1; border: none; outline: none; font-size: 16px; padding: 10px 15px; }
21
+ button { background: none; border: none; cursor: pointer; padding: 0 15px; }
22
+ #search-form button svg { width: 20px; height: 20px; }
23
+ #suggestions { width: 100%; max-width: 700px; border: 1px solid #dfe1e5; border-top: none; border-radius: 0 0 24px 24px; box-shadow: 0 4px 6px rgba(32, 33, 36, 0.28); display: none; position: absolute; background: white; z-index: 1000; }
24
+ #suggestions ul { list-style-type: none; padding: 0; margin: 0; }
25
+ #suggestions li { padding: 10px 15px; cursor: pointer; border-bottom: 1px solid #eee; }
26
+ #suggestions li:hover { background-color: #f1f3f4; }
27
+ #results { width: 100%; max-width: 700px; padding: 20px 0; }
28
+ .result { margin-bottom: 20px; padding: 15px; border-radius: 8px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
29
+ .result h3 { margin: 0; font-weight: normal; }
30
+ .result h3 a { color: #1a0dab; text-decoration: none; font-size: 18px; }
31
+ .result h3 a:hover { text-decoration: underline; }
32
+ .result .url { color: #006621; font-size: 14px; margin-bottom: 3px; }
33
+ .result p { color: #545454; font-size: 14px; line-height: 1.58; margin: 0; }
34
+ .settings-icon { background: none; border: none; cursor: pointer; padding: 0; position: absolute; right: 5vw; }
35
+ .settings-icon svg { width: 24px; height: 24px; fill: #333; }
36
+ .settings-menu { display: none; position: fixed; top: 60px; right: 20px; background: #fff; border: 1px solid #dfe1e5; border-radius: 4px; box-shadow: 0 4px 6px rgba(32, 33, 36, 0.28); padding: 15px; z-index: 1001; width: 300px; }
37
+ .settings-menu select { display: block; margin-bottom: 10px; padding: 8px 12px; border-radius: 4px; border: 1.6px solid #2b14fa; appearance: none; background: #ffffff 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>") no-repeat right 10px center; font-size: 14px; }
38
+ .settings-menu select:focus { outline: none; box-shadow: 0 0 0 5px #4285f4; }
39
+ .settings-menu h4 { margin-top: 0; font-weight: bold; color: #333; }
40
+
41
+ /* Sidebar Styling */
42
+ .sidebar { width: 300px; padding: 20px; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); position: fixed; top: 60px; right: 20px; height: calc(100vh - 60px); overflow-y: auto; display: none; }
43
+ .sidebar h2, .sidebar h3 { color: #333; margin-bottom: 10px; }
44
+ .sidebar p { color: #545454; font-size: 14px; line-height: 1.58; margin: 0; }
45
+ .sidebar ul { list-style: none; padding: 0; margin: 0; }
46
+ .sidebar li { padding: 5px 0; cursor: pointer; color: #545454; font-size: 14px; }
47
+ .sidebar li a { text-decoration: none; color: #1a0dab; }
48
+ .sidebar li a:hover { text-decoration: underline; }
49
+
50
+ /* Responsive Adjustments - You can add more as needed */
51
+ @media (max-width: 768px) {
52
+ .main-content { margin-right: 0; /* Hide sidebar on smaller screens */ }
53
+ .sidebar { display: none !important; /* Ensure sidebar is hidden */ }
54
+ }
55
+ </style>
56
+ </head>
57
+ <body>
58
+ <div class="container">
59
+ <header>
60
+ <div class="logo">
61
+ <span>H</span><span>e</span><span>l</span><span>p</span><span>i</span
62
+ ><span>ng</span><span>AI</span>
63
+ </div>
64
+ <button class="settings-icon" onclick="toggleSettings()">
65
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings">
66
+ <circle cx="12" cy="12" r="3"></circle>
67
+ <path 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"></path>
68
+ </svg>
69
+ </button>
70
+ <div class="settings-menu" id="settings-menu">
71
+ <h4>Time Limit</h4>
72
+ <select id="timelimit">
73
+ <option value="none">All Time</option>
74
+ <option value="d">Day</option>
75
+ <option value="w">Week</option>
76
+ <option value="m">Month</option>
77
+ <option value="y">Year</option>
78
+ </select>
79
+ <h4>Safe Search</h4>
80
+ <select id="safesearch">
81
+ <option value="off">Off</option>
82
+ <option value="moderate">Moderate</option>
83
+ <option value="on">On</option>
84
+ </select>
85
+ </div>
86
+ </header>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
+ <div class="sidebar" id="sidebar">
89
+ <div id="about-section" style="display: none">
90
+ <h2>About</h2>
91
+ <p id="about-description"></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  </div>
93
+ <div id="people-also-search-section" style="display: none">
94
+ <h3>People Also Search For</h3>
95
+ <ul id="people-also-search-list"></ul>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  </div>
97
  </div>
98
 
99
+ <div class="main-content">
100
+ <div class="search-container">
101
+ <form id="search-form">
102
+ <div class="search-box">
103
+ <input type="text" id="search-query" placeholder="Search the web" autocomplete="off" />
104
+ <button type="submit">
105
+ <svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24px">
106
+ <path 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"></path>
107
+ </svg>
108
+ </button>
109
+ </div>
110
+ </form>
111
+ <div id="suggestions"></div>
112
+ </div>
113
+ <div id="results"></div>
114
+ </div>
115
+ </div>
116
+
117
+ <script>
118
+ const BASE_URL = "https://oevortex-webscout-api.hf.space";
119
+ const searchForm = document.getElementById("search-form");
120
+ const searchQueryInput = document.getElementById("search-query");
121
+ const timelimitSelect = document.getElementById("timelimit");
122
+ const safesearchSelect = document.getElementById("safesearch");
123
+ const resultsContainer = document.getElementById("results");
124
+ const suggestionsContainer = document.getElementById("suggestions");
125
+ const peopleAlsoSearchList = document.getElementById("people-also-search-list");
126
+ const peopleAlsoSearchSection = document.getElementById("people-also-search-section");
127
+ const aboutSection = document.getElementById("about-section");
128
+ const sidebar = document.getElementById("sidebar");
129
+
130
+ // Function to fetch search suggestions
131
+ async function fetchSuggestions(query) {
132
+ const response = await fetch(`${BASE_URL}/api/suggestions?q=${encodeURIComponent(query)}`);
133
+ return response.ok ? response.json() : [];
134
+ }
135
+
136
+ // Function to display search suggestions
137
+ function displaySuggestions(suggestions) {
138
+ suggestionsContainer.innerHTML = "";
139
+ if (suggestions.length === 0) {
140
+ suggestionsContainer.style.display = "none";
141
+ return;
142
+ }
143
+ const suggestionList = document.createElement("ul");
144
+ suggestions.forEach((suggestion) => {
145
+ const listItem = document.createElement("li");
146
+ listItem.textContent = suggestion.phrase;
147
+ listItem.addEventListener("click", () => {
148
+ searchQueryInput.value = suggestion.phrase;
149
  suggestionsContainer.style.display = "none";
150
+ performSearch(suggestion.phrase);
151
+ });
152
+ suggestionList.appendChild(listItem);
153
  });
154
+ suggestionsContainer.appendChild(suggestionList);
155
+ suggestionsContainer.style.display = "block";
156
+ }
157
+
158
+ // Function to handle search form submission
159
+ async function performSearch(query, timelimit, safesearch) {
160
+ const timelimitValue = timelimitSelect.value;
161
+ const safesearchValue = safesearchSelect.value;
162
+ const response = await fetch(`${BASE_URL}/api/search?q=${encodeURIComponent(query)}&max_results=100&timelimit=${timelimitValue}&safesearch=${safesearchValue}`);
163
+ const searchResults = await response.json();
164
+ displayResults(searchResults);
165
+ suggestionsContainer.style.display = "none";
166
+
167
+ // Fetch and display "People Also Search For" and "About"
168
+ const peopleAlsoSearchData = await getPeopleAlsoSearch(query);
169
+ displayPeopleAlsoSearch(peopleAlsoSearchData.filter(item => item.topic === "See also").slice(0, 6));
170
+ const aboutDescription = peopleAlsoSearchData.find(item => item.topic === null);
171
+ if (aboutDescription) {
172
+ document.getElementById("about-description").textContent = aboutDescription.text;
173
+ aboutSection.style.display = "block";
174
+ } else {
175
+ aboutSection.style.display = "none";
176
+ }
177
+
178
+ // Show/hide sidebar based on content
179
+ sidebar.style.display = aboutSection.style.display === "block" || peopleAlsoSearchList.children.length > 0 ? "block" : "none";
180
+ document.querySelector(".main-content").style.marginLeft = sidebar.style.display === "block" ? "320px" : "0px";
181
+ }
182
+
183
+ // Function to fetch "People Also Search For" data
184
+ async function getPeopleAlsoSearch(query) {
185
+ const response = await fetch(`${BASE_URL}/api/answers?q=${encodeURIComponent(query)}`);
186
+ return response.ok ? response.json() : [];
187
+ }
188
+
189
+ // Function to display "People Also Search For" results
190
+ function displayPeopleAlsoSearch(data) {
191
+ peopleAlsoSearchList.innerHTML = "";
192
+ data.forEach((item) => {
193
+ const listItem = document.createElement("li");
194
+ const link = document.createElement("a");
195
+ link.href = item.url;
196
+ link.textContent = item.text;
197
+ link.target = "_blank";
198
+ link.rel = "noopener noreferrer";
199
+ listItem.appendChild(link);
200
+ peopleAlsoSearchList.appendChild(listItem);
201
  });
202
+ peopleAlsoSearchSection.style.display = data.length > 0 ? "block" : "none";
203
+ }
204
+
205
+ // Function to display search results
206
+ function displayResults(results) {
207
+ resultsContainer.innerHTML = "";
208
+ if (results.length === 0) {
209
+ displayError("No results found.");
210
+ return;
211
+ }
212
+ results.forEach((result) => {
213
+ const resultElement = document.createElement("div");
214
+ resultElement.classList.add("result");
215
+ const titleElement = document.createElement("h3");
216
+ const titleLink = document.createElement("a");
217
+ titleLink.href = result.href;
218
+ titleLink.textContent = result.title;
219
+ titleLink.target = "_blank";
220
+ titleLink.rel = "noopener noreferrer";
221
+ titleElement.appendChild(titleLink);
222
+ const urlElement = document.createElement("div");
223
+ urlElement.classList.add("url");
224
+ urlElement.textContent = result.href;
225
+ const descriptionElement = document.createElement("p");
226
+ descriptionElement.textContent = result.body;
227
+ resultElement.appendChild(titleElement);
228
+ resultElement.appendChild(urlElement);
229
+ resultElement.appendChild(descriptionElement);
230
+ resultsContainer.appendChild(resultElement);
231
  });
232
+ }
233
+
234
+ // Function to display an error message
235
+ function displayError(message) {
236
+ resultsContainer.innerHTML = "";
237
+ const errorElement = document.createElement("p");
238
+ errorElement.textContent = message;
239
+ errorElement.style.color = "red";
240
+ resultsContainer.appendChild(errorElement);
241
+ }
242
+
243
+ // Function to toggle the settings menu
244
+ function toggleSettings() {
245
+ const settingsMenu = document.getElementById("settings-menu");
246
+ settingsMenu.style.display = settingsMenu.style.display === "block" ? "none" : "block";
247
+ }
248
+
249
+ // Event listeners for search input and form submission
250
+ searchQueryInput.addEventListener("input", async () => {
251
+ const searchQuery = searchQueryInput.value;
252
+ if (searchQuery.trim() === "") {
253
+ suggestionsContainer.style.display = "none";
254
+ return;
255
+ }
256
+ const suggestions = await fetchSuggestions(searchQuery);
257
+ displaySuggestions(suggestions);
258
+ });
259
+
260
+ searchQueryInput.addEventListener("focus", () => {
261
+ if (searchQueryInput.value.trim() !== "") {
262
  suggestionsContainer.style.display = "block";
263
  }
264
+ });
265
 
266
+ document.addEventListener("click", (event) => {
267
+ if (!searchForm.contains(event.target)) {
268
+ suggestionsContainer.style.display = "none";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
269
  }
270
+ });
271
 
272
+ searchForm.addEventListener("submit", async (event) => {
273
+ event.preventDefault();
274
+ const searchQuery = searchQueryInput.value;
275
+ performSearch(searchQuery);
276
+ });
277
+ </script>
278
+ </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
  </html>