-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost.html
More file actions
80 lines (70 loc) · 3.07 KB
/
post.html
File metadata and controls
80 lines (70 loc) · 3.07 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
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Thalles Sobral | Post</title>
<link rel="stylesheet" href="./assets/styles/style.css">
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
</head>
<body class="post-page">
<header>
<div id="perfil">
<h1 id="name">
<a href="index.html" style="text-decoration: none; color: inherit; display: flex; align-items: center; gap: 10px;">
<span style="font-size: 1.5rem;">←</span> Voltar
</a>
</h1>
</div>
<!-- SEÇÃO DO SELETOR DE TEMA -->
<div class="theme-switcher">
<button onclick="themeToggle.setTheme('light')">☀️ Light</button>
<button onclick="themeToggle.setTheme('dark')">🌙 Dark</button>
<button onclick="themeToggle.setTheme('system')">🖥️ System</button>
<script src="./assets/scripts/theme-toggle.js"></script>
</div>
<!-- FIM DA SEÇÃO DO SELETOR DE TEMA -->
<script src="./assets/scripts/fixed-header-top.js"></script>
</header>
<main>
<article id="gist-content" class="card post-content">
<div id="loading">Carregando conteúdo do Gist...</div>
</article>
</main>
<footer>
<div id="reserved-rights">
<p>© 2026 Thalles Sobral. Conteúdo via GitHub Gists.</p>
</div>
</footer>
<script>
const urlParams = new URLSearchParams(window.location.search);
const gistId = urlParams.get('id');
if (gistId) {
fetch(`https://api.github.com/gists/${gistId}`)
.then(response => response.json())
.then(data => {
const files = Object.values(data.files);
// Procuramos pelo primeiro arquivo markdown ou o primeiro arquivo disponível
const mdFile = files.find(f => f.language === 'Markdown') || files[0];
const content = mdFile.content;
// Renderiza o Markdown dentro da div
const container = document.getElementById('gist-content');
container.innerHTML = marked.parse(content);
// Atualiza o título da aba com o nome do arquivo
document.title = `${mdFile.filename} | Thalles Sobral`;
})
.catch(err => {
document.getElementById('gist-content').innerHTML = `
<h2>Erro ao carregar</h2>
<p>Não foi possível buscar o conteúdo. Verifique sua conexão ou o ID do Gist.</p>
<a href="index.html">Voltar para a home</a>
`;
console.error(err);
});
} else {
window.location.href = 'index.html';
}
</script>
</body>
</html>