Skip to content

Commit

Permalink
update fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeiel Lima Miranda committed Apr 11, 2024
1 parent 1144ec4 commit da2ed3e
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 30 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# quiz-jeiel
> Holy Bible
>Um aplicativo-web feito por: Jeiel Lima Miranda.
## Você pode contribuir adicionando mais perguntas em "bible.json".
### Você pode contribuir adicionando mais perguntas em "bible.json".

Para ajudar na **contribuição**, segue o formato:

```json
{
"question": "Quem foi o filho de Davi e pai de Salomão?",
Expand All @@ -20,4 +18,8 @@ Para ajudar na **contribuição**, segue o formato:
"reference": "Mateus 1:6"
}
```
Se também encontrar alguma pergunta que não está na Bíblia Sagrada ou não está correto suas respostas; envie para `[email protected]` ou corrige, para que todos possam ter possibilidades de estudarem e atestarem seus conhecimentos.
Se também encontrar alguma pergunta que não está na Bíblia Sagrada ou não está correto suas respostas; envie para `[email protected]` ou corrige, para que todos possam ter possibilidades de estudarem e atestarem seus conhecimentos.

#

> O aplicativo quando adicionado ao smartphone, não funciona no offline! Verifique sua conexão de internet.
73 changes: 73 additions & 0 deletions offline-page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>README.md</title>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
padding: 20px;
}

.markdown-container {
max-width: 800px;
margin: 0 auto;
}

.markdown-content {
background-color: #f7f7f7;
padding: 20px;
border-radius: 5px;
}

h1, h2, h3, h4, h5, h6 {
margin-top: 0;
}

p {
margin-bottom: 1.5em;
}

code {
background-color: #f0f0f0;
padding: 0.2em 0.4em;
border-radius: 3px;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
}
</style>
</head>
<body>
<div class="markdown-container">
<div class="markdown-content" id="markdown-content">
<!-- Conteúdo do README.md será inserido aqui -->
</div>
</div>

<script>
// Função para carregar o conteúdo do arquivo README.md
function loadReadme() {
fetch('README.md')
.then(response => response.text())
.then(text => {
// Converte o conteúdo markdown para HTML
const converter = new showdown.Converter();
const html = converter.makeHtml(text);

// Insere o HTML convertido na página
document.getElementById('markdown-content').innerHTML = html;
})
.catch(error => {
console.error('Erro ao carregar o README.md:', error);
});
}

// Carrega o README.md quando a página é carregada
window.onload = loadReadme;
</script>

<!-- Biblioteca Showdown para converter Markdown para HTML -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/showdown.min.js"></script>
</body>
</html>
46 changes: 20 additions & 26 deletions service-worker.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
self.addEventListener('install', function(event) {
event.waitUntil(
caches.open('quiz-cache').then(function(cache) {
return cache.addAll([
'/',
'/index.html',
'/script.js',
'/style.css',
'/manifest.json',
'/icon.png',
'/bible.json',
'/resultado.html'
// Adicione outros recursos do seu aplicativo aqui
]);
})
);
});

self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request).then(function(response) {
return response || fetch(event.request);
})
);
});

// Verifica se o serviço Worker está offline
function isServiceWorkerOffline() {
return !navigator.onLine;
}

// Função para redirecionar para a página offline
function redirectToOfflinePage(event) {
event.respondWith(
fetch(event.request).catch(function() {
return caches.match('/offline-page.html');
})
);
}

// Adiciona um ouvinte para o evento 'fetch' para interceptar as requisições de rede
self.addEventListener('fetch', function(event) {
if (isServiceWorkerOffline()) {
redirectToOfflinePage(event);
}
});

0 comments on commit da2ed3e

Please sign in to comment.