-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.vue
122 lines (115 loc) · 2.97 KB
/
error.vue
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
<template>
<div id="error-page">
<div @click="goBack">
<BackgroundEffect></BackgroundEffect>
<div align="center">
<h1 id="hacked" data-value="404">
<text @mouseover="hackedText404" class="text">{{ notFound }}</text>
</h1>
<h3 id="hacked2" @mouseover="hackedTextFNF">
<text class="text">{{ errMessage }}</text>
</h3>
<h4 style="color: var(--dark); font-family: 'Space Mono', 'monospace'">
Click anywhere to go back
</h4>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
@import url("https://fonts.googleapis.com/css2?family=Space+Mono&display=swap");
$text-col: black;
$back-col: white;
body {
display: grid;
place-items: center;
height: 100vh;
background-color: $back-col;
margin: 0rem;
overflow: hidden;
}
#hacked {
font-family: "Space Mono", monospace;
font-size: 25vh;
color: $back-col !important;
padding: 0rem clamp(1rem, 2vw, 3rem);
}
#hacked2 {
font-family: "Space Mono", monospace;
font-size: clamp(2rem, 4vw, 4rem);
color: $back-col;
padding: 0rem clamp(1rem, 2vw, 3rem);
}
.text:hover {
background-color: $back-col;
color: $text-col;
border-radius: clamp(0.4rem, 0.75vw, 1rem);
opacity: 0.9;
}
</style>
<script>
export default {
data() {
return {
notFound: "",
errMessage: "",
preserverErr: "",
preserverMsg: "",
interval: 0,
iteration: 0,
error: useError(),
};
},
mounted() {
this.notFound = this.error.statusCode.toString();
this.errMessage = this.error.message.toString();
this.preserverErr = this.error.statusCode.toString();
this.preserverMsg = this.error.message.toString();
},
methods: {
hackedText404() {
let iteration = 0;
const numbers = "1234567890";
const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
let interval = setInterval(() => {
this.notFound = this.notFound
.split("")
.map((letter, index) => {
if (index < iteration) {
return this.preserverErr[index];
}
return numbers[Math.floor(Math.random() * 10)];
})
.join("");
if (iteration >= this.preserverErr.length) {
clearInterval(interval);
}
iteration += 1 / 10;
}, 50);
},
hackedTextFNF() {
let iteration = 0;
const numbers = "1234567890";
const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
let interval = setInterval(() => {
this.errMessage = this.errMessage
.split("")
.map((letter, index) => {
if (index < iteration) {
return this.preserverMsg[index];
}
return letters[Math.floor(Math.random() * 10)];
})
.join("");
if (iteration >= this.preserverMsg.length) {
clearInterval(interval);
}
iteration += 1 / 2;
}, 20);
},
goBack() {
clearError({ redirect: "/" });
},
},
};
</script>