-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
212 lines (177 loc) · 7.6 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
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vue SPA</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/@phosphor-icons/web"></script>
<style>
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-track {
background: #18181b;
}
::-webkit-scrollbar-thumb {
background: #4444447a;
border-radius: 12px;
}
::-webkit-scrollbar-thumb:hover {
background: #444444;
}
/* transitions */
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.3s;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
</style>
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
height: {
'screen-minus-24': 'calc(100vh - 3rem)',
},
colors: {
'mine-shaft': {
'50': '#f6f6f6',
'100': '#e7e7e7',
'200': '#d1d1d1',
'300': '#b0b0b0',
'400': '#888888',
'500': '#6d6d6d',
'600': '#5d5d5d',
'700': '#4f4f4f',
'800': '#454545',
'900': '#333333',
'950': '#262626',
},
'plantation': {
'50': '#f4f9f7',
'100': '#dcebe5',
'200': '#b9d6cb',
'300': '#8ebaab',
'400': '#669b8a',
'500': '#4c8071',
'600': '#3b665a',
'700': '#304f47',
'800': '#2b443d',
'900': '#273a36',
'950': '#13201e',
},
},
}
}
}
</script>
</head>
<body>
<div id="app" class="bg-neutral-300 w-screen overflow-hidden h-screen flex flex-col">
<document-navbar></document-navbar>
<div class="flex-1 overflow-y-auto">
<router-view></router-view>
</div>
<!-- modals container -->
<transition name="fade">
<div v-if="activeModal" @click="activeModal = null"
class="fixed inset-0 w-screen h-screen flex bg-black bg-opacity-50 items-center justify-center"
style="z-index: 90">
<component @click.stop :is="activeModal"></component>
</div>
</transition>
</div>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="scripts/sfc-loader.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script>
const options = {
moduleCache: {
vue: Vue
},
async getFile(url) {
const res = await fetch(url);
if (!res.ok)
throw Object.assign(new Error(res.statusText + ' ' + url), { res });
return {
getContentData: asBinary => asBinary ? res.arrayBuffer() : res.text(),
}
},
addStyle(textContent) {
const style = Object.assign(document.createElement('style'), { textContent });
const ref = document.head.getElementsByTagName('style')[0] || null;
document.head.insertBefore(style, ref);
},
}
const { loadModule } = window['vue3-sfc-loader'];
const app = Vue.createApp({
components: {
'document-navbar': Vue.defineAsyncComponent(() => loadModule('./components/modules/document-navbar.vue', options)),
'example-modal': Vue.defineAsyncComponent(() => loadModule('./components/modals/example-modal.vue', options))
},
data() {
return {
activeModal: "",
info: {
name: "VUECDN"
}
}
},
methods: {
formatRelativeTime(dateTimeStr) {
const currentDate = new Date();
const providedDate = new Date(dateTimeStr);
// Calculate the timezone offset in minutes
const timezoneOffset = providedDate.getTimezoneOffset();
// Normalize the provided date by subtracting the offset and add an hour
providedDate.setMinutes(providedDate.getMinutes() - timezoneOffset);
const timeDifference = currentDate - providedDate;
// Define time intervals in milliseconds
const minute = 60 * 1000;
const hour = minute * 60;
const day = hour * 24;
const month = day * 30;
const year = day * 365;
if (timeDifference < minute) {
return "Just now";
} else if (timeDifference < hour) {
const minutesAgo = Math.floor(timeDifference / minute);
return `${minutesAgo} minute${minutesAgo > 1 ? 's' : ''} ago`;
} else if (timeDifference < day) {
const hoursAgo = Math.floor(timeDifference / hour);
return `${hoursAgo} hour${hoursAgo > 1 ? 's' : ''} ago`;
} else if (timeDifference < month) {
const daysAgo = Math.floor(timeDifference / day);
return `${daysAgo} day${daysAgo > 1 ? 's' : ''} ago`;
} else if (timeDifference < year) {
const monthsAgo = Math.floor(timeDifference / month);
return `${monthsAgo} month${monthsAgo > 1 ? 's' : ''} ago`;
} else {
const yearsAgo = Math.floor(timeDifference / year);
return `${yearsAgo} year${yearsAgo > 1 ? 's' : ''} ago`;
}
},
},
});
const router = VueRouter.createRouter({
history: VueRouter.createWebHashHistory(),
routes: [
{ path: '/', component: Vue.defineAsyncComponent(() => loadModule('./components/pages/home.vue', options)) },
{ path: '/home', component: Vue.defineAsyncComponent(() => loadModule('./components/pages/home.vue', options)) },
{ path: '/page-2', component: Vue.defineAsyncComponent(() => loadModule('./components/pages/page-2.vue', options)) },
// Add more routes as needed
],
});
app.use(router);
app.mount('#app');
</script>
</body>
</html>