Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
oh14.de Links
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alex Reinhardt
oh14.de Links
Commits
ae913eef
Unverified
Commit
ae913eef
authored
Apr 21, 2021
by
Jonas Zohren
Browse files
Options
Downloads
Patches
Plain Diff
Add fuzzy search for valid shortlink on 404 page
parent
ee8641c7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
public/404.html
+37
-6
37 additions, 6 deletions
public/404.html
public/cdnjs.cloudflare.com/fuse.js@6.4.6.js
+9
-0
9 additions, 0 deletions
public/cdnjs.cloudflare.com/fuse.js@6.4.6.js
with
46 additions
and
6 deletions
public/404.html
+
37
−
6
View file @
ae913eef
...
@@ -10,11 +10,22 @@
...
@@ -10,11 +10,22 @@
</head>
</head>
<body>
<body>
<section
class=
"hero is-primary is-bold"
>
<section
class=
"hero
is-small
is-primary is-bold"
>
<div
class=
"hero-body"
>
<div
class=
"hero-body"
>
<div
class=
"container has-text-centered"
>
<div
class=
"container has-text-centered"
>
<h1
class=
"title"
>
404 Not Found
</h1>
<h1
class=
"title"
>
404 - Diese Seite existiert nicht
</h1>
<h2
class=
"subtitle"
>
Diese Seite existiert nicht 😞
</h2>
</div>
</div>
</section>
<section
class=
"is-invisible hero is-success is-bold"
id=
"suggestion-section"
>
<div
class=
"hero-body"
>
<div
class=
"container has-text-centered"
>
<h2
class=
"subtitle"
>
Vielleicht suchst du nach
</h2>
<h1
class=
"title is-family-monospace"
>
<a
id=
"suggestion-href"
style=
"text-decoration: underline;"
href=
"#"
>
oh14.de/
<span
id=
"suggestion-text"
>
test
</span>
</a>
</h1>
</div>
</div>
</div>
</div>
</section>
</section>
...
@@ -29,7 +40,6 @@
...
@@ -29,7 +40,6 @@
<div
class=
"column is-5"
>
<div
class=
"column is-5"
>
<div
class=
"container"
>
<div
class=
"container"
>
<p
class=
"is-size-5"
>
Das ist jetzt blöd gelaufen.
</p>
<p
class=
"is-size-5"
>
Das ist jetzt blöd gelaufen.
</p>
<p>
Vielleicht möchtest du Folgendes ausprobieren:
</p>
<div
class=
"buttons medium-margin-top"
>
<div
class=
"buttons medium-margin-top"
>
<a
href=
"https://fsinfo.cs.tu-dortmund.de"
class=
"button is-primary"
>
<a
href=
"https://fsinfo.cs.tu-dortmund.de"
class=
"button is-primary"
>
Zur Startseite
Zur Startseite
...
@@ -50,6 +60,27 @@
...
@@ -50,6 +60,27 @@
</body>
</body>
</html>
</html>
<script>
if
(
document
.
referrer
!==
""
)
{
<script>
if
(
document
.
referrer
!==
""
)
{
document
.
getElementById
(
"
goback
"
).
classList
.
remove
(
"
is-invisible
"
)
document
.
getElementById
(
"
goback
"
).
classList
.
remove
(
"
is-invisible
"
)
}
</script>
}
\ No newline at end of file
</script>
<script
src=
"cdnjs.cloudflare.com/fuse.js@6.4.6.js"
></script>
<script>
async
function
addFuzzySearch
()
{
const
vanityMap
=
await
(
await
fetch
(
"
./vanitymap.json
"
)).
json
()
const
keys
=
Object
.
keys
(
vanityMap
);
const
fuse
=
new
Fuse
(
keys
,
{})
const
pathToSearchFor
=
window
.
location
.
pathname
.
replace
(
"
/
"
,
""
).
replace
(
"
.html
"
,
""
).
trim
();
const
results
=
fuse
.
search
(
pathToSearchFor
)
if
(
results
.
length
!==
0
)
{
const
bestShortlink
=
results
[
0
].
item
;
const
bestHref
=
vanityMap
[
bestShortlink
];
document
.
getElementById
(
"
suggestion-text
"
).
innerText
=
bestShortlink
;
document
.
getElementById
(
"
suggestion-href
"
).
href
=
bestHref
;
document
.
getElementById
(
"
suggestion-section
"
).
classList
.
remove
(
"
is-invisible
"
);
}
}
addFuzzySearch
()
</script>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
public/cdnjs.cloudflare.com/fuse.js@6.4.6.js
0 → 100644
+
9
−
0
View file @
ae913eef
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment