forked from ilanzisser/mefathim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathavatars.html
126 lines (117 loc) · 5.86 KB
/
avatars.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Alef|Varela+Round&display=swap" rel="stylesheet">
<link rel="icon" type="image/png" href="img/icons/logo_icon.png">
<meta name="viewport" content="width=device-width, initial-scale=1" charset="UTF-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="css/mefathim.css">
<!-- <script src="js/navbar.js"></script> -->
<script src="js/load.js"></script>
<style>
table{
text-align: center;
}
td, tr{
width: auto;
}
img{
width:auto;
height: 20%;
border-radius: 50%;
}
.images:hover {
cursor: pointer;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.274), 0 6px 20px 0 rgba(0, 0, 0, 0.13);
transition: 0.3s;
}
#current_img {
width: 30%;
}
#current {
display: flex;
overflow: hidden;
width: 30%;
margin-left: 200px;
}
#p1 {
float: right;
margin: 60px;
margin-left: 10px;
font-size: x-large;
}
#msg {
font-size: x-large;
margin-left: 200px;
height: 30px;
}
</style>
<title>בחירת תמונה</title>
</head>
<body dir="rtl">
<nav id="nav" class="navbar navbar-expand-sm bg-light navbar-light"></nav>
<div id="now_logged" style="padding-top: 50px;"></div>
<center>
<div id="msg"></div>
<div id="current"><p id="p1">התמונה שלך כרגע:</p><div id="current_img"></div></div>
<div id="imgs" class="card card-container img">
<p style="font-size: large;">בחר תמונה</p>
<table id="table_av">
<tr><td><img class="images" alt="1" onclick="choose_picture(this.alt)" src="img/avatars/1.png"></td><td><img class="images" alt="2" onclick="choose_picture(this.alt)" src="img/avatars/2.png"></td><td><img class="images" alt="3" onclick="choose_picture(this.alt)" src="img/avatars/3.png"></td><td><img class="images" alt="4" onclick="choose_picture(this.alt)" src="img/avatars/4.png"></td></tr>
<tr><td><img class="images" alt="5" onclick="choose_picture(this.alt)" src="img/avatars/5.png"></td><td><img class="images" alt="6" onclick="choose_picture(this.alt)" src="img/avatars/6.png"></td><td><img class="images" alt="7" onclick="choose_picture(this.alt)" src="img/avatars/7.png"></td><td><img class="images" alt="8" onclick="choose_picture(this.alt)" src="img/avatars/8.png"></td></tr>
<tr><td><img class="images" alt="9" onclick="choose_picture(this.alt)" src="img/avatars/9.png"></td><td><img class="images" alt="10" onclick="choose_picture(this.alt)" src="img/avatars/10.png"></td><td><img class="images" alt="11" onclick="choose_picture(this.alt)" src="img/avatars/11.png"></td><td><img class="images" alt="12" onclick="choose_picture(this.alt)" src="img/avatars/12.png"></td></tr>
</table>
</center>
</div>
<script>
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if(this.readyState == 4){
data_from_json = JSON.parse(this.responseText);
if(data_from_json.ok == true){
var img_num = String(data_from_json.data.picture_number);
if(img_num == ""){
img = "<img style='height:100%; width:100%;'src="+"img/avatars/22.png"+">"
document.getElementById("current_img").innerHTML = img;
}
else{
var img = "<img style='height:100%; width:100%;'src="+"img/avatars/";
img += img_num+ ".png"+">";
document.getElementById("current_img").innerHTML = img;
}
}
else{
window.location = "login.html";
}
}
}
xmlhttp.open("POST", "scripts/user_data.py", true);
xmlhttp.send();
function choose_picture(alt){
data = {num_picture : alt};
data_to_json = JSON.stringify(data);
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if(this.readyState == 4){
data_from_json = JSON.parse(this.responseText);
if(data_from_json.data["sucsses"]){
var img = "<img style='height:100%; width:100%;'src="+"img/avatars/";
img += alt + ".png"+">";
document.getElementById("current_img").innerHTML = img;
document.getElementById("msg").innerHTML = "התמונה שלך שונתה בהצלחה!!"
}
}
}
xmlhttp.open("POST", "scripts/select_avatar.py", true);
xmlhttp.send(data_to_json);
}
buildnavbar();
get_connected_users();
setInterval(function(){ get_connected_users() }, 3000);
</script>
</body>
</html>