parent
9b973327a0
commit
f7690896cc
@ -1,40 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title></title>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
|
|
||||||
<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
|
|
||||||
<script type="text/javascript" src="vendor/bootstrap/js/bootstrap.min.js"></script>
|
|
||||||
<script type="text/javascript" src="socket.io/socket.io.js"></script>
|
|
||||||
<script type="text/javascript" src="vendor/ajaxify/ajaxify.js"></script>
|
|
||||||
<style type="text/css">
|
|
||||||
body {
|
|
||||||
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script>
|
|
||||||
var socket = io.connect('http://198.199.80.41:8081');
|
|
||||||
|
|
||||||
socket.on('event:connect', function(data) {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
|
||||||
<div class="navbar-inner">
|
|
||||||
<div class="container">
|
|
||||||
<a href="/">Home</a>
|
|
||||||
<a href="/test.html">Register</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container" id="content">
|
|
||||||
Home
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,58 +0,0 @@
|
|||||||
<!-- START Forum Info Template -->
|
|
||||||
<div class="alert alert-info">
|
|
||||||
<span id="number_of_users"></span><br />
|
|
||||||
<span id="latest_user"></span>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript">
|
|
||||||
(function() {
|
|
||||||
var num_users = document.getElementById('number_of_users'),
|
|
||||||
latest_user = document.getElementById('latest_user');
|
|
||||||
socket.emit('user.count', {});
|
|
||||||
socket.on('user.count', function(data) {
|
|
||||||
num_users.innerHTML = "We currently have <b>" + data.count + "</b> registered users.";
|
|
||||||
});
|
|
||||||
socket.emit('user.latest', {});
|
|
||||||
socket.on('user.latest', function(data) {
|
|
||||||
console.log('here');
|
|
||||||
latest_user.innerHTML = "The most recent user to register is <b>" + data.username + "</b>.";
|
|
||||||
});
|
|
||||||
}());
|
|
||||||
</script>
|
|
||||||
<!-- END Forum Info Template -->
|
|
||||||
<!-- START Register Template -->
|
|
||||||
<h1>Register</h1>
|
|
||||||
Username: <input type="text" placeholder="Enter Username" id="username" /> <span id="username-notify" class="label label-success"></span> <br />
|
|
||||||
Password: <input type="password" placeholder="Enter Password" id="password" /><br />
|
|
||||||
<button id="register" type="submit">Register Now</button>
|
|
||||||
<script type="text/javascript">
|
|
||||||
(function() {
|
|
||||||
var username = document.getElementById('username'),
|
|
||||||
password = document.getElementById('password'),
|
|
||||||
register = document.getElementById('register'),
|
|
||||||
username_notify = document.getElementById('username-notify');
|
|
||||||
|
|
||||||
register.onclick = function() {
|
|
||||||
socket.emit('user.create', {
|
|
||||||
username: username.value,
|
|
||||||
password: password.value
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
username.onkeyup = function() {
|
|
||||||
socket.emit('user.exists', {username: username.value});
|
|
||||||
}
|
|
||||||
|
|
||||||
socket.on('user.create', function(data) {
|
|
||||||
console.log('user create: ' + data.status);
|
|
||||||
});
|
|
||||||
socket.on('user.exists', function(data) {
|
|
||||||
if (data.exists == true) {
|
|
||||||
username_notify.innerHTML = 'Username exists';
|
|
||||||
username_notify.className = 'label label-important';
|
|
||||||
} else {
|
|
||||||
username_notify.innerHTML = 'Not taken';
|
|
||||||
username_notify.className = 'label label-success';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}());
|
|
||||||
</script>
|
|
Loading…
Reference in New Issue