This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendMessage () { | |
idleButton() | |
var feedBack = document.getElementById('feedBack') | |
var question = document.getElementById("question").value.trim() | |
if (!question || question.length === 0){ | |
setError('Insira uma pergunta') | |
return | |
} | |
if (question === lastQuestion) { | |
setError('Você já perguntou isso....') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p id="feedBack"></p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var authenticated = false | |
var userAuthData = null | |
function handleAuthentication (authData) { | |
document.getElementById('accessContainer').style.display= 'none' | |
document.getElementById('questionsContainer').style.display= 'block' | |
authenticated = true | |
userAuthData = authData | |
document.getElementById('userName').innerHTML = authData.user.displayName | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="questionsContainer"> | |
<label for="question">Qual sua pergunta, <span id="userName"></span>?</label> | |
<input id="question" onfocus="clearMessage()" onKeyUp="checkEnter(event)"></input> | |
<p id="feedBack"></p> | |
<button id="sendButton" onClick="sendMessage()">Enviar</button> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="questionsContainer"> | |
<label for="question">Qual sua pergunta, <span id="userName"></span>?</label> | |
<input id="question"></input> | |
<p id="feedBack"></p> | |
<button id="sendButton" onClick="sendMessage()">Enviar</button> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var config = { | |
apiKey: "ALGUMA_CHAVE", | |
authDomain: "pergunteaodev.firebaseapp.com", | |
databaseURL: "https://pergunteaodev.firebaseio.com", | |
projectId: "pergunteaodev", | |
storageBucket: "", | |
messagingSenderId: "974289796926" | |
} | |
firebase.initializeApp(config) | |
var databaseRef = firebase.database().ref().child('questions') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
footer { | |
position: fixed; | |
bottom: 0; | |
width: 100%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#logo { | |
height: 10vh; | |
margin-bottom: 2rem; | |
} | |
label { | |
font-size: 1.5em; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://fonts.googleapis.com/css?family=Oswald" rel="stylesheet"> | |
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"> |