Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
72 lines (60 sloc) 1.6 KB
<!doctype html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Arduino Weather Station</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
max-width: 20em;
margin: 10% auto;
}
input {
font-family: sans-serif;
border: solid 5px #c9c9c9;
box-shadow: inset 0 0 0 1px #707070;
transition: box-shadow 0.3s, border 0.3s;
width: 100%;
font-size: 2em;
padding: 2rem 2rem;
border-radius: 4px;
}
input:focus {
outline: none;
box-shadow: inset 0 0 2px green;
}
@media screen and (min-width: 40em) {
body {
max-width: 30em;
}
input {
font-size: 2em;
}
}
</style>
</head>
<body>
<input type="text" placeholder="Where to search?">
<script src="/socket.io/socket.io.js"></script>
<script>
(function() {
var socket = io.connect(window.location.hostname + ':' + 3000);
var input = document.querySelector('input');
input.addEventListener('change', getWeather);
function getWeather(e) {
var value = e.target.value.trim();
socket.emit('search-weather', {
city: value
});
}
socket.on('connect', function(data) {
socket.emit('join');
});
}());
</script>
</body>
</html>