This repository has been archived by the owner on Jan 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
83 lines (71 loc) · 1.85 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<!DOCTYPE html>
<html lang="en">
<head>
<title>Chat For Fun</title>
<style>
#user {
position:absolute;
left:0px;
top:0px;
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script src="./nowjs/now.js"></script>
<script type="text/javascript">
document.onkeypress=getkeypressed(event);
var startx=0;
var starty=0;
var muted=false;
function getkeypressed(e) {
var unicode=e.keyCode? e.keyCode : e.charCode ;
if(unicode=="100")
{
var new_startx=startx+1;
var new_starty=starty+0;
document.getElementById('user').style.left=new_startx+'px';
now.distributeMessage("@op@movement@#"+startx+","+starty+"#"+new_startx+","+new_starty+"");
startx=new_startx;
starty=new_starty;
}
}
$(document).ready(function(){
now.name = prompt("What's your name?", "");
now.receiveMessage = function(name, message){
var s=message;
var display_message = false;
var does_it_contain_opearation = s.indexOf("@op@");
if(does_it_contain_opearation!=-1)
{//contains some sort of operation
var does_it_contain_movement = s.indexOf("@movement@");
var does_it_contain_muted_user_list = s.indexOf("@muted_users@");
}
$("#messages").append("<br>" + name + ": " + message);
}
$("#send-button").click(function(){
now.distributeMessage($("#text-input").val());
$("#text-input").val("");
});
});
</script>
</head>
<body onkeypress="getkeypressed(event);" >
<div id="online_users">
</div>
<div id="fun_area">
<div id="user">
<img src="http://localhost:81/metalslug_tank.png" width="100" style="margin:2px;float:left;" >
</div>
</div>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<div id="messages" style="height:100px;overflow:scroll;"></div>
<input type="text" id="text-input">
<input type="button" value="Send" id="send-button">
</body>
</html>