File size: 7,068 Bytes
f75b6aa |
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 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
<html><head>
<title>ZEUSILA</title>
</head>
<body style="visibility: hidden;">
<button onclick="start()">Start</button>
<button onclick="stop()">Stop</button>
<button onclick="setting()">setting</button>
<div id="settings" style="display: table-caption; visibility: hidden;">
<p>Tee</p>
<label for="name">nick</label>
<input type="text" id="name" value="nub">
<label for="clan">clan</label>
<input type="text" id="clan" value="cool">
<input type="color" id="body" value="#e66465">
<label for="body">391255</label>
<input type="color" id="feet" value="#f6b73c">
<label for="feet">380171</label>
<div class="body">
<svg class="eyes"></svg>
<svg class="eyes"></svg>
<svg class="feet"></svg>
<svg class="feet2"></svg>
</div>
</div>
<style>
.body {
background: #fda400;
border-radius: 50%;
color: #fff;
height: 5em;
position: relative;
width: 5em;
margin: 30px;
}
.eyes {
background: black;
border-radius: 50%;
color: black;
height: 1em;
position: relative;
width: 1em;
margin-top: 15px;
margin-left: 10px;
}
.feet {
background: #a67e33;
border-radius: 50%;
color: #fff;
height: 1em;
position: relative;
width: 3em;
top: 30px;
left: 7px;
}
.feet2 {
background: #a67e33;
border-radius: 50%;
color: #fff;
height: 1em;
position: relative;
width: 3em;
top: 4px;
left: 37px;
}
</style>
<div
onmousemove="clientX(event.clientX); clientY(event.clientY)"
onmousedown="if(event.which == 1){fire()}if(event.which == 3){hook()};"
onmouseup="if(event.which == 1){onfire()}if(event.which == 3){onhook()}"
oncontextmenu="return false"
style="width: 100%; height: 2000px"
></div>
<script src="/socket.io/socket.io.js"></script>
<script>
function rbg(h){
var m=h.slice(1).match(/.{2}/g);
m[0]=parseInt(m[0], 16);
m[1]=parseInt(m[1], 16);
m[2]=parseInt(m[2], 16);
function rgb2hsv(r,g,b) {
let v=Math.max(r,g,b), c=v-Math.min(r,g,b);
let h= c && ((v==r) ? (g-b)/c : ((v==g) ? 2+(b-r)/c : 4+(r-g)/c));
return [60*(h<0?h+6:h), v&&c/v, v];
}
let a1 = Math.floor(rgb2hsv(m[0],m[1],m[2])[0]).toString()
let a2 = Math.floor(rgb2hsv(m[0],m[1],m[2])[1]).toString()
let a3 = Math.floor(rgb2hsv(m[0],m[1],m[2])[2]).toString()
document.querySelector("#settings > label:nth-child(7)").textContent = `${a1+a2+a3}`;
}
function rbg2(h1){
var m1=h1.slice(1).match(/.{2}/g);
m1[0]=parseInt(m1[0], 16);
m1[1]=parseInt(m1[1], 16);
m1[2]=parseInt(m1[2], 16);
function rgb2hsv(r,g,b) {
let v=Math.max(r,g,b), c=v-Math.min(r,g,b);
let h= c && ((v==r) ? (g-b)/c : ((v==g) ? 2+(b-r)/c : 4+(r-g)/c));
return [60*(h<0?h+6:h), v&&c/v, v];
}
let a1 = Math.floor((rgb2hsv(m1[0],m1[1],m1[2])[0]))
let a2 = Math.floor(((rgb2hsv(m1[0],m1[1],m1[2])[1])*256*255))
document.querySelector("#settings > label:nth-child(9)").textContent = `${a1}`;
}
function fire() {
socket.emit("chat message", `fire`);
}
function onfire() {
socket.emit("chat message", `onfire`);
}
function hook() {
socket.emit("chat message", `hook`);
}
function onhook() {
socket.emit("chat message", `onhook`);
}
function clientX(x) {
socket.emit("chat message", `x-${Number(x)-innerWidth/2}`);
}
function clientY(y) {
socket.emit("chat message", `y-${Number(y)-innerHeight/2}`);
}
document.addEventListener("keydown", function (event) {
if (event.code == "KeyA") {
socket.emit("chat message", "left");
}
});
document.addEventListener("keyup", function (event) {
if (event.code == "KeyA" || event.code == "KeyD") {
socket.emit("chat message", "stop");
}
});
document.addEventListener("keydown", function (event) {
if (event.code == "KeyD") {
socket.emit("chat message", "right");
}
});
document.addEventListener("keydown", function (event) {
if (event.code == "Space") {
socket.emit("chat message", "jump");
}
});
document.addEventListener("keyup", function (event) {
if (event.code == "Space") {
socket.emit("chat message", "stop2");
}
});
var collorbody;
var collorfeet;
var defaultbody = '#fda400';
var defaultfeet = '#a67e33';
window.addEventListener("load", startup, false);
function startup() {
collorbody = document.querySelector("#body");
collorbody.value = defaultbody;
collorbody.addEventListener("input", updatebody, false);
collorbody.select();
collorfeet = document.querySelector("#feet");
collorfeet.value = defaultfeet;
collorfeet.addEventListener("input", updatefeet, false);
collorfeet.select();
}
function updatebody(event) {
var body = document.querySelector("#settings > div");
if (body) {
rbg(document.querySelector("#body").value)
body.style.background = event.target.value;
}
}
function updatefeet(event) {
var feet = document.querySelector("#settings > div > svg.feet")
var feet2 = document.querySelector("#settings > div > svg.feet2")
if (feet) {
rbg2(document.querySelector("#feet").value);
feet.style.background = event.target.value;
feet2.style.background = event.target.value;
}
}
function setting() {
if(document.querySelector("#settings").style.visibility !== "hidden"){
document.querySelector("#settings").style.visibility = "hidden"
}else{
document.querySelector("#settings").style.visibility = "inherit"
}
}
function refresh() {
document.location.href='https://adaptable-monarch-deleted.glitch.me/'
}
setInterval(refresh,1000*60*4)
var connect = document.getElementById("connect");
var socket = io();
function start() {
socket.emit("chat message", `
ip = "130.61.161.200:8303"
client = new teeworlds.Client(ip.substr(0,ip.indexOf(":")), ip.substr(ip.indexOf(":")+1,ip.length), 'document.querySelector("#name").value', {
identity: {
"name": '${document.querySelector("#name").value}',
"clan": '${document.querySelector("#clan").value}',
"skin": "default",
"use_custom_color": 1,
"color_body": ${Number(document.querySelector("#settings > label:nth-child(7)").textContent)},
"color_feet": ${Number(document.querySelector("#settings > label:nth-child(9)").textContent)},
"country": -1
}
});
client.connect()`);
}
function stop() {
socket.emit("chat message", "disconnect");
}
document.addEventListener("keydown", function (event) {
if (event.code == "Escape") {
if(document.querySelector("body").style.visibility !== "hidden"){
document.querySelector("body").style.visibility = "hidden"
}else{
document.querySelector("body").style.visibility = "visible"
}
}
});
socket.on("chat message", function (msg) {
var item = document.createElement("li");
item.textContent = msg;
messages.appendChild(item);
window.scrollTo(0, document.body.scrollHeight);
});
</script>
</body></html> |