-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
100 lines (100 loc) · 3.39 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!doctype html>
<html>
<head>
<title>Developer's Day Feedback</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
*{
box-sizing: border-box;
}
body{
text-align: center; height: 100vh; position:relative;
}
form{
position:absolute; left: 50%; top: 50%;-webkit-transform: translate(-50%,-50%);-moz-transform: translate(-50%,-50%);-ms-transform: translate(-50%,-50%);-o-transform: translate(-50%,-50%);transform: translate(-50%,-50%);
border: 2px solid #fff;
width: 400px;
padding: 10px;
}
form input{
border: none;
background-color: transparent;
width: 320px;
font-size: 20px;
color: #fff;
}
input:focus{
outline: none;
}
button{
color: #fff;
outline: none;
background-color: transparent;
border: 1px solid #0D47A1;
border-radius: 2px;
width: 50px;
padding: 10px;
cursor: pointer;
-webkit-transition: 0.2s;
-moz-transition: 0.2s ;
-ms-transition: 0.2s ;
-o-transition: 0.2s ;
transition: 0.2s ;
}
button:hover{
color: #fff;
background-color: #0D47A1;
border: 1px solid transparent;
}
@keyframes bgcolor {
0% {background-color: #1a2a37;}
20% {background-color: #112237;}
40% {background-color: #0a2317;}
60% {background-color: #102311;}
80% {background-color: #212121;}
100% {background-color: #1a2a37;}
}
body {
animation-name: bgcolor;
animation-duration: 25s;
animation-iteration-count: infinite;
}
</style>
</head>
<body>
<ul id="messages"></ul>
<form id="landing-form">
<input id="name" placeholder="Your nickname" autocomplete="off" />
<button>Go</button>
</form>
<script src="/js/jquery.min.js"></script>
<script>
if(localStorage.getItem("ddnname")) {
window.location.pathname = "/chatroom";
}
else {
document.getElementById('landing-form').addEventListener('submit', function(event) {
event.preventDefault();
var nname = document.getElementById('name').value;
if(nname.length != 0) {
localStorage.setItem('ddnname', nname);
localStorage.setItem('ddkey', Math.random().toString(36).slice(2));
window.location.pathname = '/chatroom';
} else{
$('form').css({
borderColor: '#F44336'
});
}
});
}
$('input#name').on('keyup',function(){
var name = $('input#name').val();
if(name.length > 0){
$('form').css({
borderColor: '#fff'
});
}
});
</script>
</body>
</html>