Commit 02b6d22c authored by Killian Kemps's avatar Killian Kemps

Allow user to set availability for notifications

parent 85d9e559
......@@ -6,7 +6,8 @@
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font: 13px Helvetica, Arial; }
form { background: #000; padding: 3px; position: fixed; bottom: 0; width: 100%; }
form input { border: 0; padding: 10px; width: 90%; margin-right: .5%; }
form input { border: 0; padding: 10px; width: 80%; margin-right: .5%; }
form select { width: 9%; margin-right: .5%; }
form button { width: 9%; background: rgb(130, 224, 255); border: none; padding: 10px; }
#messages { list-style-type: none; margin: 0; padding: 0; }
#messages li { padding: 5px 10px; }
......@@ -16,7 +17,12 @@
<body>
<ul id="messages"></ul>
<form action="">
<input id="m" autocomplete="off" /><button>Send</button>
<input id="m" autocomplete="off" />
<select id="availability">
<option id="available" selected>Available</option>
<option id="unavailable">Unavailable</option>
</select>
<button>Send</button>
</form>
<script src="https://cdn.socket.io/socket.io-1.2.0.js"></script>
<script src="http://code.jquery.com/jquery-1.11.1.js"></script>
......@@ -56,7 +62,11 @@
});
socket.on('chat message', function(msg){
$('#messages').append($('<li>').text(msg));
notifyMe(msg);
// Send notification only if user available
if ($('#availability').val() === 'Available') {
notifyMe(msg);
}
});
</script>
</body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment