-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo.html
130 lines (115 loc) · 3.53 KB
/
info.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<!DOCTYPE html>
<html>
<head>
<title>Search Information</title>
<style type="text/css">
body{background:#ffc0cb;}
#menu,ul,li,a{
margin:0px;
padding:0px;
border:10px;
border-color:white;
}
#menu li{
list-style:none;
float:left;
}
#menu a{
display:block;
text-decoration:none;
background-color:pink;
padding:10px;
color:white;
}
#menu a:hover{
background-color:#FF00CC;
}
.clear{
clear:both;
}
#menu{
display:block;
}
field{
float:left;
}
</style>
</head>
<body>
<div id="menu" class="clear">
<ul>
<li><a id="mypage">myPage</a></li>
<li><a id="myprofile">myProfile</a></li>
<li><a id="chatroom">Chat Room</a></li>
<li><a id="date">Dating</a></li>
<li><a id="info">Search Information</a></li>
</ul>
</div>
<div class="clear">
</div>
<br>
<p></p>
search username:
<input type="text" id="searchuser"/>
<button id="search" onclick="search()">search</button>
<fieldset id="show" style ="padding:10px;">
<legend id="user"></legend>
<p id="username"></p>
<p id="country"></p>
<p id="gender"></p>
<p id="age"></p>
<p id="education"></p>
<p id="hobby"></p>
<p id="ps"></p>
<p id="flower"></p>
<button id="vote" onclick="vote()">give flowers</button>
</fieldset>
<script src="/socket.io/socket.io.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
$("#show").hide();
var socketio = io.connect("ec2-50-112-186-234.us-west-2.compute.amazonaws.com:8083");
var user=location.search;
user=user.slice(1);
document.getElementById("mypage").setAttribute("href","http://ec2-50-112-186-234.us-west-2.compute.amazonaws.com/~yuhao900914/mypage.html?"+user);
document.getElementById("myprofile").setAttribute("href","http://ec2-50-112-186-234.us-west-2.compute.amazonaws.com:8082/myprofile.html?"+user);
document.getElementById("chatroom").setAttribute("href","http://ec2-50-112-186-234.us-west-2.compute.amazonaws.com:8080/client.html?"+user);
document.getElementById("date").setAttribute("href","http://ec2-50-112-186-234.us-west-2.compute.amazonaws.com:8081/sort.html?"+user);
document.getElementById("info").setAttribute("href","http://ec2-50-112-186-234.us-west-2.compute.amazonaws.com:8083/info.html?"+user);
</script>
<script>
function search(){
$("#show").show();
var un = document.getElementById("searchuser").value;
socketio.emit("to_server", {username:un});
//document.getElementById("username").appendChild(document.createTextNode("Username:"+un));
//document.getElementById("user").appendChild(document.createTextNode("Username:"+un));
document.getElementById("username").textContent="Username:"+un;
document.getElementById("user").textContent=un;
socketio.on("getdata",function(data) {
if (data["privacy"]==1) {
}
else{
document.getElementById("gender").textContent="Country:"+data["country"];
document.getElementById("age").textContent="Gender:"+data["gender"];
document.getElementById("education").textContent="Age:"+data["age"];
document.getElementById("hobby").textContent="Education:"+data["education"];
document.getElementById("ps").textContent="Hobby:"+data["hobby"];
document.getElementById("country").textContent="Self-Description:"+data["ps"];
document.getElementById("flower").textContent="flowers:"+data["flower"];
}
});
}
function vote(){
var un = document.getElementById("searchuser").value;
socketio.emit("to_vote", {username:un});//transfer username and privacy
socketio.on("getdata1",function(data) {
if (data["privacy"]==1) {
}
else{
document.getElementById("flower").textContent="flowers:"+data["flower"]; }
});
}
</script>
</body>
</html>