-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
505 lines (430 loc) · 17.4 KB
/
index.html
File metadata and controls
505 lines (430 loc) · 17.4 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EFROTales Catalog</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #f7f9fc;
margin: 0;
padding: 0;
line-height: 1.6;
}
/* Navbar */
.navbar {
background-color: #333;
color: #fff;
padding: 15px 20px;
display: flex;
max-width: 900px;
margin: 40px auto;
padding: 20px;
justify-content: space-between;
align-items: center;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.navbar h1 {
margin: 0;
font-size: 24px;
letter-spacing: 2px;
}
.navbar nav a {
color: #fff;
text-decoration: none;
margin-left: 20px;
font-size: 16px;
}
.navbar nav a:hover {
text-decoration: underline;
}
/* Main Content */
.catalog {
max-width: 900px;
margin: 40px auto;
padding: 20px;
background-color: #fff;
border-radius: 12px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
/* Search Bar */
.search-bar {
margin-bottom: 30px;
display: flex;
justify-content: space-between;
align-items: center;
gap: 10px;
}
.search-bar input[type="text"] {
width: 100%;
padding: 12px 18px;
font-size: 16px;
border: 1px solid #ddd;
border-radius: 8px;
outline: none;
transition: border-color 0.3s ease;
}
.search-bar input[type="text"]:focus {
border-color: #007BFF;
}
.search-bar button {
padding: 12px 20px;
border: none;
border-radius: 8px;
background-color: #007BFF;
color: #fff;
cursor: pointer;
transition: background-color 0.3s ease;
}
.search-bar button:hover {
background-color: #0056b3;
}
/* Tagging System */
.tags {
margin-bottom: 30px;
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.tag {
background-color: #007BFF;
color: #fff;
padding: 8px 16px;
border-radius: 20px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.tag:hover {
background-color: #0056b3;
}
.tag.selected {
background-color: #0056b3;
}
/* Story Card */
.story {
background-color: #fafafa;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
transition: transform 0.3s ease;
}
.story:hover {
transform: translateY(-5px);
}
.story h2 {
margin: 0;
font-size: 22px;
color: #333;
}
.story p {
color: #555;
margin-bottom: 10px;
}
.story a {
color: #007BFF;
text-decoration: none;
font-weight: bold;
}
.story a:hover {
text-decoration: underline;
}
/* Matches Section */
.matches-section {
margin-bottom: 20px;
}
.matches-section h3 {
font-size: 20px;
margin-bottom: 10px;
color: #333;
}
.faded {
color: #888;
}
/* Ad Banners on the Sides */
.side-ad {
position: fixed;
top: 50%;
transform: translateY(-50%);
z-index: 1000;
background-color: #eaeaea;
text-align: center;
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
transition: top 0.3s ease; /* Smooth transition for vertical movement */
}
.side-ad-left {
left: 10px;
}
.side-ad-right {
right: 10px;
}
.side-ad img {
max-width: 100%;
height: auto;
border-radius: 8px;
}
/* Hide side ads on mobile */
@media (max-width: 1400px) {
.side-ad {
display: none !important;
}
}
</style>
</head>
<body>
<div class="navbar">
<h1>EFROTales</h1>
<nav>
<a href="/EFROTales/hub.html">Stories</a>
<a href="/hub.html">EFRO.AI</a>
<a href="/EFROTales/editor.html">Editor</a>
<a href="https://discord.gg/E7TRzsEMkD">Discord</a>
<a href="/EFROTales/features.html">Upcoming Features</a>
</nav>
</div>
<!-- Left Side Ad -->
<div class="side-ad side-ad-left">
<script async type="application/javascript" src="https://a.magsrv.com/ad-provider.js"></script>
<ins class="eas6a97888e2" data-zoneid="5467192"></ins>
<script>(AdProvider = window.AdProvider || []).push({"serve": {}});</script>
</div>
<!-- Right Side Ad -->
<div class="side-ad side-ad-right">
<script async type="application/javascript" src="https://a.magsrv.com/ad-provider.js"></script>
<ins class="eas6a97888e2" data-zoneid="5467192"></ins>
<script>(AdProvider = window.AdProvider || []).push({"serve": {}});</script>
</div>
<div class="catalog">
<!-- Search Bar -->
<div class="search-bar">
<input type="text" id="searchInput" placeholder="Search for stories...">
<button>Search</button>
</div>
<!-- Tagging System -->
<div class="tags">
<span class="tag" onclick="toggleTagSelection(this, 'Reader-Insert')">{Reader-Insert}</span>
<span class="tag" onclick="toggleTagSelection(this, 'Skunk')">Skunk</span>
<span class="tag" onclick="toggleTagSelection(this, 'Fart')">Fart</span>
<span class="tag" onclick="toggleTagSelection(this, 'Burp')">Burp</span>
<span class="tag" onclick="toggleTagSelection(this, 'Fantasy')">Fantasy</span>
<span class="tag" onclick="toggleTagSelection(this, 'Romantic Comedy')">Romantic Comedy</span>
<span class="tag" onclick="toggleTagSelection(this, 'Adventure')">Adventure</span>
</div>
<!-- Matches Sections -->
<div class="matches-section" id="exactMatches">
<h3>Exact Matches</h3>
</div>
<div class="matches-section" id="nearMatches">
<h3>Near Matches</h3>
</div>
<div class="matches-section" id="closeMatches">
<h3>Close Matches</h3>
</div>
<div class="matches-section" id="looseMatches">
<h3>Partial Matches</h3>
</div>
<div class="matches-section" id="possibleMatches">
<h3>Could this be what you're looking for?</h3>
</div>
<!-- Story List -->
<div class="story" data-tags="{{Reader-Insert}}, [Skunks]">
<h2><a href="/EFROTales/Stories/The Pillory.html">The Pillory</a></h2>
<p><b>Author:</b> SolamenteCelia</p>
<p><i>Topics:</i> {{Reader-Insert}}, Skunk</p>
<p>When a rotten man is locked up in the pillory, a skunk he'd wronged takes the opportunity to get her revenge on him.</p>
</div>
<div class="story" data-tags="{{Reader-Insert}}, [Skunks], [Farts], [Burps]">
<h2><a href="/EFROTales/Stories/Skunked by a Dare - An Unexpected Romance.html">Skunked by a Dare: An Unexpected Romance</a></h2>
<p><b>Author:</b> TigerT2173</p>
<p><i>Topics:</i> {{Reader-Insert}}, [Skunks], [Farts], [Burps]</p>
<p>During a game of Truth or Dare, homeless skunk girl, Aimee is dared to ask you out!</p>
</div>
<!-- <div class="story" data-tags="Fantasy">
<h2><a href="story1.html">The Skunk Hybrid's Dilemma</a></h2>
<p><i>Genre:</i> Fantasy</p>
<p>A tale of a skunk hybrid girl navigating a world where she's seen as an outcast due to her unique abilities and challenges.</p>
</div>
<div class="story" data-tags="Romantic Comedy">
<h2><a href="story2.html">Midnight at MicroCenter</a></h2>
<p><i>Genre:</i> Romantic Comedy</p>
<p>A quirky romance unfolds when two socially awkward individuals meet at a computer store after hours.</p>
</div>
<div class="story" data-tags="Adventure">
<h2><a href="story3.html">The Quest for the Perfect PC</a></h2>
<p><i>Genre:</i> Adventure</p>
<p>Follow a group of friends as they embark on an epic journey to build the ultimate gaming PC, facing unexpected challenges along the way.</p>
</div> -->
<!-- Add more stories as needed -->
</div>
<script>
let selectedTags = new Set();
let searchInTitle = false; // Default to searching all content
document.getElementById('searchInput').addEventListener('keyup', function() {
const input = this.value.toLowerCase();
filterStories(input, selectedTags);
});
function toggleTagSelection(tagElement, tag) {
if (selectedTags.has(tag)) {
selectedTags.delete(tag);
tagElement.classList.remove('selected');
} else {
selectedTags.add(tag);
tagElement.classList.add('selected');
}
filterStories(document.getElementById('searchInput').value.toLowerCase(), selectedTags);
}
function filterStories(input, tags) {
const stories = document.getElementsByClassName('story');
const storiesArray = Array.from(stories);
const exactMatches = [];
const nearMatches = [];
const closeMatches = [];
const looseMatches = [];
const possibleMatches = [];
let anyStoryVisible = true;
// Normalize input
const normalizedInput = input.toLowerCase().trim();
// Create a regular expression for the input, ignoring case
const regex = new RegExp(normalizedInput.split(' ').map(word => `(?=.*${word})`).join(''), 'i');
storiesArray.forEach(story => {
const title = story.querySelector('h2').innerText.toLowerCase();
const content = story.innerText.toLowerCase();
const storyTags = story.getAttribute('data-tags').split(', ').map(tag => tag.toLowerCase());
// Normalize tags for matching
const normalizedTags = storyTags.map(tag => tag.trim());
//For percent Revelvance
const numberOfSelectedTags = tags.size;
let matchCount = 0;
tags.forEach(tag => {
const normalizedTag = tag.toLowerCase().replace(/s$/, '');
if (normalizedTags.some(storyTag => storyTag.includes(normalizedTag))) {
matchCount++;
}
});
// Check if the normalized input partially matches any tag
const matchesATag = Array.from(tags).some(tag => normalizedTags.some(storyTag => storyTag.includes(tag.toLowerCase())));
//const matchesATags = Array.from(tags).some(tag => storyTags.includes(tag));
const matchesTags = Array.from(tags).every(tag => normalizedTags.some(storyTag => storyTag.includes(tag.toLowerCase())));
//const matchesTags = Array.from(tags).every(tag => storyTags.includes(tag));
const matchesContent = searchInTitle ? regex.test(title) : regex.test(content);
if (matchesATag || matchesTags || matchesContent) {
let score = 0;
let isExactMatch = false;
let isNearMatch = false;
let isCloseMatch = false;
let isPossibleMatch = false;
const percentofselectedtags = (matchCount/numberOfSelectedTags)*100;
// Check for exact matches
// Slider functionality
if (searchInTitle && title.includes(input) && matchesTags) {
score = 2; // Full match on title
isExactMatch = true;
} else if (!searchInTitle && content.includes(input) && matchesTags) {
score = 2; // Full match on content
isExactMatch = true;
} else if (searchInTitle && title.includes(input) && percentofselectedtags > 90) {
score = 2; // Full match on title
isExactMatch = true;
} else if (!searchInTitle && content.includes(input) && percentofselectedtags > 90) {
score = 2; // Full match on content
isExactMatch = true;
} else if (searchInTitle && title.includes(input) && percentofselectedtags > 60) {
score = 2; // Full match on title
isNearMatch = true;
} else if (!searchInTitle && content.includes(input) && percentofselectedtags > 60) {
score = 2; // Full match on content
isNearMatch = true;
} else if (searchInTitle && title.includes(input) && percentofselectedtags > 30) {
score = 2; // Full match on title
isCloseMatch = true;
} else if (!searchInTitle && content.includes(input) && percentofselectedtags > 30) {
score = 2; // Full match on content
isCloseMatch = true;
} else if (searchInTitle && title.includes(input) && percentofselectedtags > 1) {
score = 1; // Partial match on title
isPossibleMatch = true;
} else if (!searchInTitle && content.includes(input) && percentofselectedtags > 1) {
score = content.startsWith(input) ? 2 : 1; // Full or partial match on content
isPossibleMatch = true;
}
if (isExactMatch) {
exactMatches.push(story);
} else if (isNearMatch) {
nearMatches.push(story);
} else if (isCloseMatch) {
closeMatches.push(story);
} else if (isPossibleMatch) {
looseMatches.push(story);
} else if (matchesContent) {
possibleMatches.push(story);
}
anyStoryVisible = true;
}
});
// Clear previous results
//document.getElementById('exactMatches').innerHTML = '<h3>Exact Matches</h3>';
// document.getElementById('closeMatches').innerHTML = '<h3>Close Matches</h3>';
// Display exact matches
exactMatches.forEach(story => {
document.getElementById('exactMatches').appendChild(story);
});
// Display near matches
nearMatches.forEach(story => {
document.getElementById('nearMatches').appendChild(story);
});
// Display close matches
closeMatches.forEach(story => {
document.getElementById('closeMatches').appendChild(story);
});
possibleMatches.forEach(story => {
document.getElementById('possibleMatches').appendChild(story);
});
looseMatches.forEach(story => {
document.getElementById('looseMatches').appendChild(story);
});
// Ensure all stories not in either match section are displayed if no filter is applied
storiesArray.forEach(story => {
if (!exactMatches.includes(story) && !nearMatches.includes(story) && !closeMatches.includes(story) && !possibleMatches.includes(story) && !looseMatches.includes(story)) {
story.style.display = 'none';
} else {
story.style.display = '';
}
});
// If no filters are applied, ensure all stories are visible
if (!anyStoryVisible) {
storiesArray.forEach(story => {
story.style.display = '';
});
}
}
</script>
<script>
const socket = new WebSocket('wss://efroai.net'); // Update with your domain
// Connection opened
socket.addEventListener('open', (event) => {
console.log('Connected to WebSocket server');
});
// Listen for messages
socket.addEventListener('message', (event) => {
console.log('Message from server:', event.data);
// Handle ping or any other messages from the server
if (event.data === 'ping') {
// You can respond to pings if needed
socket.send('pong'); // Example response
}
});
// Connection closed
socket.addEventListener('close', (event) => {
console.log('Disconnected from WebSocket server');
});
const adElement = document.querySelector('.side-ad img');
adElement.onload = function() {
// The ad image has loaded, now you can display it fully
adElement.style.display = 'block';
};
</script>
</body>
</html>