-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
331 lines (328 loc) · 15.2 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
<!----------------------------------
@eleander56 eleander@hobbylos.online
----------------------------------->
<!DOCTYPE html>
<html lang="de">
<head>
<script rel="preconnect" src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta property="og:url" content="https://search.hobbylos.online/">
<meta property="og:image" content="https://hobbylos.online/img/search.PNG">
<meta property="og:description" content="Hobbylos durchsuchen. Die Suchemaschine für alles, was bisher im Podcast gesagt wurde.">
<meta property="og:title" content="Hobbylos Suche - Search für Hobbylos, den Podcast Nr. 1">
<meta name="description" content="Hobbylos durchsuchen. Die Suchemaschine für alles, was bisher im Podcast gesagt wurde."/>
<meta name="keywords" content="Hobbylos Search, Suchmaschine, Search, Hobbylos, suchen, Hobbylos durchsuchen, Rezo, Julien Bam, Julien, Bam, Lobbyhoes, Nerds">
<meta name="robots" content="index, follow">
<meta name="audience" content="Alle">
<meta http-equiv="content-language" content="de">
<meta name="page-topic" content="entertainment">
<link href="css/init.css" rel="stylesheet" type="text/css">
<link href="css/main.css" rel="stylesheet" type="text/css">
<link href="images/favicon.png" rel="shortcut icon" type="image/x-icon">
<link href="images/favicon.png" rel="apple-touch-icon">
<script>
function get_query_param(name) {
const urlSearchParams = new URLSearchParams(window.location.search);
return urlSearchParams.get(name);
}
function set_title_from_query_param() {
const qValue = get_query_param('q');
if (qValue !== null) {
document.title = qValue + " - Hobbylos Suche";
}
else{
document.title = "Hobbylos Suche - Search für Hobbylos, den Podcast Nr. 1";
}
}
window.onload = set_title_from_query_param;
</script>
<style>
#election-banner {
background-color: #a900ff52;
color: #039;
font-weight: bold;
text-align: center;
padding: 20px;
margin-bottom: 20px;
font-size: 24px;
text-shadow: 2px 2px 20px #00000063;
line-height: normal;
text-transform: none;
}
#election-banner a {
color: #000;
text-decoration: underline;
}
#election-subtitle {
color: #000;
font-size: 18px;
margin-top: 10px;
}
#demokratie {
color: #039;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
/* position: absolute; */
font-size: medium;
background-color: #f1f1f1;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #ddd;}
.dropbtn {
/* background-color: #4CAF50; */
/* color: white; */
padding: 5px;
font-size: 16px;
border: none;
cursor: pointer;
}
/* .dropdown:hover .dropbtn {background-color: #3e8e41;} */
</style>
</head>
<body class="body" style="text-transform: uppercase;">
<section class="section-2">
<div class="navigation-wrapper">
<a href="./index.html" class="navi-link w-inline-block">
<h3 class="heading">Home</h3>
</a>
<!-- <a href="https://search.hobbylos.online/higher-lower" target="_blank" class="navi-link w-inline-block">
<h3 class="heading">Zum Higher Lower Game (old)</h3>
</a> -->
<a href="#instagram" class="navi-link w-inline-block">
<h3 class="heading">Über uns </h3>
</a>
<a href="https://api.whatsapp.com/send?phone=+4915678159173&text=Hey%20ich%20war%20auf%20https://search.hobbylos.online/%20und%20habe%20eine%20Frage/Feedback/einen%20Fehler%20gefunden:%0A" target="_blank" class="navi-link w-inline-block">
<h3 class="heading">Kontakt</h3>
</a>
</div>
</section>
<section class="search-wrapper" style="font-family: sans-serif;">
<!-- <article class="container-fluid">
<div id="election-banner">
<a href="vote">Hobbylos wird 3 Jahre alt<br>
<div id="election-subtitle">
aus diesem Anlass wird der beste Hobbylos Moment gesucht. Falls du deinen besten Hobbylos Moment schon gefunden hast kannst du hier Abstimmen: <span style="color: #dff3ff;">Voting</span>
</div>
</a>
</div>
</article> -->
<form action="/" class="search w-form" id="searchForm">
<input type="search" class="search-input w-input" maxlength="256" name="word" placeholder="Search…" id="search_term" required="" style="text-transform: uppercase;">
</form>
<div class="dropdown">
<button class="dropbtn" onclick="toggleDropdown()" id="dropdown-button">Sortieren nach:</button>
<div id="dropdownContent" class="dropdown-content">
<a href="#" onclick="selectOption('')">Relevanz</a>
<a href="#" onclick="selectOption('forward')">neu -> alt</a>
<a href="#" onclick="selectOption('reverse')">alt -> neu</a>
</div>
</div>
</section>
<section class="season-text-box-wrapper" id="season-text-box-wrapper" style="font-family: sans-serif;">
<div style="font-family: Arial, Helvetica, sans-serif; text-transform: none; line-height: normal; font-size: large; max-width: 550px; text-shadow: 0px 4px 9px black;">
Wenn du dran interessiert bis wie die Suche Funktioniert: Ich habe der KI "NotebookLM" von Google mal alle Code-Dateien der Suchmaschine zur Verfügung gestellt und einen kleinen Podcast erstellen lassen. :)<br>
<audio controls>
<source src="./audio/Hobbylos-Search.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
</section>
<section class="ende" id="ende">
<section id="instagram" class="section-4">
<div class="div-block">
<div class="text-block-2">made by</div>
</div>
<a href="https://www.instagram.com/emill.brt" target="_blank" class="link-block-16 w-inline-block">
<div class="text-block-3">@emill.brt</div>
</a>
<div class="text-block-2-0">designed by</div>
<a href="https://instagram.com/claudia.sofia_02" target="_blank" class="link-block-17 w-inline-block">
<div class="text-block-4">@claudia.sofia_02</div>
</a>
</section>
<section class="section-3">
<div class="last-section-text-wrapper">
<a href="https://api.whatsapp.com/send?phone=+4915678159173&text=Hey%20ich%20war%20auf%20https://search.hobbylos.online/%20und%20habe%20eine%20Frage/Feedback/einen%20Fehler%20gefunden:%0A" target="_blank" class="link-block-5 w-inline-block">
<div class="text-block">Feedback</div>
</a>
<!-- <a href="https://search.hobbylos.online/rangliste" class="link-block-6 w-inline-block">
<div class="text-block">Rangliste </div>
</a> -->
<a href="datenschutz-impressum-usw.html" class="link-block-7 w-inline-block">
<div class="text-block">Datenschutz</div>
</a>
<a href="datenschutz-impressum-usw.html" class="link-block-8 link-block-9 link-block-10 link-block-11 link-block-12 link-block-13 link-block-14 link-block-15 w-inline-block">
<div class="text-block">impressum</div>
</a>
</div>
</section>
</section>
<!-- <script src="https://d3e54v103j8qbb.cloudfront.net/js/jquery-3.5.1.min.dc5e7f18c8.js?site=64d162998caccdf1e6474b4e" type="text/javascript" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script> -->
<script>
let convert_to_text = {"": "Relevanz", "forward":"neu -> alt", "reverse":"alt -> neu"}
let selectedOption = '';
const results_container = document.getElementById('season-text-box-wrapper');
const ende_element = document.getElementById("ende");
const search_term = document.getElementById('search_term');
const api_url = "https://api.hobbylos.online/?word=";
let previous = "";
let next = "";
let offset_value = get_query_variable("offset");
let limit_value = get_query_variable("limit");
let query_Value = get_query_variable("q");
let sort_value = get_query_variable("sort_by_time");
if (!offset_value) {offset_value = 0;}
if (!limit_value) {limit_value = 25;}
if (query_Value) {
set_title_from_query_param();
search_term.value = query_Value.split("+").join(" ");
if (!sort_value) {api_request(api_url + query_Value + "&offset="+offset_value+"&limit="+limit_value);}
else {
api_request(api_url + query_Value + "&offset="+offset_value+"&limit="+limit_value+"&sort_by_time="+sort_value);
document.getElementById("dropdown-button").innerText = convert_to_text[sort_value];
}
}
document.getElementById('searchForm').addEventListener("submit", event => {
event.preventDefault();
value_submited();
});
function display_error(error_type, error_message) {
results_container.innerHTML = '<div style="text-shadow: 1px 5px 10px rgba(100,0,0,0.75);"><h1 class="error">'+error_type+'</h1><p>'+error_message+'</p></div>'
}
function value_submited() {
results_container.innerHTML = '<h1 class="error" style="text-shadow: 1px 5px 10px rgba(0,0,0,0.75);">searching...</h1>';
update_get_url('q',search_term.value);
if (selectedOption) {api_request(api_url + search_term.value + "&sort_by_time=" + selectedOption);}
else {api_request(api_url + search_term.value);}
set_title_from_query_param();
}
function update_get_url(key, value){
if (window.history && window.history.pushState) {
let current_url = new URL(window.location.href);
current_url.searchParams.set(key, value);
window.history.pushState({ path: current_url.href }, '', current_url.href);
} else {console.log("Your browser dose not support history pushState");}
}
function api_request(search_url) {
fetch(search_url)
.then(response => response.json())
.then(data => {display_search_results(data);})
.catch(error => {display_error("loading error...",error);}
);
}
function display_search_results(data) {
results_container.innerHTML = '';
if (!data.Error) {
const link = document.createElement('span');
link.innerHTML = "Teile das Ergebniss mit deinen Freunden";
link.style = "color: #fff;border: 1px #000;font-size: 1.5em;font-weight: 400;line-height: 1em;";
link.addEventListener("click", function() {
if (navigator.share) {
navigator.share({
title: 'search.hobbylos.online',
text: `Schau dir mal die erhabenen Suchergebnisse zu ${search_term.value} an. 너`,
url: new URL(window.location.href),
})
.then(() => console.log('Successful share'))
.catch((error) => console.log('Error sharing:', error));
} else {console.log('Web Share API is not supported in your browser');}
});
results_container.appendChild(link);
i = 0;
try {
const count_all = document.createElement('h1');
count_all.innerHTML = data.count_all;
count_all.style = "text-shadow: 1px 1px 10px rgba(0,0,0,0.75); font-size: 3.5vw;";
results_container.appendChild(count_all);
} catch (error) {console.log(error);}
try {
console.log(data);
data.search.forEach(function(result) {
const sp_link = '<a href="https://open.spotify.com/episode/'+result.f+'?go=1&t='+result.s+'&utm_source=search.hobbylos.online" target="_blank" class="w-inline-block">'+result.text+'</a>';
const result_element = document.createElement('div');
result_element.innerHTML = `<div class="text-wrapper"><h4 class="heading-text-box">${result.n}<div class="text-wrapper">${sp_link}</div></h4>`;
result_element.classList = "season-text-box";
results_container.appendChild(result_element);
i = i + 1;
})
} catch (error) {
display_error("Vertippt?",search_term.value + " wurde nicht gefunden.");
return;
}
if ("previous" in data) {
previous = data.previous;
const previous_button = document.createElement('button');
previous_button.onclick = previous_results;
previous_button.innerHTML = "Previous";
previous_button.classList = "button";
previous_button.style = "font-size: 4vw; min-height: 5vw; max-height: 5vw; height: 30%; margin-top: 1vw; margin-bottom: 2vw;";
results_container.appendChild(previous_button);
}
try {
let von_wo_bis_wo;
if ("next" in data) {von_wo_bis_wo = document.createElement('span');}
else if ("previous" in data) {von_wo_bis_wo = document.createElement('span');}
else {von_wo_bis_wo = document.createElement('div');}
von_wo_bis_wo.innerHTML = " (" + data.v + " - " + data.b + ") ";
von_wo_bis_wo.style = "font-size: 4vw; min-height: 5vw; max-height: 5vw; height: 30%; margin-top: 1vw; margin-bottom: 2vw;";
results_container.appendChild(von_wo_bis_wo);
} catch (error) {console.log(error);}
try {
update_get_url("offset",data.v);
update_get_url("limit",data.b);
} catch (error) {console.log(error);}
if ("next" in data) {
next = data.next;
const next_button = document.createElement('button');
next_button.onclick = next_results;
next_button.innerHTML = "Next";
next_button.classList = "button";
next_button.style = "font-size: 4vw; min-height: 5vw; max-height: 5vw; height: 30%; margin-top: 1vw; margin-bottom: 2vw;";
results_container.appendChild(next_button);
}
ende_element.classList = "";
}else{results_container.innerHTML = '<h1 class="error" style="text-shadow: 1px 5px 10px rgba(100,0,0,0.75);">'+data.Error+'</h1>';}
}
function previous_results() {api_request(previous);}
function next_results() {api_request(next);}
function get_query_variable(variable) {
let query = window.location.search.substring(1);
let vars = query.split("&");
for (let i = 0; i < vars.length; i++) {
let pair = vars[i].split("=");
if (decodeURIComponent(pair[0]) === variable) {return decodeURIComponent(pair[1]);}
}
return null;
}
function toggleDropdown() {
var dropdownContent = document.getElementById("dropdownContent");
if (dropdownContent.style.display === "block") {
dropdownContent.style.display = "none";
document.getElementById("selectedOption").textContent = '';
selectedOption = '';}
else {dropdownContent.style.display = "block";}
}
function selectOption(option) {
selectedOption = option;
update_get_url("sort_by_time",option);
document.getElementById("dropdown-button").innerText = convert_to_text[option];
document.getElementById("dropdownContent").style.display = "none";
value_submited();
}
</script>
</body>
</html>