-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.script.mjs
79 lines (69 loc) · 2.64 KB
/
index.script.mjs
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
/* @license
Daltro Augusto's Portfolio
Copyright (C) 2021 Daltro Augusto
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// @ts-nocheck
import LocaleLoader from "./libs/localeloader/localeloader.js";
import Metaloader from "./libs/metaloader/metaloader.js";
const $ = el => document.querySelector(el);
const $$ = els => document.querySelectorAll(els);
const locales = new LocaleLoader("./locales/index.json");
locales
.initialize()
.then(() => {
Metaloader({
title: locales.getString("title"),
description: locales.getString("slogan"),
author: "Daltro Augusto",
locale: locales.locale,
url: "https://daltroaugusto.github.io/portfolio/",
site_name: locales.getString('title'),
viewport: "width=device-width, initial-scale=1.0"
});
})
.then(() => {
tippy(".social-links i.fa-linkedin-in", {
content: "LinkedIn",
placement: "bottom",
});
tippy(".social-links i.fa-shopping-cart", {
content: locales.getString("socialBuy"),
placement: "bottom",
});
tippy(".social-links i.fa-graduation-cap", {
content: locales.getString("socialAcademic"),
placement: "bottom",
});
})
.then(() => {
return fetch("./ejs/sites.ejs");
})
.then(r => r.text())
.then(sitestemplate => {
const html = ejs.render(sitestemplate, {
sites: locales.getString("sites"),
viewSiteCaption: locales.getString("seeSite"),
viewSourceCaption: locales.getString("seeSource"),
});
$("main div.sites").innerHTML = html;
})
.then(() => {
$$(".sites article[site-id]").forEach(site => {
const id = site.getAttribute("site-id");
new Swiper(`.sites article[site-id="${id}"] div.swiper`, {
loop: true,
autoplay: true,
navigation: {
nextEl: `.sites article[site-id="${id}"] div.swiper .swiper-button-next`,
prevEl: `.sites article[site-id="${id}"] div.swiper .swiper-button-prev`,
},
});
});
})
.then(() => {
$('header').style.opacity = '1';
$('main').style.opacity = '1';
});