Moved files from private to public repo for first release
This commit is contained in:
80
client/arvutus.html
Normal file
80
client/arvutus.html
Normal file
@ -0,0 +1,80 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>arvutust - Math</title>
|
||||
<style>
|
||||
body { margin: 0; padding-bottom: 3rem; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
|
||||
|
||||
#form { background: rgba(0, 0, 0, 0.15); padding: 0.25rem; position: fixed; bottom: 0; left: 0; right: 0; display: flex; height: 3rem; box-sizing: border-box; backdrop-filter: blur(10px); }
|
||||
#input { border: none; padding: 0 1rem; flex-grow: 1; border-radius: 2rem; margin: 0.25rem; }
|
||||
#input:focus { outline: none; }
|
||||
#form > button { background: #333; border: none; padding: 0 1rem; margin: 0.25rem; border-radius: 3px; outline: none; color: #fff; }
|
||||
|
||||
#messages { list-style-type: none; margin: 0; padding: 0; }
|
||||
#messages > li { padding: 0.5rem 1rem; }
|
||||
#messages > li:nth-child(odd) { background: #efefef; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<ul id="messages"></ul>
|
||||
<form id="form" action="">
|
||||
<input id="input" autocomplete="off" /><button id="sendButton">Send</button><button id="endButton">Home</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script>
|
||||
var socket = io();
|
||||
|
||||
var messages = document.getElementById('messages');
|
||||
var form = document.getElementById('form');
|
||||
var input = document.getElementById('input');
|
||||
var endButton = document.getElementById('endButton');
|
||||
|
||||
form.addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
if (input.value) {
|
||||
socket.emit('answer', input.value);
|
||||
input.value = '';
|
||||
}
|
||||
});
|
||||
|
||||
endButton.addEventListener('click', function(e) {
|
||||
window.location = '/choice';
|
||||
});
|
||||
|
||||
socket.on('calculation', function(msg) {
|
||||
var item = document.createElement('li');
|
||||
item.textContent = msg.firstNumber + msg.calculationType + msg.secondNumber;
|
||||
messages.appendChild(item);
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
});
|
||||
|
||||
socket.on('answerCheck', function(msg) {
|
||||
var item = document.createElement('li');
|
||||
item.textContent = msg.answerType;
|
||||
messages.appendChild(item);
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
});
|
||||
|
||||
socket.on('errorResponse', function(msg) {
|
||||
var item = document.createElement('li');
|
||||
item.textContent = msg.errorMsg;
|
||||
messages.appendChild(item);
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
});
|
||||
|
||||
socket.on('gameEndMessage', function(msg) {
|
||||
var item = document.createElement('li');
|
||||
item.textContent = "Game over! You earned " + msg.points + " points and got to level " + msg.currentLevel + "!";
|
||||
messages.appendChild(item);
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
});
|
||||
|
||||
socket.on('godModeData', function(msg) {
|
||||
var answer = msg.correctAnswerValue;
|
||||
console.log(answer);
|
||||
messages.append(answer);
|
||||
window.scrollTo(0, document.body.scrollHeight);
|
||||
});
|
||||
</script>
|
29
client/choice.html
Normal file
29
client/choice.html
Normal file
@ -0,0 +1,29 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>ARVUTUS</title>
|
||||
</head>
|
||||
<body>
|
||||
<input type="button" onClick="liitmine()" id="liitmine" value="Liitmine"></input>
|
||||
<input type="button" onClick="lahutamine()" id="liitmine" value="Lahutamine"></input>
|
||||
<input type="button" onClick="logout()" id="logout" value="Logout"></input>
|
||||
<!--<input type="button" onClick="korrutamine()" id="liitmine" value="Korrutamine"></input>
|
||||
<input type="button" onClick="jagamine()" id="liitmine" value="Jagamine"></input>-->
|
||||
</body>
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script>
|
||||
function liitmine() {
|
||||
window.location = '/liitmine';
|
||||
}
|
||||
function lahutamine() {
|
||||
window.location = '/lahutamine';
|
||||
}
|
||||
function korrutamine() {
|
||||
window.location = '/korrutamine';
|
||||
}
|
||||
function jagamine() {
|
||||
window.location = '/jagamine';
|
||||
}
|
||||
function logout() {
|
||||
window.location = '/';
|
||||
}
|
||||
</script>
|
13
client/index.html
Normal file
13
client/index.html
Normal file
@ -0,0 +1,13 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>ARVUTUS</title>
|
||||
</head>
|
||||
<body>
|
||||
<input type="button" onClick="start()" id="start" value="START"></input>
|
||||
</body>
|
||||
</html>
|
||||
<script>
|
||||
function start() {
|
||||
window.location = "/choice";
|
||||
}
|
||||
</script>
|
Reference in New Issue
Block a user