forked from hsefz2018/cuddly-telegram-newyear2016
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sender.html
70 lines (70 loc) · 2.68 KB
/
sender.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
<!DOCTYPE HTML>
<html>
<head>
<meta charset='utf-8'>
<title>弹幕后台 · 仅供测试使用(大雾</title>
<style>
body { font-size: 40px; }
#container { width: 100%; }
input, button {
font-size: 40px;
padding: 0.1em;
margin: 0.2em;
width: 80%;
width: -moz-available;
width: -webkit-fill-available;
border: 2px #ddd solid;
border-radius: 4px;
}
input:focus { border-color: #999; }
button { background-color: #eee; }
button:focus, button:active { background-color: #aaa; }
</style>
</head>
<body>
<div id='container'>
<input id='msg-text' type='text' placeholder='Message'><br>
<input id='color-text' type='text' placeholder='Colour'><br>
<input id='pos-text' type='text' placeholder='Position'><br>
<button id='submit-btn'>♪───O(≧∇≦)O────♪</button>
<button id='rand-btn'>ˊ_>ˋ</button>
</div>
<script>
var hey = function (s) {
var r = '';
for (var i = 0; i < s.length; ++i) r += '%26%23'+s.charCodeAt(i).toString()+'%3B';
return r;
};
document.getElementById('msg-text').onkeypress =
document.getElementById('pos-text').onkeypress =
document.getElementById('color-text').onkeypress = function (e) {
if (e.keyCode == 13) document.getElementById('submit-btn').click();
};
var update_colour_disp = function () {
document.getElementById('color-text').style.backgroundColor
= document.getElementById('color-text').value;
};
document.getElementById('color-text').onkeyup =
document.getElementById('color-text').onchange = update_colour_disp;
document.getElementById('submit-btn').onclick = function () {
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://app.efzer.org/live/2016newyear/send.php');
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
var args = 'message=' + hey(document.getElementById('msg-text').value) +
'&color=' + document.getElementById('color-text').value +
'&position=' + document.getElementById('pos-text').value +
'&pwd=StrongerPumpkin';
xhr.send(args);
console.log(args);
};
document.getElementById('rand-btn').onclick = function () {
var colour_code = Math.floor(Math.random() * 256 * 256 * 256);
var s = colour_code.toString(16);
while (s.length < 6) s = '0' + s;
document.getElementById('color-text').value = '#' + s;
update_colour_disp();
document.getElementById('submit-btn').click();
};
</script>
</body>
</html>