Skip to content

Instantly share code, notes, and snippets.

@edo9k
Last active November 29, 2019 17:44
Show Gist options
  • Save edo9k/30fb239881dbbc9e1c640e91879ae99d to your computer and use it in GitHub Desktop.
Save edo9k/30fb239881dbbc9e1c640e91879ae99d to your computer and use it in GitHub Desktop.
Página de Redirect (exemplo)
<!-- @format -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Diário LDI</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.8.0/css/bulma.min.css" />
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
</head>
<body>
<section class="section">
<div class="container">
<h1 class="title is-1">
Aviso
</h1>
<div class="content is-large">
<p>
Movemos o Diário para <strong><a href="http://ldi.ufes.br/diario">http://ldi.ufes.br/diario</a>.</strong>
</p>
<p>
As senhas e contas continuam as mesmas.
</p>
<p>
No caso de problemas, contate o suporte abrindo um ticket em
<a href="mailto:suporte.sead@ufes.br">suporte.sead@ufes.br</a>.
</p>
<p>Você será redirecionado em <span id="contagem">50</span> segundo<span id="s">s</span>.</p>
</div>
<div>
<img src="https://media2.giphy.com/media/f9vsEmv4NA9ry/source.gif" />
</div>
</div>
</section>
<script>
const main = () => {
const contagem = document.getElementById('contagem')
const s = document.getElementById('s')
const tempo = parseInt(contagem.innerText)
countDown(tempo)
}
const countDown = time => {
if (time === 0) {
/* redirect */
window.location.href = 'http://ldi.ufes.br/diario'
} else {
if (time === 1) s.innerText = ''
contagem.innerText = time
setTimeout(() => countDown(time - 1), 1000)
}
}
document.addEventListener('DOMContentLoaded', main)
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment