SHOW:
|
|
- or go back to the newest paste.
1 | // ==UserScript== | |
2 | - | // @name cursors.io hack FINAL --working-- |
2 | + | // @name cursors.io hack NEW (July 2018) |
3 | // @namespace q1k | |
4 | - | // @version 1.2.0 |
4 | + | // @version 1.0.2 |
5 | - | // @description cursors.io hack - drawing, texting, player ids, & more |
5 | + | // @description cursorsio hack, drawing, texting, player ids, & more |
6 | // @author q1k | |
7 | - | // @match *://cursors.io/ |
7 | + | // @match http://cursors.io/ |
8 | // @grant none | |
9 | // @run-at document-idle | |
10 | // ==/UserScript== | |
11 | ||
12 | ||
13 | /* | |
14 | ___ _ _ _ __ ___ ___ _ __ ___ _ ___ | |
15 | / __| | | | `__/ __|/ _ \| `__/ __| | |/ _ \ | |
16 | | (__| |_| | | \__ \ (_) | | \__ \_| | (_) | | |
17 | \___|\__,_|_| |___/\___/|_| |___(_)_|\___/ | |
18 | ||
19 | for a more updated version, go here: | |
20 | - | https://greasyfork.org/scripts/369975 |
20 | + | |
21 | ||
22 | */ | |
23 | /* How to use: | |
24 | 1. Go to cursors.io, open console (ctrl + shift + j or F12) | |
25 | and paste this entire script into the console, then hit enter | |
26 | - | -if you experience problems running the script, make sure to block "cursors.io/client_out.js" |
26 | + | -if installing as userscript, make sure to block "cursors.io/client_out.js" |
27 | 2. To type: type message and hit enter (shift+enter for new row) | |
28 | -all ascii characters are available | |
29 | - | 3. To move your cursor only when clicking: press numpad . OR delete OR F2 |
29 | + | 3. To move your cursor only when clicking: press numpad . OR delete |
30 | -Pathfinder will be active in this mode. (CTRL+click to ignore pathfinder) | |
31 | -try not to use a too low value of the delay, or you may get disconnected on some levels | |
32 | --make sure 'no cursor lock' is marked so pathfinder works correctly | |
33 | To move your cursor normally: press numpad . again | |
34 | - | 4. To draw a circle: press numpad 0 OR insert OR CTRL+0 |
34 | + | 4. To draw a circle: press numpad 0 OR insert |
35 | To stop drawing a circle: press numpad 0 again | |
36 | 5. To draw arrows, use the arrow keys | |
37 | - | 6. To draw different images press numpad 1-9 keys OR CTRL+(1-9) |
37 | + | 6. To draw different images press numpad 1 - numpad 9 keys |
38 | - | 7. To make drawings bigger/smaller use numpad + and - OR CTRL+(plus and minus) |
38 | + | 7. To make drawings bigger/smaller use numpad + and - |
39 | - | 8. Reset drawing size with numpad * OR CTRL+backslash |
39 | + | 8. Reset drawing size with numpad * |
40 | - | 9. Non numeric keyboard friendly with CTRL combos |
40 | + | 9. To show/hide cursors ids: press F8 |
41 | - | 10. To show/hide cursors ids: press F8 |
41 | + | 10. Change ids position with: F9 |
42 | - | 11. Change ids position with: F9 |
42 | + | 11. To show this help: press F1 |
43 | - | 12. To show this help: press F1 |
43 | + | |
44 | ||
45 | var A = window; | |
46 | - | var _tempOnClose; |
46 | + | |
47 | - | var _tempChangeCanvasID = undefined; |
47 | + | |
48 | - | var canvas = document.getElementById("canvas"), |
48 | + | |
49 | - | _tempEvt = function() { |
49 | + | |
50 | - | _tempOnClose(); |
50 | + | |
51 | var clicksCount = 3; | |
52 | - | if (_tempChangeCanvasID != undefined) canvas.setAttribute("id", _tempChangeCanvasID); |
52 | + | |
53 | - | if (canvas.style.cursor == "none") { |
53 | + | |
54 | - | var _tempWSSend = WebSocket.prototype.send; |
54 | + | |
55 | - | WebSocket.prototype.send = function(send) { |
55 | + | |
56 | - | return function(data) { |
56 | + | |
57 | - | if (this.readyState == 1) { |
57 | + | |
58 | - | this.onclose = _tempEvt; |
58 | + | |
59 | - | this.close(); |
59 | + | |
60 | var fontnarrow = false; | |
61 | - | if (this.readyState > 0) { |
61 | + | |
62 | - | clearInterval(_tempInterval); |
62 | + | |
63 | - | WebSocket.prototype.send = _tempWSSend; |
63 | + | |
64 | 33:[[0,1,1.5,1],[2,1,2.5,1]],//! | |
65 | - | return {} |
65 | + | |
66 | 35:[[0.5,-0.25,0.5,2.3],[1.5,-0.25,1.5,2.3],[-0.25,0.5,2.3,0.5],[-0.25,1.5,2.3,1.5]],//# | |
67 | - | }(WebSocket.prototype.send); |
67 | + | |
68 | - | var _tempCanvasEvent = function(_mevt) { |
68 | + | |
69 | - | var _tempMouseEvent; |
69 | + | |
70 | - | if (document.createEvent) { |
70 | + | |
71 | - | _tempMouseEvent = document.createEvent("HTMLEvents"); |
71 | + | |
72 | - | _tempMouseEvent.initEvent(_mevt, true, true); |
72 | + | |
73 | 40:[[0,2,0.5,1],[0.5,1,1.5,1],[1.5,1,2,2]],//( | |
74 | - | _tempMouseEvent = document.createEventObject(); |
74 | + | |
75 | - | _tempMouseEvent.eventType = _mevt; |
75 | + | |
76 | 43:[[0,1,2,1],[1,0,1,2]],//+ | |
77 | - | _tempMouseEvent.eventName = _mevt; |
77 | + | |
78 | - | if (document.createEvent) { |
78 | + | |
79 | - | canvas.dispatchEvent(_tempMouseEvent); |
79 | + | |
80 | 47:[[2,0.4,0,1.6]],// / | |
81 | - | canvas.fireEvent("on" + _tempMouseEvent.eventType, _tempMouseEvent); |
81 | + | |
82 | 49:[[0,1,2,1],[1,0,0,1],[2,0,2,2]],//1 | |
83 | 50:[[0,0,0,2],[0,2,1,2],[1,2,1,0],[1,0,2,0],[2,0,2,2]],//2 | |
84 | - | var _tempInterval = setInterval(function() { |
84 | + | |
85 | - | _tempCanvasEvent("mousedown"); |
85 | + | |
86 | - | _tempCanvasEvent("mousedown"); |
86 | + | |
87 | - | }, 100) |
87 | + | |
88 | - | } else { |
88 | + | |
89 | - | setTimeout(_tempEvt, 0); |
89 | + | |
90 | 57:[[0,0,1,0],[1,0,1,2],[0,2,2,2],[0,0,0,2],[2,0,2,2]],//9 | |
91 | - | _tempOnClose = function() { |
91 | + | |
92 | 59:[[0,1,0.5,1],[2,1,3,1]],//; | |
93 | 60:[[0,2,1,0],[1,0,2,2]],//< | |
94 | 61:[[0.5,0,0.5,2],[1.5,0,1.5,2]],//= | |
95 | 62:[[0,0,1,2],[1,2,2,0]],//> | |
96 | 63:[[1,0,0,0],[0,0,0,2],[0,2,1,2],[1,2,1,1],[1,1,1.5,1],[2,1,2.5,1] ],//? | |
97 | 64:[[2.5,2,2.5,0],[2.5,0,-0.5,0],[-0.5,0,-0.5,2],[-0.5,2,1.5,2],[1.5,2,1.5,1],[1.5,1,0.5,1],[0.5,1,0.5,2]],//@ | |
98 | 91:[[0,1.5,0,0.5],[0,0.5,2,0.5],[2,0.5,2,1.5]],// [ | |
99 | 92:[[0,0.4,2,1.6]],// backslash | |
100 | 93:[[0,0.5,0,1.5],[0,1.5,2,1.5],[2,1.5,2,0.5]],// ] | |
101 | 94:[[1.5,0,0,1],[0,1,1.5,2]],//^ | |
102 | 95:[[2,0,2,2] ],//_ | |
103 | 96:[[0,0.5,1,0.5]], // ` display same as 39 | |
104 | 97:[[2,0,0,0],[0,2,0,0],[0,2,2,2],[1,0,1,2]],//a | |
105 | 98:[[2,0,0,0],[0,0,0,1],[1,0,1,1],[2,0,2,1],[0,1,0.5,2],[0.5,2,1,1],[1,1,1.5,2],[1.5,2,2,1]],//b | |
106 | 99:[[2,2,2,0],[2,0,0,0],[0,0,0,2]],//c | |
107 | - | var fontthin = false; |
107 | + | |
108 | 101:[[2,2,2,0],[2,0,0,0],[0,0,0,2],[1,0,1,2]], | |
109 | 102:[[2,0,0,0],[0,0,0,2],[1,0,1,2]], | |
110 | 103:[[1,1,1,2],[1,2,2,2],[2,2,2,0],[2,0,0,0],[0,0,0,2]], | |
111 | 104:[[0,0,2,0],[0,2,2,2],[1,0,1,2]], | |
112 | 105:[[0,0,0,2],[0,1,2,1],[2,0,2,2]], | |
113 | 106:[[0,0,0,2],[0,1,2,1],[2,0,2,1]], | |
114 | 107:[[0,0,2,0],[1,0,0,2],[1,0,2,2]], | |
115 | 108:[[0,0,2,0],[2,0,2,2]], | |
116 | 109:[[0,0,2,0],[0,0,2,1],[2,1,0,2],[0,2,2,2]], | |
117 | 110:[[0,0,2,0],[0,0,2,2],[0,2,2,2]], | |
118 | 111:[[2,0,0,0],[0,0,0,2],[0,2,2,2],[2,2,2,0]], | |
119 | 112:[[2,0,0,0],[0,0,0,2],[0,2,1,2],[1,2,1,0]], | |
120 | 113:[[2,0,0,0],[0,0,0,2],[0,2,2,2],[2,2,2,0],[1,1,2,2]], | |
121 | 114:[[2,0,0,0],[0,0,0,2],[0,2,1,2],[1,2,1,0],[1,1,2,2]], | |
122 | 115:[[0,0,0,2],[1,0,1,2],[2,0,2,2],[0,0,1,0],[1,2,2,2]], | |
123 | 116:[[0,0,0,2],[0,1,2,1]], | |
124 | 117:[[0,0,2,0],[0,2,2,2],[2,0,2,2]], | |
125 | 118:[[0,0,2,1],[0,2,2,1]], | |
126 | 119:[[0,0,2,0],[0,2,2,2],[2,0,1,1],[2,2,1,1]], | |
127 | 120:[[0,0,2,2],[2,0,0,2]], | |
128 | 121:[[0,0,1,1],[0,2,1,1],[2,1,1,1]], | |
129 | 122:[[0,0,0,2],[0,2,2,0],[2,0,2,2]],//z | |
130 | 123:[[0,1.5,0,0.5],[0,0.5,0.5,0.5],[0.5,0.5,1,0],[1,0,1.5,0.5],[1.5,0.5,2,0.5],[2,0.5,2,1.5]],// { | |
131 | 124:[[0,1,2,1]],// | | |
132 | 125:[[0,0.5,0,1.5],[0,1.5,0.5,1.5],[0.5,1.5,1,2],[1,2,1.5,1.5],[1.5,1.5,2,1.5],[2,1.5,2,0.5]],// } | |
133 | 126:[[0.5,0,0,0.75],[0,0.75,0.5,1.5],[0.5,1.5,0,2.25]],// ~ | |
134 | }; | |
135 | ||
136 | var imageScale = 1.0; | |
137 | var imgData = [ | |
138 | /* arrow left */ | |
139 | [[0,0,0,9],[0,0,-3,3],[0,0,3,3]], | |
140 | ||
141 | /* arrow up */ | |
142 | [[0,0,9,0],[0,0,3,-3],[0,0,3,3]], | |
143 | ||
144 | /* arrow right */ | |
145 | [[0,0,0,-9],[0,0,-3,-3],[0,0,3,-3]], | |
146 | ||
147 | /* arrow down */ | |
148 | [[0,0,-9,0],[0,0,-3,-3],[0,0,-3,3]], | |
149 | ||
150 | /*star 5*/ | |
151 | [[8,0,8,24],[8,24,24,4],[24,4,0,12],[0,12,24,20],[24,20,8,0]], | |
152 | ||
153 | /* reversed star */ | |
154 | [[0,4,24,12],[24,12,0,20],[0,20,16,0],[16,0,16,24],[16,24,0,4]], | |
155 | ||
156 | /*tictactoe*/ | |
157 | [[72,24,0,24],[0,48,72,48],[24,0,24,72],[48,0,48,72],[0,0,0,72],[0,72,72,72],[72,72,72,0],[72,0,0,0]], | |
158 | ||
159 | /*triforce*/ | |
160 | - | //106:[[0,0,0,2],[0,1,2,1],[2,0,2,1]], //j v1 |
160 | + | |
161 | - | 106:[[1.5,0,2,0],[2,0,2,1.5],[0,1.5,2,1.5],[0,0.85,0,2.25]], //j v2 |
161 | + | |
162 | /*pentashot*/ | |
163 | [[50,16,66,17],[66,17,65,32],[51,26,72,36],[65,32,65,33],[72,36,64,52],[49,35,69,58],[69,58,54,71],[54,71,35,48],[49,65,33,70],[33,70,25,49],[16,46,16,63],[16,63,30,63],[50,16,51,19],[51,19,51,26],[51,26,49,35],[49,35,46,40],[46,40,43,43],[43,43,38,47],[38,47,32,49],[32,49,27,49],[27,49,24,49],[24,49,21,48],[21,48,16,46],[16,46,13,44],[13,44,10,41],[10,41,8,38],[8,38,5,32],[5,32,4,24],[4,24,5,18],[5,18,8,11],[8,11,12,7],[12,7,16,4],[16,4,21,2],[21,2,25,1],[25,1,31,1],[31,1,35,2],[35,2,40,4],[40,4,45,8],[45,8,48,13],[48,13,50,16]], | |
164 | ||
165 | /*heart*/ | |
166 | [[9,5,4,0],[4,0,2,0],[2,0,1,1],[4,10,9,5],[1,1,1,3],[1,3,3,5],[3,5,1,7],[1,7,1,9],[1,9,2,10],[2,10,4,10]], | |
167 | ||
168 | ||
169 | ]; | |
170 | ||
171 | function sa(f) { | |
172 | return f << 1; | |
173 | } | |
174 | ||
175 | function ta(f) { | |
176 | return f << 1; | |
177 | } | |
178 | ||
179 | function U() { | |
180 | return E.pointerLockElement === y || E.mozPointerLockElement === y || E.webkitPointerLockElement === y; | |
181 | } | |
182 | ||
183 | function ba() { | |
184 | a.fillStyle = "#000000"; | |
185 | a.font = "35px NovaSquare"; | |
186 | a.fillText("Please do not embed our website, thank you.", 400 - a.measureText("Please do not embed our website, thank you.").width / 2, 300); | |
187 | a.font = "16px NovaSquare"; | |
188 | a.fillText("Play http://cursors.io/", 400 - a.measureText("Play http://cursors.io/").width / | |
189 | 2, 330); | |
190 | top.location = "http://cursors.io"; | |
191 | throw "Please do not embed our website, thank you."; | |
192 | } | |
193 | ||
194 | function ua(f) { | |
195 | V(f); | |
196 | } | |
197 | ||
198 | function W(f, b) { | |
199 | J = f; | |
200 | K = b; | |
201 | posX = k = v = f; | |
202 | posY = q = w = b; | |
203 | B = v << 1; | |
204 | C = w << 1; | |
205 | } | |
206 | ||
207 | function unfocus() { | |
208 | elm.forEach(function(i){ i.blur() }); | |
209 | } | |
210 | ||
211 | window.changedelay = function(d) { | |
212 | d = Math.floor(parseInt(d)); | |
213 | var dd = document.getElementById('delay'); | |
214 | if (d >= 0) {dd.value = delay = d;} | |
215 | else dd.value = delay = 0; | |
216 | - | /*penrose*/ |
216 | + | |
217 | - | [[33,34,42,40],[36,36,27,42],[33,38,33,26],[27,22,48,36],[48,36,27,50],[27,50,27,22],[42,40,42,52],[48,36,48,56],[48,56,39,50],[42,48,33,54],[33,54,54,68],[54,68,46,72],[48,28,39,22],[42,20,33,26],[42,24,42,12],[42,12,27,22],[48,28,48,0],[48,0,54,4],[54,4,54,68],[27,42,18,36],[21,38,21,26],[21,34,12,40],[27,50,12,40],[21,26,0,40],[0,40,0,32],[0,32,48,0],[0,40,46,72]], |
217 | + | |
218 | window.changefontsize = function(d) { | |
219 | - | /*boxception*/ |
219 | + | |
220 | - | [[60,0,0,0],[0,0,0,60],[0,60,60,60],[60,60,60,0],[60,0,0,3],[0,3,3,60],[3,60,60,57],[60,57,57,0],[57,0,0,6],[0,6,6,60],[6,60,60,54],[60,54,54,0],[54,0,0,9],[0,9,9,60],[9,60,60,51],[60,51,51,0],[51,0,0,12],[0,12,12,60],[12,60,60,48],[60,48,48,0],[48,0,0,15],[0,15,15,60],[15,60,60,45],[60,45,45,0],[45,0,0,18],[0,18,18,60],[18,60,60,42],[60,42,42,0],[42,0,0,21],[0,21,21,60],[21,60,60,39],[60,39,39,0],[39,0,0,24],[0,24,24,60],[24,60,60,36],[60,36,36,0],[36,0,0,27],[0,27,27,60],[27,60,60,33],[60,33,33,0],[33,0,0,30],[0,30,30,60],[30,60,60,30],[60,30,30,0],[30,0,0,33],[0,33,33,60],[33,60,60,27],[60,27,27,0],[27,0,0,36],[0,36,36,60],[36,60,60,24],[60,24,24,0],[24,0,0,39],[0,39,39,60],[39,60,60,21],[60,21,21,0],[21,0,0,42],[0,42,42,60],[42,60,60,18],[60,18,18,0],[18,0,0,45],[0,45,45,60],[45,60,60,15],[60,15,15,0],[15,0,0,48],[0,48,48,60],[48,60,60,12],[60,12,12,0],[12,0,0,51],[0,51,51,60],[51,60,60,9],[60,9,9,0],[9,0,0,54],[0,54,54,60],[54,60,60,6],[60,6,6,0],[6,0,0,57],[0,57,57,60],[57,60,60,3],[60,3,3,0],[3,0,0,60]], |
220 | + | |
221 | if (d >0) {dd.value = fontSize = d;} | |
222 | - | /*cursor*/ |
222 | + | |
223 | - | [[0,0,7,7],[7,7,7,3],[7,3,9.5,0],[9.5,0,0,0]], |
223 | + | |
224 | ||
225 | - | /*dickbutt*/ |
225 | + | |
226 | - | [[105,27,81,12],[81,12,45,5],[45,5,39,2],[39,2,29,8],[29,8,30,15],[30,15,35,19],[35,19,43,15],[43,15,45,5],[45,5,40,12],[40,12,34,13],[34,13,29,8],[22,38,33,32],[33,32,39,35],[39,35,37,47],[37,47,29,50],[29,50,24,46],[24,46,22,38],[22,38,28,43],[28,43,35,40],[35,40,39,35],[33,24,46,17],[46,17,49,20],[49,20,46,28],[41,52,60,8],[29,8,14,14],[14,14,6,23],[6,23,3,37],[3,37,5,47],[5,47,15,55],[15,55,48,63],[48,63,71,74],[71,74,63,81],[63,81,58,91],[58,91,59,99],[59,99,29,103],[29,103,27,109],[27,109,31,115],[31,115,60,114],[60,114,55,123],[55,123,57,127],[57,127,63,127],[63,127,65,120],[63,127,66,132],[66,132,73,132],[73,132,78,121],[78,121,69,116],[69,116,66,105],[66,105,67,96],[67,96,59,99],[67,96,70,89],[70,89,68,83],[70,89,77,84],[78,121,86,122],[86,122,103,114],[103,114,110,104],[110,104,111,97],[111,97,138,103],[138,103,132,85],[132,85,125,81],[125,81,127,94],[127,94,113,91],[113,91,120,79],[120,79,122,64],[122,64,152,62],[152,62,144,46],[144,46,138,44],[138,44,141,57],[141,57,122,58],[122,58,119,43],[119,43,105,27],[61,50,91,59],[91,59,96,57],[96,57,102,58],[102,58,102,62],[102,62,95,61],[95,61,102,65],[102,65,101,68],[101,68,94,66],[94,66,94,75],[94,75,91,75],[91,75,88,64],[88,64,60,56],[73,82,74,80],[79,97,82,95],[92,96,94,94],[96,100,98,98],[100,105,101,104],[48,111,49,109],[52,111,53,109]], |
226 | + | if (d.checked) { textwidth=2/3; fontnarrow=true; d.blur(); } |
227 | else { textwidth=1; fontnarrow=false; d.blur(); } | |
228 | } | |
229 | ||
230 | window.cmessage = "by q1k"; | |
231 | window.changecmessage = function(d) { | |
232 | var dd = document.getElementById('cmessage'); | |
233 | cmessage = d; | |
234 | } | |
235 | ||
236 | window.changeImgSize = function(d) { | |
237 | d = Math.floor(parseInt(d)); | |
238 | var tmp = d/100; | |
239 | var dd = document.getElementById('imgsize'); | |
240 | if (d > 0) { | |
241 | dd.value = d; | |
242 | imageScale = tmp; | |
243 | imgSizeDisplay(); | |
244 | } | |
245 | else { | |
246 | dd.value = 10; | |
247 | imageScale = 0.1; | |
248 | imgSizeDisplay(); | |
249 | } | |
250 | } | |
251 | ||
252 | window.disablemovement = function(d) { | |
253 | if (d.checked) { movementEnabled = false; d.blur() } | |
254 | else { movementEnabled = true; d.blur() } | |
255 | } | |
256 | ||
257 | window.changeextrainfo = function(d) { | |
258 | if (d.checked) { hideExtraInfo = true; d.blur(); } | |
259 | else { hideExtraInfo = false; d.blur(); } | |
260 | } | |
261 | ||
262 | window.toggler = function() { | |
263 | var dd = document.getElementById('toggle'); | |
264 | dd.classList.toggle('open'); | |
265 | if (dd.classList.contains('open')) dd.innerHTML = "hide advanced options <span></span>"; | |
266 | else dd.innerHTML = "show advanced options <span></span>"; | |
267 | } | |
268 | - | elm.forEach(function(i) { i.blur() }); |
268 | + | |
269 | var elm=[]; | |
270 | function Ma() { | |
271 | var el1 = document.querySelectorAll("a[href='https://m28.studio/']"); | |
272 | var par = el1[0].parentElement; | |
273 | var add = "<label id='help' title='Press F1 for help' onclick='showHelp=!showHelp'><span></span></label>" | |
274 | +"<div id='options-cont'><label id='toggle' onclick='toggler()'>show advanced options <span></span></label><div id='options'>" | |
275 | +"<div><label title='Pathfinder delay for each move (in miliseconds)'>delay: <input id='delay' type='number' step='5' min='0' value='"+delay+"' onchange='changedelay(this.value)'></label>" | |
276 | +"<input id='pathfinder' type='checkbox' title='Pathfinder/Movement (numpad .)' onclick='disablemovement(this)'><span class='info pf'></span></div>" | |
277 | +"<div><label title='Size of font (default = 2)'>font size: <input id='fontsize' type='number' step='any' value='"+fontSize+"' onchange='changefontsize(this.value)'></label>" | |
278 | +"<input id='fontwidth' type='checkbox' title='Narrow text (F10)' onclick='changefontwidth(this)'><span class='info font'></span></div>" | |
279 | +"<div><label title='Custom message on pressing numpad 9'>message: <input id='cmessage' type='text' value='"+cmessage+"' onchange='changecmessage(this.value)'></label><span class='info msg'></span></div>" | |
280 | +"<div><label title='Image size in %'>image size: <input id='imgsize' type='number' step='10' min='0' value='"+imgSizePrcnt+"' onchange='changeImgSize(this.value)'></label><span class='info img'></span></div>" | |
281 | +"<div><label title='On-screen extra information (F11)'>always hide extra labels: <input id='extrainfo' type='checkbox' onclick='changeextrainfo(this)'></label><span class='info einfo'></span></div>" | |
282 | +"</div></div>"; | |
283 | ||
284 | par.appendChild(document.createElement('div')).setAttribute('id','h-options'); | |
285 | document.getElementById('h-options').innerHTML = add; | |
286 | - | if (d.checked) { textwidth=2/3; fontthin=true; d.blur(); } |
286 | + | |
287 | - | else { textwidth=1; fontthin=false; d.blur(); } |
287 | + | |
288 | ||
289 | var css = "<style>#options,#options>div{margin-top:.5em;position:relative}#help,#toggle{cursor:pointer}#options,#options>div,#toggle span{position:relative}#help span,#toggle span::after{background-size:100% 100%;width:100%}#options>div span.info::before,#toggle span::after{content:'';background-repeat:no-repeat}a[href*=m28],a[href*=m28]~br,div[style*='height: 90px']{display:none}*{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{opacity:1}#h-options{float:right;margin-bottom:1em}#help{float:right;width:1.75em;height:1.75em}#help span{display:block;background-color:#bfeaf8;background-image:url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTAwMCAxMDAwIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxnPjxwYXRoIGQ9Ik01MDAsOTkwQzIyOS44LDk5MCwxMCw3NzAuMiwxMCw1MDBDMTAsMjI5LjgsMjI5LjgsMTAsNTAwLDEwYzI3MC4yLDAsNDkwLDIxOS44LDQ5MCw0OTBDOTkwLDc3MC4yLDc3MC4yLDk5MCw1MDAsOTkweiBNNTAwLDYwLjRDMjU3LjYsNjAuNCw2MC40LDI1Ny42LDYwLjQsNTAwYzAsMjQyLjQsMTk3LjIsNDM5LjYsNDM5LjYsNDM5LjZjMjQyLjQsMCw0MzkuNi0xOTcuMSw0MzkuNi00MzkuNkM5MzkuNiwyNTcuNiw3NDIuNCw2MC40LDUwMCw2MC40eiIvPjxwYXRoIGQ9Ik00NTAuMyw2NTIuNHYtMzIuM2MwLTEzLjYsMS0yNS44LDMtMzYuNWMyLTEwLjcsNS0yMC45LDkuMy0zMC41YzQuMy05LjYsOS45LTE5LDE3LTI4YzcuMS05LjEsMTYtMTguNywyNi43LTI4LjlsMzguMi0zNi41YzEwLjctOS42LDE5LjktMjAuNCwyNy42LTMyLjNjNy43LTExLjksMTEuNS0yNi4zLDExLjUtNDMuM2MwLTIyLjEtNy00MC42LTIwLjgtNTUuNmMtMTMuOS0xNS0zMy42LTIyLjUtNTkuMS0yMi41Yy0xMywwLTI0LjcsMi40LTM1LjIsNy4yYy0xMC40LDQuOC0xOS41LDExLjMtMjcuMSwxOS41Yy03LjcsOC4yLTEzLjUsMTcuNy0xNy40LDI4LjRjLTMuOSwxMC44LTYuMiwyMS44LTYuOCwzMy4xTDMxMi45LDM4NWMzLjMtMjcuMiwxMC42LTUxLjQsMjEuNi03Mi42YzExLTIxLjIsMjUuMy0zOS4yLDQyLjgtNTMuOWMxNy42LTE0LjcsMzcuNy0yNS45LDYwLjMtMzMuNWMyMi42LTcuNyw0Ny0xMS40LDczLTExLjRjMjQuMywwLDQ3LjQsMy42LDY5LjIsMTAuNmMyMS44LDcuMSw0MSwxNy42LDU3LjcsMzEuNGMxNi43LDEzLjgsMjkuOCwzMSwzOS40LDUxLjRjOS42LDIwLjMsMTQuNCw0My45LDE0LjQsNzAuNGMwLDE4LjEtMiwzMy45LTUuOSw0Ny41Yy0zLjksMTMuNi05LjYsMjYtMTcsMzcuNGMtNy4zLDExLjMtMTYuMiwyMi4yLTI2LjcsMzIuNmMtMTAuNCwxMC40LTIyLjIsMjEuNC0zNS4yLDMyLjZjLTExLjMsOS42LTIwLjUsMTguMi0yNy42LDI1LjVjLTcuMSw3LjMtMTIuNywxNC43LTE3LDIyLjFjLTQuMyw3LjMtNy4yLDE1LjItOC45LDIzLjdjLTEuNyw4LjUtMi42LDE4LjktMi42LDMxLjR2MjIuMUg0NTAuM3ogTTQzMy4zLDc3MC4zYzAtMTgsNi42LTMzLjYsMjAtNDYuNmMxMy4yLTEzLDI5LjMtMTkuNSw0Ny45LTE5LjVjMTguMSwwLDM0LDYuMiw0Ny41LDE4LjdjMTMuNiwxMi40LDIwLjQsMjcuNywyMC40LDQ1LjhjMCwxOC4xLTYuNywzMy43LTIwLDQ2LjdjLTEzLjMsMTMtMjkuMywxOS41LTQ4LDE5LjVjLTkuMSwwLTE3LjctMS44LTI1LjktNS4xYy04LjEtMy40LTE1LjQtNy45LTIxLjUtMTMuNmMtNi4yLTUuNi0xMS4yLTEyLjQtMTQuOS0yMC4zQzQzNS4xLDc4Ny44LDQzMy4zLDc3OS4zLDQzMy4zLDc3MC4zeiIvPjwvZz48L3N2Zz4=);border-radius:100%;height:100%}#options,#options::after{border:1px solid #AAA;background-color:#FCFCFC}#options-cont{float:right;text-align:right;margin-right:1.5em}#options{visibility:hidden;opacity:0;transition:all 250ms;text-align:right;display:flex;flex-direction:column;width:auto}#options>div,#toggle,#toggle span{display:inline-block}#options::after{content:'';border-width:1px 0 0 1px;border-radius:0 0 100%;width:8px;height:8px;position:absolute;right:.75em;top:-5px;transform:rotate(45deg)}#options>div{padding-right:1.75em}#options>:first-child{margin-top:0}#options label input:not([type=checkbox]){width:10em}#options #delay,#options #fontsize{width:8.5em}#options #fontwidth,#options #pathfinder{padding:0;margin:0 .1em 0 .4em;width:1em}#toggle.open~#options::after{opacity:1}#toggle.open~#options{visibility:visible;padding:.5em;opacity:1}#toggle{-webkit-appearance:button;-moz-appearance:button;-ms-appearance:button;appearance:button;height:1.25em;line-height:1.25em;padding:.25em .5em}#toggle span{margin-left:.25em;height:0;width:1.125em}#toggle span::after{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMSAzMSI+PHBvbHlnb24gZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjEuNSIgcG9pbnRzPSIxIDEsMTYgMzAsMzAgMSwxNiAxMCwxIDEiLz48L3N2Zz4=);position:absolute;height:1em;bottom:0;right:0;margin-bottom:-.25em}#toggle.open span::after{transform:rotate(180deg)}#options>div span.info{display:inline-block;position:absolute;width:1.25em;right:0;top:0}#options>div span.info::before{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYwIiB3aWR0aD0iMTYwIiB2ZXJzaW9uPSIxLjAiPjxnIGZpbGw9IiM0YjRiNGIiPjxwYXRoIGQ9Im04MCAxNWMtMzUuODggMC02NSAyOS4xMi02NSA2NXMyOS4xMiA2NSA2NSA2NSA2NS0yOS4xMiA2NS02NS0yOS4xMi02NS02NS02NXptMCAxMGMzMC4zNiAwIDU1IDI0LjY0IDU1IDU1cy0yNC42NCA1NS01NSA1NS01NS0yNC42NC01NS01NSAyNC42NC01NSA1NS01NXoiLz48cGF0aCBkPSJtNTcuMzczIDE4LjIzMWE5LjM4MzQgOS4xMTUzIDAgMSAxIC0xOC43NjcgMCA5LjM4MzQgOS4xMTUzIDAgMSAxIDE4Ljc2NyAweiIgdHJhbnNmb3JtPSJtYXRyaXgoMS4xOTg5IDAgMCAxLjIzNDIgMjEuMjE0IDI4Ljc1KSIvPjxwYXRoIGQ9Im05MC42NjUgMTEwLjk2Yy0wLjA2OSAyLjczIDEuMjExIDMuNSA0LjMyNyAzLjgybDUuMDA4IDAuMXY1LjEyaC0zOS4wNzN2LTUuMTJsNS41MDMtMC4xYzMuMjkxLTAuMSA0LjA4Mi0xLjM4IDQuMzI3LTMuODJ2LTMwLjgxM2MwLjAzNS00Ljg3OS02LjI5Ni00LjExMy0xMC43NTctMy45Njh2LTUuMDc0bDMwLjY2NS0xLjEwNSIvPjwvZz48L3N2Zz4=);background-size:contain;background-position:center right;width:100%;padding-top:80%;position:absolute;top:0;right:0;cursor:help}span.info::after{pointer-events:none;text-align:center;white-space:pre;font-size:85%;font-family:Arial,sans-serif;background-color:#FCFCFC;border:1px solid #AAA;box-shadow:0 0 10px 1px #AAA;padding:.35em;position:absolute;bottom:0;left:50%;transform:translateX(calc(-50% + .125em));z-index:2;display:none}span.info:hover::after{display:block}span.info.pf::after{content:'Enter your prefered delay for the pathfinder.\\A But beware of using too small values,\\A the server may kick you on some levels\\A if you pass a large distance too quickly.\\A\\A Use CTRL+click to ignore pathfinder.\\A Toggle with numpad dot OR delete'}span.info.font::after{content:'Enter font size for writing.\\A\\A Mark the checkbox for narrow text\\A Hotkey: F10'}span.info.msg::after{content:'Enter your own message to spam.\\A\\A Hotkey: numpad 9'}span.info.img::after{content:'Enter image size (%).\\A\\A Draw images with numpad 1 to 9\\A\\A Increase img size: numpad +\\A Descrease img size: numpad -\\A Reset img size: numpad *'}span.info.einfo::after{content:'Hide the top corners indicators\\A of movement/pathfinder and aura\\A\\A Hotkey: F11'}</style>"; | |
290 | ||
291 | function va(f) { | |
292 | if (D) return L = !1, V(f), !1; | |
293 | U() ? X || (X = !0, W(k, q)) : (X = !1, D || M.checked || y.requestPointerLock && y.requestPointerLock()); | |
294 | if (L) L = !1, Q(); | |
295 | else if (V(f), (f.ctrlKey || f.shiftKey) && !H.checked) Y = !0, R = k, S = q; | |
296 | else if (100 < t - ca && v == k && w == q) { | |
297 | ca = t; | |
298 | I.push([v << 1, w << 1, t]); | |
299 | wa(v, w, clicksCount); | |
300 | var b = [v, w]; | |
301 | N.push(b); | |
302 | setTimeout(function() { | |
303 | N.remove(b); | |
304 | }, 1E3); | |
305 | } | |
306 | return !1; | |
307 | } | |
308 | ||
309 | function xa(f) { | |
310 | Y = !1; | |
311 | } | |
312 | ||
313 | function ya() { | |
314 | A.localStorage && M && (A.localStorage.setItem("noCursorLock", M.checked ? "1" : "0"), A.localStorage.setItem("noDrawings", H.checked ? "1" : "0")); | |
315 | } | |
316 | ||
317 | function V(f) { | |
318 | if (U()) { | |
319 | var b = f.webkitMovementX || f.mozMovementX || f.movementX || 0; | |
320 | f = f.webkitMovementY || f.mozMovementY || f.movementY || 0; | |
321 | 300 > Math.abs(b) + Math.abs(f) && (B += b, C += f, v = B >> 1, w = C >> 1); | |
322 | } else f.offsetX ? (B = f.offsetX, C = f.offsetY) : f.layerX && (B = f.layerX, C = f.layerY), v = B >> 1, w = C >> 1; | |
323 | lastX = posX; | |
324 | lastY = posY; | |
325 | posX = k; | |
326 | posY = q; | |
327 | if (Z(), !U() || v == k && w == q || (f = b = 0, v > k && (b = 1), | |
328 | w > q && (f = 1), v = k, w = q, B = (v << 1) + b, C = (w << 1) + f), Y && (R != k || S != q) && 50 < t - da) { | |
329 | b = R; | |
330 | f = S; | |
331 | var a = k, | |
332 | d = q; | |
333 | if (!D && null != u && u.readyState == WebSocket.OPEN) { | |
334 | var g = new ArrayBuffer(9), | |
335 | e = new DataView(g); | |
336 | - | +"<input id='pathfinder' type='checkbox' title='Pathfinder/Movement (numpad . OR delete OR F2)' onclick='disablemovement(this)'><span class='info pf'></span></div>" |
336 | + | |
337 | e.setUint16(1, b, !0); | |
338 | - | +"<input id='fontwidth' type='checkbox' title='Thin text (F10)' onclick='changefontwidth(this)'><span class='info font'></span></div>" |
338 | + | |
339 | - | +"<div><label title='Custom message on pressing Page Up'>message: <input id='cmessage' type='text' value='"+cmessage+"' onchange='changecmessage(this.value)'></label><span class='info msg'></span></div>" |
339 | + | |
340 | e.setUint16(7, d, !0); | |
341 | u.Send(g); | |
342 | } | |
343 | R = k; | |
344 | S = q; | |
345 | da = t; | |
346 | } | |
347 | } | |
348 | ||
349 | - | var css = "<style>#options,#options>div{margin-top:.5em;position:relative}#help,#toggle{cursor:pointer}#options,#options>div,#toggle span{position:relative}#help span,#toggle span::after{background-size:100% 100%;width:100%}#options>div span.info::before,#toggle span::after{content:'';background-repeat:no-repeat}a[href*=m28],a[href*=m28]~br,div[style*='height: 90px']{display:none}*{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{opacity:1}#h-options{float:right;margin-bottom:1em}#help{float:right;width:1.75em;height:1.75em}#help span{display:block;background-color:#bfeaf8;background-image:url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTAwMCAxMDAwIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxnPjxwYXRoIGQ9Ik01MDAsOTkwQzIyOS44LDk5MCwxMCw3NzAuMiwxMCw1MDBDMTAsMjI5LjgsMjI5LjgsMTAsNTAwLDEwYzI3MC4yLDAsNDkwLDIxOS44LDQ5MCw0OTBDOTkwLDc3MC4yLDc3MC4yLDk5MCw1MDAsOTkweiBNNTAwLDYwLjRDMjU3LjYsNjAuNCw2MC40LDI1Ny42LDYwLjQsNTAwYzAsMjQyLjQsMTk3LjIsNDM5LjYsNDM5LjYsNDM5LjZjMjQyLjQsMCw0MzkuNi0xOTcuMSw0MzkuNi00MzkuNkM5MzkuNiwyNTcuNiw3NDIuNCw2MC40LDUwMCw2MC40eiIvPjxwYXRoIGQ9Ik00NTAuMyw2NTIuNHYtMzIuM2MwLTEzLjYsMS0yNS44LDMtMzYuNWMyLTEwLjcsNS0yMC45LDkuMy0zMC41YzQuMy05LjYsOS45LTE5LDE3LTI4YzcuMS05LjEsMTYtMTguNywyNi43LTI4LjlsMzguMi0zNi41YzEwLjctOS42LDE5LjktMjAuNCwyNy42LTMyLjNjNy43LTExLjksMTEuNS0yNi4zLDExLjUtNDMuM2MwLTIyLjEtNy00MC42LTIwLjgtNTUuNmMtMTMuOS0xNS0zMy42LTIyLjUtNTkuMS0yMi41Yy0xMywwLTI0LjcsMi40LTM1LjIsNy4yYy0xMC40LDQuOC0xOS41LDExLjMtMjcuMSwxOS41Yy03LjcsOC4yLTEzLjUsMTcuNy0xNy40LDI4LjRjLTMuOSwxMC44LTYuMiwyMS44LTYuOCwzMy4xTDMxMi45LDM4NWMzLjMtMjcuMiwxMC42LTUxLjQsMjEuNi03Mi42YzExLTIxLjIsMjUuMy0zOS4yLDQyLjgtNTMuOWMxNy42LTE0LjcsMzcuNy0yNS45LDYwLjMtMzMuNWMyMi42LTcuNyw0Ny0xMS40LDczLTExLjRjMjQuMywwLDQ3LjQsMy42LDY5LjIsMTAuNmMyMS44LDcuMSw0MSwxNy42LDU3LjcsMzEuNGMxNi43LDEzLjgsMjkuOCwzMSwzOS40LDUxLjRjOS42LDIwLjMsMTQuNCw0My45LDE0LjQsNzAuNGMwLDE4LjEtMiwzMy45LTUuOSw0Ny41Yy0zLjksMTMuNi05LjYsMjYtMTcsMzcuNGMtNy4zLDExLjMtMTYuMiwyMi4yLTI2LjcsMzIuNmMtMTAuNCwxMC40LTIyLjIsMjEuNC0zNS4yLDMyLjZjLTExLjMsOS42LTIwLjUsMTguMi0yNy42LDI1LjVjLTcuMSw3LjMtMTIuNywxNC43LTE3LDIyLjFjLTQuMyw3LjMtNy4yLDE1LjItOC45LDIzLjdjLTEuNyw4LjUtMi42LDE4LjktMi42LDMxLjR2MjIuMUg0NTAuM3ogTTQzMy4zLDc3MC4zYzAtMTgsNi42LTMzLjYsMjAtNDYuNmMxMy4yLTEzLDI5LjMtMTkuNSw0Ny45LTE5LjVjMTguMSwwLDM0LDYuMiw0Ny41LDE4LjdjMTMuNiwxMi40LDIwLjQsMjcuNywyMC40LDQ1LjhjMCwxOC4xLTYuNywzMy43LTIwLDQ2LjdjLTEzLjMsMTMtMjkuMywxOS41LTQ4LDE5LjVjLTkuMSwwLTE3LjctMS44LTI1LjktNS4xYy04LjEtMy40LTE1LjQtNy45LTIxLjUtMTMuNmMtNi4yLTUuNi0xMS4yLTEyLjQtMTQuOS0yMC4zQzQzNS4xLDc4Ny44LDQzMy4zLDc3OS4zLDQzMy4zLDc3MC4zeiIvPjwvZz48L3N2Zz4=);border-radius:100%;height:100%}#options,#options::after{border:1px solid #AAA;background-color:#FCFCFC}#options-cont{float:right;text-align:right;margin-right:1.5em}#options{visibility:hidden;opacity:0;transition:all 250ms;text-align:right;display:flex;flex-direction:column;width:auto}#options>div,#toggle,#toggle span{display:inline-block}#options::after{content:'';border-width:1px 0 0 1px;border-radius:0 0 100%;width:8px;height:8px;position:absolute;right:.75em;top:-5px;transform:rotate(45deg)}#options>div{padding-right:1.75em}#options>:first-child{margin-top:0}#options label input:not([type=checkbox]){width:10em}#options #delay,#options #fontsize{width:8.5em}#options #fontwidth,#options #pathfinder{padding:0;margin:0 .1em 0 .4em;width:1em}#toggle.open~#options::after{opacity:1}#toggle.open~#options{visibility:visible;padding:.5em;opacity:1}#toggle{/*-webkit-appearance:button;-moz-appearance:button;-ms-appearance:button;appearance:button;*/border:1px solid #aaa;background:linear-gradient(0deg, #ddd, transparent);height:1.25em;line-height:1.25em;padding:.25em .5em}#toggle.open{background:linear-gradient(0deg, transparent, #ddd);}#toggle span{margin-left:.25em;height:0;width:1.125em}#toggle span::after{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMSAzMSI+PHBvbHlnb24gZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjEuNSIgcG9pbnRzPSIxIDEsMTYgMzAsMzAgMSwxNiAxMCwxIDEiLz48L3N2Zz4=);position:absolute;height:1em;bottom:0;right:0;margin-bottom:-.25em}#toggle.open span::after{transform:rotate(180deg)}#options>div span.info{display:inline-block;position:absolute;width:1.25em;right:0;top:0}#options>div span.info::before{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMTYwIiB3aWR0aD0iMTYwIiB2ZXJzaW9uPSIxLjAiPjxnIGZpbGw9IiM0YjRiNGIiPjxwYXRoIGQ9Im04MCAxNWMtMzUuODggMC02NSAyOS4xMi02NSA2NXMyOS4xMiA2NSA2NSA2NSA2NS0yOS4xMiA2NS02NS0yOS4xMi02NS02NS02NXptMCAxMGMzMC4zNiAwIDU1IDI0LjY0IDU1IDU1cy0yNC42NCA1NS01NSA1NS01NS0yNC42NC01NS01NSAyNC42NC01NSA1NS01NXoiLz48cGF0aCBkPSJtNTcuMzczIDE4LjIzMWE5LjM4MzQgOS4xMTUzIDAgMSAxIC0xOC43NjcgMCA5LjM4MzQgOS4xMTUzIDAgMSAxIDE4Ljc2NyAweiIgdHJhbnNmb3JtPSJtYXRyaXgoMS4xOTg5IDAgMCAxLjIzNDIgMjEuMjE0IDI4Ljc1KSIvPjxwYXRoIGQ9Im05MC42NjUgMTEwLjk2Yy0wLjA2OSAyLjczIDEuMjExIDMuNSA0LjMyNyAzLjgybDUuMDA4IDAuMXY1LjEyaC0zOS4wNzN2LTUuMTJsNS41MDMtMC4xYzMuMjkxLTAuMSA0LjA4Mi0xLjM4IDQuMzI3LTMuODJ2LTMwLjgxM2MwLjAzNS00Ljg3OS02LjI5Ni00LjExMy0xMC43NTctMy45Njh2LTUuMDc0bDMwLjY2NS0xLjEwNSIvPjwvZz48L3N2Zz4=);background-size:contain;background-position:center right;width:100%;padding-top:80%;position:absolute;top:0;right:0;cursor:help}span.info::after{pointer-events:none;text-align:center;white-space:pre;font-size:85%;font-family:Arial,sans-serif;background-color:#FCFCFC;border:1px solid #AAA;box-shadow:0 0 10px 1px #AAA;padding:.35em;position:absolute;bottom:0;left:50%;transform:translateX(calc(-50% + .125em));z-index:2;display:none}span.info:hover::after{display:block}span.info.pf::after{content:'Enter your prefered delay for the pathfinder.\\A But beware of using too small values,\\A the server may kick you on some levels\\A if you pass a large distance too quickly.\\A\\A Use CTRL+click to ignore pathfinder.\\A Toggle with numpad dot OR delete OR F2'}span.info.font::after{content:'Enter font size for writing.\\A\\A Mark the checkbox for thin text\\A Hotkey: F10'}span.info.msg::after{content:'Enter your own message to spam.\\A\\A Hotkey: Page Up'}span.info.img::after{content:'Enter image size (%).\\A\\A Draw images with numpad 1-9 or CTRL+(1-9)\\A\\A Increase img size: numpad + or CTRL+plus\\A Descrease img size: numpad - or CTRL+minus\\A Reset img size: numpad * or CTRL+backslash'}span.info.einfo::after{content:'Hide the top corners indicators\\A of movement/pathfinder and aura\\A\\A Hotkey: F11'}</style>"; |
349 | + | |
350 | ea(k, q) && Q(); | |
351 | if (z(k, q)) { | |
352 | var a; | |
353 | a: { | |
354 | a = k; | |
355 | var b = q, | |
356 | c = [], | |
357 | d = new Uint8Array(12E4); | |
358 | c.push([a, b]); | |
359 | d[a + 400 * b] = 1; | |
360 | do { | |
361 | var g = c.shift(), | |
362 | e = g[0], | |
363 | g = g[1]; | |
364 | if (!(0 > e || 0 > g || 400 <= e || 300 <= g)) { | |
365 | if (!z(e, g)) { | |
366 | a = { | |
367 | x: e, | |
368 | y: g | |
369 | }; | |
370 | break a; | |
371 | } | |
372 | d[e - 1 + 400 * g] || (c.push([e - 1, g]), d[e - 1 + 400 * g] = 1); | |
373 | d[e + 1 + 400 * g] || (c.push([e + 1, g]), d[e + 1 + 400 * g] = 1); | |
374 | d[e + 400 * (g - 1)] || (c.push([e, g - 1]), d[e + 400 * (g - 1)] = 1); | |
375 | d[e + 400 * (g + 1)] || (c.push([e, g + 1]), d[e + 400 * (g + 1)] = 1); | |
376 | } | |
377 | } while (0 < c.length); | |
378 | a = { | |
379 | x: a, | |
380 | y: b | |
381 | }; | |
382 | } | |
383 | k = a.x; | |
384 | q = a.y; | |
385 | } | |
386 | if (k != v || q != w) a = fa(k, q, v, w), k = a.x, q = a.y; | |
387 | ea(k, q) && Q(); | |
388 | } | |
389 | ||
390 | function next() { | |
391 | console.log("Next map"); | |
392 | initialLoad = true; | |
393 | T.set(za); | |
394 | r = []; | |
395 | I = []; | |
396 | O = []; | |
397 | } | |
398 | ||
399 | function ga(f) { | |
400 | a.imageSmoothingEnabled = f; | |
401 | a.mozImageSmoothingEnabled = f; | |
402 | a.oImageSmoothingEnabled = f; | |
403 | a.webkitImageSmoothingEnabled = f; | |
404 | } | |
405 | ||
406 | function Aa() { | |
407 | next(); | |
408 | console.log("Connected!"); | |
409 | } | |
410 | ||
411 | function Ba(a) { | |
412 | next(); | |
413 | console.log("Socket closed: " + a.reason); | |
414 | } | |
415 | ||
416 | function Ca(a) { | |
417 | console.log("Socket error"); | |
418 | } | |
419 | ||
420 | function Da(a, b) { | |
421 | for (var c = "", d = 0, g = 0; 0 != (g = a.getUint8(b)); ++b) d <<= 8, d |= g, g & 128 || (c += String.fromCharCode(d), d = 0); | |
422 | 0 != d && (c += String.fromCharCode(d)); | |
423 | return [c, b + 1]; | |
424 | } | |
425 | ||
426 | function Ea(a, b) { | |
427 | setTimeout(function() { | |
428 | var c = a.getUint16(b, !0), | |
429 | d = 0; | |
430 | a: for (; d < c; d++) { | |
431 | for (var g = a.getUint16(b + 2 + 4 * d, !0), e = a.getUint16(b + 4 + 4 * d, !0), n = 0; n < N.length; n++) { | |
432 | var l = N[n]; | |
433 | if (l[0] == g && l[1] == e) { | |
434 | N.splice(n, 1); | |
435 | continue a; | |
436 | } | |
437 | } | |
438 | I.push([g << 1, e << 1, t]); | |
439 | } | |
440 | }, 100); | |
441 | return b + 2 + 4 * a.getUint16(b, !0); | |
442 | } | |
443 | ||
444 | function Fa(a, b) { | |
445 | !H.checked && setTimeout(function() { | |
446 | for (var c = a.getUint16(b, !0), d = 0; d < c; d++) { | |
447 | var g = a.getUint16(b + 2 + 8 * d, !0), | |
448 | e = a.getUint16(b + 4 + 8 * d, !0), | |
449 | n = a.getUint16(b + 6 + 8 * d, !0), | |
450 | - | var countlevels=-2; |
450 | + | |
451 | O.push([g << 1, e << 1, n << 1, l << 1, t]); | |
452 | } | |
453 | }, 50); | |
454 | return b + 2 + 8 * a.getUint16(b, !0); | |
455 | } | |
456 | ||
457 | function Ga(a) { | |
458 | - | countlevels+=1; |
458 | + | |
459 | initialLoad = false; | |
460 | a = a.data; | |
461 | var b = new DataView(a); | |
462 | switch (b.getUint8(0)) { | |
463 | case 0: | |
464 | ha = b.getUint32(1, !0); | |
465 | break; | |
466 | case 1: | |
467 | var c; | |
468 | ia = c = b.getUint16(1, !0); | |
469 | ja = 100 <= c; | |
470 | var d = [], | |
471 | g; | |
472 | for (g in F) F.hasOwnProperty(g) && d.push(g); | |
473 | ||
474 | for (var e = | |
475 | 0; e < c; e++) { | |
476 | g = b.getUint32(3 + 8 * e, !0); | |
477 | var n = b.getUint16(7 + 8 * e, !0), | |
478 | l = b.getUint16(9 + 8 * e, !0); | |
479 | if (g != ha) { | |
480 | if (null != F[g]) { | |
481 | for (var p = 0; p < d.length; p++) | |
482 | if (d[p] == g) { | |
483 | d.splice(p, 1); | |
484 | break; | |
485 | } | |
486 | g = F[g]; | |
487 | g.oldX = g.getX(); | |
488 | g.oldY = g.getY(); | |
489 | g.newX = n; | |
490 | g.newY = l; | |
491 | g.time = t; | |
492 | } else F[g] = new ka(n, l); | |
493 | } else { | |
494 | serverPosX = n; | |
495 | serverPosY = l; | |
496 | } | |
497 | } | |
498 | for (e = 0; e < d.length; e++) delete F[d[e]]; | |
499 | c = Ea(b, 3 + 8 * c); | |
500 | g = b.getUint16(c, !0); | |
501 | c += 2; | |
502 | for (d = 0; d < g; d++) { | |
503 | a: for (n = b.getUint32(c, !0), e = 0; e < r.length; e++) | |
504 | if (r[e].id == n) { | |
505 | var k = r[e]; | |
506 | if (1 == k.type) | |
507 | for (var n = k.x | 0, l = k.y | 0, p = k.width | 0, k = k.height | 0, m = l; m < l + k; ++m) | |
508 | for (var h = | |
509 | n; h < n + p; ++h) --T[h + 400 * m]; | |
510 | r.splice(e, 1); | |
511 | break a; | |
512 | }c += 4; | |
513 | } | |
514 | g = b.getUint16(c, !0); | |
515 | c += 2; | |
516 | for (d = 0; d < g; d++) { | |
517 | a: { | |
518 | e = b.getUint32(c, !0); | |
519 | for (n = 0; n < r.length; n++) | |
520 | if (r[n].id == e) { | |
521 | e = r[n]; | |
522 | break a; | |
523 | } | |
524 | e = { | |
525 | id: e | |
526 | }; | |
527 | r.push(e); | |
528 | } | |
529 | c += 4;c = la(b, c, e); | |
530 | } | |
531 | c = Fa(b, c); | |
532 | if (a.byteLength < c + 4) break; | |
533 | aa = b.getUint32(c, !0); | |
534 | break; | |
535 | case 4: | |
536 | next(); | |
537 | W(b.getUint16(1, !0), b.getUint16(3, !0)); | |
538 | g = b.getUint16(5, !0); | |
539 | c = 7; | |
540 | for (d = 0; d < g; d++) e = {}, e.id = b.getUint32(c, !0), c += 4, c = la(b, c, e), r.push(e); | |
541 | a.byteLength >= c + 4 ? G = Math.max(G, b.getUint32(c, !0)) : a.byteLength >= c + 2 && (G = Math.max(G, b.getUint16(c, !0))); | |
542 | Z(); | |
543 | break; | |
544 | case 5: | |
545 | W(b.getUint16(1, !0), b.getUint16(3, !0)), 9 <= b.byteLength ? G = Math.max(G, b.getUint32(5, !0)) : 7 <= b.byteLength && (G = Math.max(G, b.getUint16(5, !0))), Z(); | |
546 | } | |
547 | } | |
548 | ||
549 | function Q() { | |
550 | if (!(D || L || null == u || u.readyState != WebSocket.OPEN || k == J && q == K) && movementEnabled) { | |
551 | var a = new ArrayBuffer(9); | |
552 | b = new DataView(a); | |
553 | b.setUint8(0, 1); | |
554 | b.setUint16(1, k, !0); | |
555 | b.setUint16(3, q, !0); | |
556 | b.setUint32(5, G, !0); | |
557 | u.send(a); | |
558 | J = k; | |
559 | K = q; | |
560 | } | |
561 | ||
562 | } | |
563 | ||
564 | function Au() { | |
565 | Throttler.sendOut(); | |
566 | if (auraEnabled) drawAura(J, K); | |
567 | } | |
568 | ||
569 | function wa(a, b, numClicks) { | |
570 | if (!D && null != u && u.readyState == WebSocket.OPEN) { | |
571 | var c = new ArrayBuffer(9), | |
572 | d = new DataView(c); | |
573 | d.setUint8(0, 2); | |
574 | d.setUint16(1, a, !0); | |
575 | d.setUint16(3, b, !0); | |
576 | d.setUint32(5, G, !0); | |
577 | for (var i = 0; i < numClicks; i++) { u.Send(c); } | |
578 | } | |
579 | } | |
580 | ||
581 | function la(f, b, c) { | |
582 | function d() { | |
583 | c.x = f.getUint16(b, !0); | |
584 | b += 2; | |
585 | c.y = f.getUint16(b, !0); | |
586 | b += 2; | |
587 | c.width = f.getUint16(b, !0); | |
588 | b += 2; | |
589 | c.height = f.getUint16(b, !0); | |
590 | b += 2; | |
591 | } | |
592 | function g() { | |
593 | for (var a = f.getUint32(b, !0).toString(16); 6 > a.length;) a = "0" + a; | |
594 | b += 4; | |
595 | c.color = "#" + a; | |
596 | } | |
597 | var e = f.getUint8(b); | |
598 | b += 1; | |
599 | c.type = e; | |
600 | switch (e) { | |
601 | case 255: | |
602 | break; | |
603 | case 0: | |
604 | c.x = f.getUint16(b, !0); | |
605 | b += 2; | |
606 | c.y = f.getUint16(b, !0); | |
607 | b += 2; | |
608 | c.size = f.getUint8(b); | |
609 | b += 1; | |
610 | c.isCentered = !!f.getUint8(b); | |
611 | b += 1; | |
612 | e = Da(f, b); | |
613 | c.text = e[0]; | |
614 | b = e[1]; | |
615 | break; | |
616 | case 1: | |
617 | d(); | |
618 | var n = !c.color; | |
619 | g(); | |
620 | var e = c.x | 0, | |
621 | l = c.y | 0, | |
622 | p = c.width | 0, | |
623 | k = c.height | 0; | |
624 | if (n) | |
625 | for (n = l; n < l + k; ++n) | |
626 | for (var m = e; m < e + p; ++m) ++T[m + 400 * n]; | |
627 | break; | |
628 | case 2: | |
629 | d(); | |
630 | c.isBad = !!f.getUint8(b); | |
631 | b += 1; | |
632 | break; | |
633 | case 3: | |
634 | d(); | |
635 | c.count = f.getUint16(b, !0); | |
636 | b += 2; | |
637 | g(); | |
638 | break; | |
639 | case 4: | |
640 | d(); | |
641 | c.count ? c.count > f.getUint16(b, !0) && (c.lastClickAt = t) : c.lastClickAt = 0; | |
642 | c.count = f.getUint16(b, !0); | |
643 | b += 2; | |
644 | g(); | |
645 | break; | |
646 | case 5: | |
647 | c.x = f.getUint16(b, !0); | |
648 | b += 2; | |
649 | c.y = f.getUint16(b, !0); | |
650 | b += 2; | |
651 | c.queue = [ [0, c.x, c.y]]; | |
652 | c.potentialQueue = []; | |
653 | c.explored = new Uint8Array(12E4); | |
654 | c.img = a.createImageData(400, 300); | |
655 | e = E.createElement("canvas"); | |
656 | e.width = 400; | |
657 | e.height = 300; | |
658 | c.canvas = e; | |
659 | c.ctx = c.canvas.getContext("2d"); | |
660 | break; | |
661 | default: | |
662 | throw Error("Unknown object type " + e); | |
663 | } | |
664 | return b; | |
665 | } | |
666 | ||
667 | function ea(a, b) { | |
668 | if (-1 != J && -1 != K) { | |
669 | var c = fa(J, K, a, b); | |
670 | if (c.x != a || c.y != b) return !0; | |
671 | } | |
672 | for (c = 0; c < r.length; c++) { | |
673 | var d = r[c]; | |
674 | if (2 == d.type && !(k < d.x || q < d.y || k >= d.x + d.width || q >= d.y + d.height)) return !0; | |
675 | } | |
676 | return !1; | |
677 | } | |
678 | ||
679 | window.showHelp = false; | |
680 | function ma() { | |
681 | a.clearRect(0, 0, a.canvas.width, a.canvas.height); | |
682 | a.save(); | |
683 | if (null != u && u.readyState != WebSocket.OPEN || L) { | |
684 | var f; | |
685 | if (null == u) f = "Click to begin"; | |
686 | else switch (u.readyState) { | |
687 | case WebSocket.CONNECTING: | |
688 | f = "Connecting"; | |
689 | break; | |
690 | case WebSocket.CLOSING: | |
691 | case WebSocket.CLOSED: | |
692 | f = "Lost connection to server"; | |
693 | break; | |
694 | default: | |
695 | f = "Click to begin"; | |
696 | } | |
697 | a.font = 60 + "px NovaSquare"; | |
698 | a.fillText(f, 400 - a.measureText(f).width / 2, 300); | |
699 | a.font = 20 + "px NovaSquare"; | |
700 | f = "-> script remastered by q1k <-"; | |
701 | a.fillText(f, 400 - a.measureText(f).width / 2, 345); | |
702 | na(); | |
703 | oa(!1); | |
704 | } else { | |
705 | a.fillStyle = "#000000"; | |
706 | a.save(); | |
707 | a.globalAlpha = 1; | |
708 | var typeZeroCount = 0; | |
709 | var typeOneCount = 0; | |
710 | var typeTwoCount = 0; | |
711 | var typeThreeCount = 0; | |
712 | var typeFourCount = 0; | |
713 | for (f = 0; f < r.length; f++) { | |
714 | var b = r[f]; | |
715 | if (0 == b.type) { | |
716 | a.font = b.size + "px NovaSquare"; | |
717 | var c = b.x << 1, | |
718 | d = b.y << 1; | |
719 | b.isCentered && (c -= a.measureText(b.text).width / 2); | |
720 | a.fillStyle = "#000000"; | |
721 | a.fillText(b.text, c, d); | |
722 | typeZeroCount++; | |
723 | } else if (1 == b.type) { | |
724 | a.fillStyle = b.color, a.fillRect(b.x << 1, b.y << 1, b.width << 1, b.height << 1); | |
725 | a.strokeStyle = "#000000", a.globalAlpha = .2, a.lineWidth = 2; | |
726 | a.strokeRect((b.x << 1) + 1, (b.y << 1) + 1, (b.width << 1) - 2, (b.height << 1) - 2); | |
727 | a.globalAlpha = 1; | |
728 | typeOneCount++; | |
729 | } else if (2 == b.type) { | |
730 | a.fillStyle = b.isBad ? "#FF0000" : "#00FF00", a.globalAlpha = .2; | |
731 | a.fillRect(b.x << 1, b.y << 1, b.width << 1, b.height << 1); | |
732 | a.globalAlpha = 1; | |
733 | typeTwoCount++; | |
734 | } else if (3 == b.type) { | |
735 | var c = b.x << 1, | |
736 | d = b.y << 1, | |
737 | g = b.width << 1, | |
738 | e = b.height << 1; | |
739 | a.fillStyle = b.color; | |
740 | a.globalAlpha = .2; | |
741 | - | //var cursorsonline=0; |
741 | + | |
742 | a.globalAlpha = .5; | |
743 | a.fillStyle = "#000000"; | |
744 | if (40 > b.width || 40 > b.height) { | |
745 | a.font = 30 + "px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 10); | |
746 | } else { | |
747 | a.font = 60 + "px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 20); | |
748 | }; | |
749 | a.globalAlpha = 1; | |
750 | typeThreeCount++; | |
751 | } else if (4 == b.type) { | |
752 | c = b.x << 1; | |
753 | d = b.y << 1; | |
754 | g = b.width << 1; | |
755 | e = b.height << 1; | |
756 | a.fillStyle = b.color; | |
757 | a.strokeStyle = b.color; | |
758 | a.globalAlpha = 1; | |
759 | a.fillRect(c, d, g, e); | |
760 | a.globalAlpha = .2; | |
761 | a.fillStyle = "#000000"; | |
762 | a.fillRect(c, d, g, e); | |
763 | a.globalAlpha = 1; | |
764 | a.fillStyle = b.color; | |
765 | var n = 150 > t - b.lastClickAt, l = n ? 8 : 12; | |
766 | a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l); | |
767 | a.strokeStyle = "#000000"; | |
768 | a.globalAlpha = .1; | |
769 | a.beginPath(); | |
770 | a.moveTo(c, d); | |
771 | a.lineTo(c + l, d + l); | |
772 | a.moveTo(c + g, d); | |
773 | a.lineTo(c + g - l, d + l); | |
774 | a.moveTo(c, d + e); | |
775 | a.lineTo(c + l, d + e - l); | |
776 | a.moveTo(c + g, d + e); | |
777 | a.lineTo(c + g - l, d + e - l); | |
778 | a.moveTo(c, d); | |
779 | a.rect(c, d, g, e); | |
780 | a.rect(c + l, d + l, g - 2 * l, e - 2 * l); | |
781 | a.stroke(); | |
782 | a.fillStyle = "#000000"; | |
783 | a.globalAlpha = .5; | |
784 | if (50 > b.width || 50 > b.height) { | |
785 | a.font = 35 + "px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 13); | |
786 | } else { | |
787 | a.font = 45 + "px NovaSquare", a.fillText(b.count, c + g / 2 - a.measureText(b.count).width / 2, d + e / 2 + 16); | |
788 | } | |
789 | n && (a.fillStyle = "#000000", a.globalAlpha = .15, a.fillRect(c + l, d + l, g - 2 * l, e - 2 * l)); | |
790 | a.globalAlpha = 1; | |
791 | typeFourCount++; | |
792 | } else 5 == b.type && (ga(!1), a.drawImage(b.canvas, 0, 0, 400, 300, 0, 0, 800, 600, ga(!0))); | |
793 | } | |
794 | if (r.length == 8 && typeZeroCount == 4 && typeOneCount == 3 && typeTwoCount == 1 && typeThreeCount == 0 && typeFourCount == 0) { | |
795 | a.globalAlpha = 1; | |
796 | f = "(Or just play cursors.io)", a.font = 15 + "px NovaSquare", a.fillStyle = "#000000"; | |
797 | a.fillText(f, 400 - a.measureText(f).width / 2, 408); | |
798 | } | |
799 | a.restore(); | |
800 | if (!D) { | |
801 | a.font = 12 + "px NovaSquare", a.strokeStyle = "#000000", a.fillStyle = "#FFFFFF", a.lineWidth = 2.5; | |
802 | f = ja ? "Area too full, not all cursors are shown" : 30 < ia ? "Area too full, drawing is disabled" : "Use shift+click to draw"; | |
803 | a.globalAlpha = .5, a.strokeText(f, 10, 590), a.globalAlpha = 1; | |
804 | a.fillText(f, 10, 590); | |
805 | if (aa != 0) { | |
806 | f = aa + " players online", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 590), a.globalAlpha = 1; | |
807 | a.fillText(f, 790 - b, 590); | |
808 | }; | |
809 | if (!movementEnabled && !hideExtraInfo) { | |
810 | f = "movement disabled / pathfinder enabled"; | |
811 | a.globalAlpha = .5, a.strokeText(f, 10, 15), a.globalAlpha = 1; | |
812 | a.fillText(f, 10, 15); | |
813 | f = "press numpad . OR delete to toggle"; | |
814 | a.globalAlpha = .5, a.strokeText(f, 10, 30), a.globalAlpha = 1; | |
815 | a.fillText(f, 10, 30); | |
816 | } | |
817 | if (auraEnabled && !hideExtraInfo) { | |
818 | f = "aura enabled", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 15), a.globalAlpha = 1; | |
819 | a.fillText(f, 790 - b, 15); | |
820 | f = "press numpad 0 OR insert to disable", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 30), a.globalAlpha = 1; | |
821 | a.fillText(f, 790 - b, 30); | |
822 | } | |
823 | if (imgSizeShow) { | |
824 | f = "image size: " + imgSizePrcnt + "%"; a.globalAlpha = .5, a.strokeText(f, 10, 560), a.globalAlpha = 1; | |
825 | a.fillText(f, 10, 560); | |
826 | //f = "image size: " + imgSizePrcnt + "%", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 560), a.globalAlpha = 1; | |
827 | //a.fillText(f, 790 - b, 560); | |
828 | } | |
829 | } | |
830 | na(); | |
831 | if (!H.checked) { | |
832 | a.save(); | |
833 | a.strokeStyle = "#000000"; | |
834 | a.lineWidth = 1; | |
835 | t = +new Date; | |
836 | a.beginPath(); | |
837 | for (f = 0; f < O.length; f++) { | |
838 | b = O[f]; | |
839 | c = 10 - (t - b[4]) / 1E3; | |
840 | if (c <= 0) { | |
841 | O.splice(f, 1), | |
842 | --f; | |
843 | } else { | |
844 | 1 < c && (c = 1), a.globalAlpha = .3 * c; | |
845 | a.moveTo(b[0] - .5, b[1] - .5); | |
846 | a.lineTo(b[2] - .5, b[3] - .5); | |
847 | } | |
848 | } | |
849 | a.stroke(); | |
850 | a.restore(); | |
851 | } | |
852 | a.save(); | |
853 | //for (var p in F) F.hasOwnProperty(p) && a.drawImage(P, scale(sa(F[p].getX()) - 6), scale(ta(F[p].getY()) - 6), scale(P.width), scale(P.height)); | |
854 | ||
855 | for (var p in F) { | |
856 | F.hasOwnProperty(p) && a.drawImage(P, sa(F[p].getX()) - 6, ta(F[p].getY()) - 6); | |
857 | // show ids? | |
858 | if (showcursorsid) { | |
859 | if(cursorIDPos==2){ | |
860 | cp=a.measureText(p).width; | |
861 | a.globalAlpha = .5; a.strokeText( p, sa(F[p].getX()) - cp + cursorIDX, ta(F[p].getY()) + cursorIDY ); | |
862 | a.globalAlpha= 1; a.fillText( p, sa(F[p].getX()) - cp + cursorIDX, ta(F[p].getY()) + cursorIDY ); | |
863 | } | |
864 | else{ | |
865 | a.globalAlpha = .5; a.strokeText( p, sa(F[p].getX()) + cursorIDX, ta(F[p].getY()) + cursorIDY ); | |
866 | a.globalAlpha= 1; a.fillText( p, sa(F[p].getX()) + cursorIDX, ta(F[p].getY()) + cursorIDY ); | |
867 | } | |
868 | } | |
869 | - | //f = (cursorsonline+1) + "/" + |
869 | + | |
870 | if (showcursorsid) { | |
871 | if(cursorIDPos==2){ | |
872 | cp=a.measureText(ha).width; | |
873 | a.globalAlpha = .5; a.strokeText( ha, sa(k) - cp + cursorIDX, ta(q) + cursorIDY ) ; | |
874 | a.globalAlpha= 1; a.fillText( ha, sa(k) - cp + cursorIDX, ta(q) + cursorIDY ) ; | |
875 | } | |
876 | else{ | |
877 | - | f = "press numpad . OR delete OR F2 to toggle"; |
877 | + | |
878 | a.globalAlpha= 1; a.fillText( ha, sa(k) + cursorIDX, ta(q) + cursorIDY ) ; | |
879 | } | |
880 | } | |
881 | ||
882 | a.restore(); | |
883 | oa(!0); | |
884 | - | f = "press numpad 0 OR insert OR ctrl+0 to disable", b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 30), a.globalAlpha = 1; |
884 | + | |
885 | a.font = 15 + "px NovaSquare", a.strokeStyle = "#000000", a.fillStyle = "#FFFFFF", a.lineWidth = 2.5; | |
886 | if (message.length>0){ | |
887 | b = a.measureText(message).width/2; | |
888 | a.globalAlpha = .5, a.strokeText(message, 400 - b, 580), a.globalAlpha = 1; | |
889 | a.fillText(message, 400 - b, 580); | |
890 | } | |
891 | for (var i=0; i < messages.length; i++){ | |
892 | b = a.measureText(messages[i]).width/2; | |
893 | - | if (countlevels>0) { |
893 | + | |
894 | - | f = "level: "+countlevels, b = a.measureText(f).width, a.globalAlpha = .5, a.strokeText(f, 790 - b, 560), a.globalAlpha = 1; |
894 | + | |
895 | - | a.fillText(f, 790 - b, 560); |
895 | + | |
896 | if (showHelp) { | |
897 | var oo = a.measureText("->").width; | |
898 | a.font = 12 + "px NovaSquare"; | |
899 | f = "How to use (press F1 to hide):", a.globalAlpha = .5, a.strokeText(f, 10, 45), a.globalAlpha = 1, a.fillText(f, 10, 45); | |
900 | f = "-> To type: type message and hit enter (shift+enter for new row)", a.globalAlpha = .5, a.strokeText(f, 10, 60), a.globalAlpha = 1, a.fillText(f, 10, 60); | |
901 | f = "-> To enable or disable movement: press numpad . OR delete", a.globalAlpha = .5, a.strokeText(f, 10, 75), a.globalAlpha = 1, a.fillText(f, 10, 75); | |
902 | f = "pathfiner will be active in this mode", a.globalAlpha = .5, a.strokeText(f, 10+oo, 90), a.globalAlpha = 1, a.fillText(f, 10+oo, 90); | |
903 | f = "-> To start/stop drawing circle: press numpad 0 OR insert", a.globalAlpha = .5, a.strokeText(f, 10, 105), a.globalAlpha = 1, a.fillText(f, 10, 105); | |
904 | f = "-> To draw arrows, use the arrow keys", a.globalAlpha = .5, a.strokeText(f, 10, 120), a.globalAlpha = 1, a.fillText(f, 10, 120); | |
905 | f = "-> To draw images: press numpad 1 - numpad 9", a.globalAlpha = .5, a.strokeText(f, 10, 135), a.globalAlpha = 1, a.fillText(f, 10, 135); | |
906 | f = "-> To make images bigger/smaller use numpad + and -", a.globalAlpha = .5, a.strokeText(f, 10, 150), a.globalAlpha = 1, a.fillText(f, 10, 150); | |
907 | f = "-> To reset image size press *", a.globalAlpha = .5, a.strokeText(f, 10, 165), a.globalAlpha = 1, a.fillText(f, 10, 165); | |
908 | f = "-> To show/hide cursors ids: press F8", a.globalAlpha = .5, a.strokeText(f, 10, 180), a.globalAlpha = 1, a.fillText(f, 10, 180); | |
909 | f = "-> Change ids position: press F9", a.globalAlpha = .5, a.strokeText(f, 10, 195), a.globalAlpha = 1, a.fillText(f, 10, 195); | |
910 | } | |
911 | } | |
912 | } | |
913 | a.restore(); | |
914 | A.requestAnimationFrame(ma) | |
915 | } | |
916 | ||
917 | function scale(z) { | |
918 | return Math.round(z/600*a.canvas.height); | |
919 | } | |
920 | ||
921 | function na() { | |
922 | - | //cursorsonline=0; |
922 | + | |
923 | a.strokeStyle = "#000000"; | |
924 | t = +new Date; | |
925 | - | //cursorsonline+=1; |
925 | + | |
926 | var b = I[f], | |
927 | c = (t - b[2]) / 1E3, | |
928 | - | if(cursorIDPos==2) { |
928 | + | |
929 | 0 >= d ? (I.splice(f, 1), --f) : (c *= 50, a.beginPath(), a.globalAlpha = .3 * d, a.arc(b[0], b[1], c, 0, 2 * Math.PI, !1), a.stroke()); | |
930 | } | |
931 | a.restore() | |
932 | } | |
933 | ||
934 | function oa(f) { | |
935 | if (D) a.save(), a.globalAlpha = 1, a.drawImage(P, B - 5, C - 5, P.width, P.height); | |
936 | else { | |
937 | var b = 0, | |
938 | c = 0; | |
939 | if (v != k || w != q) { | |
940 | - | if(cursorIDPos==2) { |
940 | + | |
941 | if (f) { | |
942 | a.globalAlpha = .2, a.fillStyle = "#FF0000", a.beginPath(); | |
943 | a.arc(B + 2, C + 8, 20, 0, 2 * Math.PI, !1); | |
944 | a.fill(); | |
945 | } | |
946 | a.globalAlpha = .5; | |
947 | a.drawImage(P, B - 5, C - 5, P.width, P.height); | |
948 | a.restore(); | |
949 | } else { | |
950 | b = B & 1, c = C & 1; | |
951 | } | |
952 | a.save(); | |
953 | if (f) { | |
954 | a.globalAlpha = .2, a.fillStyle = "#FFFF00", a.beginPath(); | |
955 | - | if (message.length>0) { |
955 | + | |
956 | a.fill(); | |
957 | } | |
958 | a.globalAlpha = 1; | |
959 | a.drawImage(Ia, (k << 1) + b - 5, (q << 1) + c - 5, Ia.width, Ia.height); | |
960 | - | for (var i=0; i < messages.length; i++) { |
960 | + | |
961 | a.strokeStyle = "#DD4444", a.lineWidth = 1; | |
962 | a.beginPath(); | |
963 | a.arc(serverPosX << 1, serverPosY << 1, 4, 0, 2*Math.PI); | |
964 | a.stroke(); | |
965 | } | |
966 | } | |
967 | a.restore(); | |
968 | - | f = "How to use (press F1 to hide):", a.globalAlpha = .5, a.strokeText(f, 10, 45), a.globalAlpha = 1, a.fillText(f, 10, 45); |
968 | + | |
969 | - | f = "-> To type: type message and hit enter (shift+enter for new row)", a.globalAlpha = .5, a.strokeText(f, 10, 60), a.globalAlpha = 1, a.fillText(f, 10, 60); |
969 | + | |
970 | - | f = "-> To enable/disable movement: press numpad . OR delete OR F2", a.globalAlpha = .5, a.strokeText(f, 10, 75), a.globalAlpha = 1, a.fillText(f, 10, 75); |
970 | + | |
971 | - | f = "pathfiner will be active in this mode", a.globalAlpha = .5, a.strokeText(f, 10+oo, 90), a.globalAlpha = 1, a.fillText(f, 10+oo, 90); |
971 | + | |
972 | - | f = "-> To start/stop drawing circle: press numpad 0 OR insert OR CTRL+0", a.globalAlpha = .5, a.strokeText(f, 10, 105), a.globalAlpha = 1, a.fillText(f, 10, 105); |
972 | + | |
973 | - | f = "-> To draw arrows, use the arrow keys", a.globalAlpha = .5, a.strokeText(f, 10, 120), a.globalAlpha = 1, a.fillText(f, 10, 120); |
973 | + | |
974 | - | f = "-> To draw images: press numpad 1-9 OR CTRL+(1-9)", a.globalAlpha = .5, a.strokeText(f, 10, 135), a.globalAlpha = 1, a.fillText(f, 10, 135); |
974 | + | |
975 | - | f = "-> To resize images use numpad plus/minus OR CTRL plus/minus", a.globalAlpha = .5, a.strokeText(f, 10, 150), a.globalAlpha = 1, a.fillText(f, 10, 150); |
975 | + | |
976 | - | f = "-> To reset image size press numpad * OR CTRL+backslash", a.globalAlpha = .5, a.strokeText(f, 10, 165), a.globalAlpha = 1, a.fillText(f, 10, 165); |
976 | + | |
977 | - | f = "-> To show/hide cursors ids: press F8", a.globalAlpha = .5, a.strokeText(f, 10, 180), a.globalAlpha = 1, a.fillText(f, 10, 180); |
977 | + | |
978 | - | f = "-> Change ids position: press F9", a.globalAlpha = .5, a.strokeText(f, 10, 195), a.globalAlpha = 1, a.fillText(f, 10, 195); |
978 | + | |
979 | ||
980 | function fa(a, b, c, d) { | |
981 | a |= 0; | |
982 | b |= 0; | |
983 | c |= 0; | |
984 | d |= 0; | |
985 | if (z(a, b)) return { | |
986 | x: a, | |
987 | y: b | |
988 | }; | |
989 | if (a == c && b == d) return { | |
990 | x: c, | |
991 | y: d | |
992 | }; | |
993 | var g = a, | |
994 | e = b; | |
995 | c = c - a | 0; | |
996 | d = d - b | 0; | |
997 | var n = | |
998 | 0, | |
999 | l = 0, | |
1000 | p = 0, | |
1001 | k = 0; | |
1002 | 0 > c ? n = -1 : 0 < c && (n = 1); | |
1003 | 0 > d ? l = -1 : 0 < d && (l = 1); | |
1004 | 0 > c ? p = -1 : 0 < c && (p = 1); | |
1005 | var m = Math.abs(c) | 0, | |
1006 | h = Math.abs(d) | 0; | |
1007 | m <= h && (m = Math.abs(d) | 0, h = Math.abs(c) | 0, 0 > d ? k = -1 : 0 < d && (k = 1), p = 0); | |
1008 | c = m >> 1; | |
1009 | for (d = 0; d <= m && !z(a, b); d++) g = a, e = b, c += h, c >= m ? (c -= m, a += n, b += l) : (a += p, b += k); | |
1010 | return { | |
1011 | x: g, | |
1012 | y: e | |
1013 | } | |
1014 | } | |
1015 | ||
1016 | function z(a, b) { | |
1017 | return 0 > a || 400 <= a || 0 > b || 300 <= b ? !0 : T[a + 400 * b] | |
1018 | } | |
1019 | ||
1020 | function Ja() { | |
1021 | for (var a = 0; a < r.length; a++) { | |
1022 | var b = r[a]; | |
1023 | 5 == b.type && Ka(b) | |
1024 | } | |
1025 | } | |
1026 | ||
1027 | function Ka(a) { | |
1028 | function b(a, b, c) { | |
1029 | e.push([c, a, b]); | |
1030 | l[a + 400 * b] = !0; | |
1031 | g(a, b) | |
1032 | } | |
1033 | ||
1034 | function c(a, b, c) { | |
1035 | p.push([c, | |
1036 | a, b | |
1037 | ]); | |
1038 | l[a + 400 * b] = !0 | |
1039 | } | |
1040 | ||
1041 | function d(a, b) { | |
1042 | return 255 != k[4 * (a + 400 * b) + 3] && !l[a + 400 * b] | |
1043 | } | |
1044 | ||
1045 | function g(a, b) { | |
1046 | var c = 4 * (a + 400 * b); | |
1047 | k[c + 0] = 255; | |
1048 | k[c + 1] = 153; | |
1049 | k[c + 2] = 153; | |
1050 | k[c + 3] = 255 | |
1051 | } | |
1052 | for (var e = a.queue, k = a.img.data, l = a.explored, p = a.potentialQueue, r = e.length, m = 0; m < p.length; m++) z(p[m][1], p[m][2]) || (g(p[m][1], p[m][2]), e.push(p[m]), p.splice(m, 1), --m); | |
1053 | for (m = 0; m < r; ++m) z(e[m][1], e[m][2]) && (p.push(e[m]), e.splice(m, 1), --m, --r); | |
1054 | for (r = 0; 50 > r && 0 != e.length; ++r) { | |
1055 | for (var h = Number.POSITIVE_INFINITY, q = [e[0]], m = 1; m < e.length; ++m) { | |
1056 | var x = e[m][0]; | |
1057 | .01 > Math.abs(x - h) ? q.push(e[m]) : x < h && (h = x, q = [e[m]]) | |
1058 | } | |
1059 | for (m = 0; m < q.length; ++m) { | |
1060 | var x = q[m][0], | |
1061 | h = q[m][1], | |
1062 | s = q[m][2], | |
1063 | qa = e.indexOf(q[m]); - 1 != qa && e.splice(qa, 1); | |
1064 | 0 < h && d(h - 1, s) && (z(h - 1, s) ? c(h - 1, s, x + 1) : b(h - 1, s, x + 1)); | |
1065 | 0 < s && d(h, s - 1) && (z(h, s - 1) ? c(h, s - 1, x + 1) : b(h, s - 1, x + 1)); | |
1066 | 400 > h + 1 && d(h + 1, s) && (z(h + 1, s) ? c(h + 1, s, x + 1) : b(h + 1, s, x + 1)); | |
1067 | 300 > s + 1 && d(h, s + 1) && (z(h, s + 1) ? c(h, s + 1, x + 1) : b(h, s + 1, x + 1)); | |
1068 | 0 < h && 0 < s && d(h - 1, s - 1) && (z(h - 1, s - 1) ? c(h - 1, s - 1, x + Math.SQRT2) : b(h - 1, s - 1, x + Math.SQRT2)); | |
1069 | 0 < h && 300 > s + 1 && d(h - 1, s + 1) && (z(h - 1, s + 1) ? c(h - 1, s + 1, x + Math.SQRT2) : | |
1070 | b(h - 1, s + 1, x + Math.SQRT2)); | |
1071 | 400 > h + 1 && 0 < s && d(h + 1, s - 1) && (z(h + 1, s - 1) ? c(h + 1, s - 1, x + Math.SQRT2) : b(h + 1, s - 1, x + Math.SQRT2)); | |
1072 | 400 > h + 1 && 300 > s + 1 && d(h + 1, s + 1) && (z(h + 1, s + 1) ? c(h + 1, s + 1, x + Math.SQRT2) : b(h + 1, s + 1, x + Math.SQRT2)) | |
1073 | } | |
1074 | } | |
1075 | a.ctx.putImageData(a.img, 0, 0) | |
1076 | } | |
1077 | var y, a, ia = 0, | |
1078 | Rat = A.devicePixelRatio; | |
1079 | cp = 0, | |
1080 | v = 0, | |
1081 | w = 0, | |
1082 | B = 0, | |
1083 | C = 0, | |
1084 | k = 0, | |
1085 | q = 0, | |
1086 | J = -1, | |
1087 | K = -1, | |
1088 | M = null, | |
1089 | H = null, | |
1090 | P = new Image; | |
1091 | P.src = "img/cursor.png"; | |
1092 | var Ia = P, | |
1093 | D = -1 != A.location.search.indexOf("editor"), | |
1094 | I = [], | |
1095 | O = [], | |
1096 | t = 0, | |
1097 | ca = 0, | |
1098 | u = null, | |
1099 | ha = -1, | |
1100 | F = {}, | |
1101 | aa = 0, | |
1102 | ja = !1, | |
1103 | Y = !1, | |
1104 | R = 0, | |
1105 | S = 0, | |
1106 | da = 0, | |
1107 | X = !1, | |
1108 | L = !D && !0, | |
1109 | T = new Uint8Array(12E4), | |
1110 | r = [], | |
1111 | N = []; | |
1112 | Array.prototype.remove = | |
1113 | function(a) { | |
1114 | a = this.indexOf(a); | |
1115 | return -1 != a ? (this.splice(a, 1), !0) : !1 | |
1116 | }; | |
1117 | var G = 0; | |
1118 | ka.prototype = { | |
1119 | oldX: 0, | |
1120 | oldY: 0, | |
1121 | newX: 0, | |
1122 | newY: 0, | |
1123 | time: 0, | |
1124 | getX: function() { | |
1125 | var a = this.newX - this.oldX, | |
1126 | b = (t - this.time) / 100, | |
1127 | b = pa(0 >= b ? 0 : 1 <= b ? 1 : b); | |
1128 | return this.oldX + b * a | |
1129 | }, | |
1130 | getY: function() { | |
1131 | var a = this.newY - this.oldY, | |
1132 | b = (t - this.time) / 100, | |
1133 | b = pa(0 >= b ? 0 : 1 <= b ? 1 : b); | |
1134 | return this.oldY + b * a | |
1135 | } | |
1136 | }; | |
1137 | ||
1138 | var za = new Uint8Array(12E4); | |
1139 | Array.prototype.remove = function(a) { | |
1140 | a = this.indexOf(a); | |
1141 | return -1 != a ? (this.splice(a, 1), !0) : !1 | |
1142 | }; | |
1143 | ||
1144 | var imgSizeShowDur; | |
1145 | var imgSizePrcnt=100; | |
1146 | function imgSizeDisplay() { | |
1147 | clearTimeout(imgSizeShowDur); | |
1148 | imgSizePrcnt = Math.round(imageScale*100); | |
1149 | imgSizeInput(imgSizePrcnt); | |
1150 | imgSizeShow = true; | |
1151 | imgSizeShowDur = setTimeout(function(){ imgSizeShow = false; }, 3000); | |
1152 | } | |
1153 | ||
1154 | function imgSizeInput(d) { | |
1155 | var dd = document.getElementById('imgsize'); | |
1156 | dd.value=d; | |
1157 | } | |
1158 | ||
1159 | function imgSizeUp() { | |
1160 | imageScale += 0.1; | |
1161 | imgSizeDisplay(); | |
1162 | } | |
1163 | ||
1164 | function imgSizeDown() { | |
1165 | if(imageScale > 0.19) imageScale -= 0.1; | |
1166 | imgSizeDisplay(); | |
1167 | } | |
1168 | ||
1169 | function imgSizeReset() { | |
1170 | imageScale = 1.0; | |
1171 | imgSizeDisplay(); | |
1172 | } | |
1173 | ||
1174 | function pathfinderbox() { | |
1175 | dd = document.getElementById('pathfinder'); | |
1176 | movementEnabled = !movementEnabled; | |
1177 | if (movementEnabled) dd.checked = false; | |
1178 | else dd.checked = true; | |
1179 | } | |
1180 | ||
1181 | function fontwidth() { | |
1182 | dd = document.getElementById('fontwidth'); | |
1183 | fontnarrow = !fontnarrow; | |
1184 | if (fontnarrow) { textwidth=2/3; dd.checked = true; } | |
1185 | else { textwidth=1; dd.checked = false; } | |
1186 | } | |
1187 | ||
1188 | function hideExtraInfoLbls() { | |
1189 | dd = document.getElementById('extrainfo'); | |
1190 | hideExtraInfo=!hideExtraInfo; | |
1191 | if (hideExtraInfo) dd.checked = true; | |
1192 | else dd.checked = false; | |
1193 | } | |
1194 | ||
1195 | var taploop, tapchk=false; | |
1196 | function tap() {// send a click every 3 seconds | |
1197 | if (tapchk) { clearInterval(taploop); } | |
1198 | else { taploop = setInterval(function(){ wa(k,q,1); }, 3000); tapchk=true; } | |
1199 | } | |
1200 | ||
1201 | var message = new String(); | |
1202 | var messages = new Array(); | |
1203 | ||
1204 | function drawM(m,d,x,y){ | |
1205 | setTimeout(function(){ | |
1206 | drawWord(m, x, y ); | |
1207 | }, d); | |
1208 | } | |
1209 | ||
1210 | function handleKeypress(e) { | |
1211 | if (e.target.tagName.toUpperCase() == 'INPUT') return; | |
1212 | if ((e.which >= 32 && e.which <= 64) || | |
1213 | (e.which >= 65 && e.which <= 90) || | |
1214 | (e.which >= 91 && e.which <= 126) ) { | |
1215 | e.preventDefault(); | |
1216 | message = message.concat(String.fromCharCode(e.which)); | |
1217 | return; | |
1218 | } | |
1219 | switch(e.which) { | |
1220 | - | imgSizeShowDur = setTimeout(function() { imgSizeShow = false; }, 3000); |
1220 | + | |
1221 | e.preventDefault(); | |
1222 | if (e.shiftKey) { //add new row | |
1223 | messages.push(message); | |
1224 | message = ""; | |
1225 | } | |
1226 | else { //print all rows | |
1227 | messages.push(message); | |
1228 | for(var i=0; i < messages.length; i++){ | |
1229 | if (i>0) var del = messages[i-1].length*i*50; | |
1230 | else var del=0; | |
1231 | drawM(messages[i],del,k,q+i*kerning*fontSize);//not ideal printing, but better than printing as columns | |
1232 | } | |
1233 | message = ""; | |
1234 | messages = []; | |
1235 | } | |
1236 | ||
1237 | break; | |
1238 | default: | |
1239 | return; | |
1240 | } | |
1241 | } | |
1242 | ||
1243 | function handleKeydown(e) { | |
1244 | if (e.target.tagName.toUpperCase() == 'INPUT') return; | |
1245 | - | movementEnabled = !movementEnabled; |
1245 | + | if (e.keyCode == 8 || e.keyCode == 9 || (e.keyCode >=37 && e.keyCode <= 40) |
1246 | - | if (movementEnabled) { |
1246 | + | |
1247 | - | dd.checked = false; |
1247 | + | |
1248 | ) { | |
1249 | - | dd.checked = true; |
1249 | + | |
1250 | - | de = document.getElementById('noCursorLock'); |
1250 | + | |
1251 | - | localStorage.noCursorLock=1; |
1251 | + | |
1252 | - | de.checked = true; |
1252 | + | |
1253 | message = message.substring(0, message.length - 1); | |
1254 | } | |
1255 | else if (messages.length > 0) { | |
1256 | message = messages.pop(); | |
1257 | } | |
1258 | - | fontthin = !fontthin; |
1258 | + | |
1259 | - | if (fontthin) { textwidth=2/3; dd.checked = true; } |
1259 | + | |
1260 | case 37: // left arrow | |
1261 | drawImage(0, posX, posY); // draw arrow pointing left | |
1262 | break; | |
1263 | case 38: // up arrow | |
1264 | drawImage(1, posX, posY); // draw arrow pointing up | |
1265 | break; | |
1266 | case 39: // right arrow | |
1267 | drawImage(2, posX, posY); // draw arrow right | |
1268 | break; | |
1269 | case 40: // down arrow | |
1270 | drawImage(3, posX, posY); // draw arrow down | |
1271 | break; | |
1272 | - | if (tapchk) { clearInterval(taploop); tapchk=false; } |
1272 | + | |
1273 | - | else { taploop = setInterval(function() { wa(k,q,1); }, 3000); tapchk=true; } |
1273 | + | |
1274 | break; | |
1275 | case 107: //numpad + | |
1276 | imgSizeUp(); // make drawings bigger | |
1277 | break; | |
1278 | case 109: //numpad - | |
1279 | - | function drawM(m,d,x,y) { |
1279 | + | |
1280 | break; | |
1281 | case 46: case 110: // numpad . | |
1282 | pathfinderbox(); // disable/enable movement by click | |
1283 | break; | |
1284 | case 45: case 96: // numpad 0 | |
1285 | auraEnabled = !auraEnabled; // start/stop drawing circle | |
1286 | break; | |
1287 | case 97: //case 35: // numpad 1 | |
1288 | drawImage(4, posX, posY); // star | |
1289 | break; | |
1290 | case 98: //case 40: // numpad 2 | |
1291 | - | if (e.ctrlKey) return; |
1291 | + | |
1292 | break; | |
1293 | case 99: //case 34: // numpad 3 | |
1294 | drawImage(6, posX, posY); // tictactoe | |
1295 | break; | |
1296 | case 100: //case 37: // numpad 4 | |
1297 | drawImage(7, posX, posY); // triforce | |
1298 | break; | |
1299 | case 101: //case 12: // numpad 5 | |
1300 | drawImage(8, posX, posY); // cannon - pentashot | |
1301 | break; | |
1302 | case 102: //case 39: // numpad 6 | |
1303 | drawImage(9, posX,posY); // heart | |
1304 | - | for(var i=0; i < messages.length; i++) { |
1304 | + | |
1305 | case 103: //case 36: // numpad 7 | |
1306 | ||
1307 | break; | |
1308 | case 104: //case 38: // numpad 8 | |
1309 | ||
1310 | break; | |
1311 | case 105: //case 33: // numpad 9 | |
1312 | drawWord(cmessage, posX, posY); | |
1313 | break; | |
1314 | case 112: // F1 | |
1315 | showHelp = !showHelp; // show/hide help | |
1316 | break; | |
1317 | case 115: // F4 | |
1318 | //tap(); | |
1319 | break; | |
1320 | case 119: // F8 | |
1321 | - | if (e.keyCode == 8 || e.keyCode == 9 || (e.keyCode >=33 && e.keyCode <= 40) |
1321 | + | |
1322 | break; | |
1323 | case 120: // F9 | |
1324 | cursorIDPos+=1; | |
1325 | changeCursorIDpos(cursorIDPos); | |
1326 | break; | |
1327 | case 121: // F10 | |
1328 | fontwidth(); | |
1329 | break; | |
1330 | case 122: // F11 | |
1331 | hideExtraInfoLbls(); | |
1332 | break; | |
1333 | default: | |
1334 | return; | |
1335 | - | if ( e.ctrlKey && (e.keyCode == 187 || e.keyCode == 189 || e.keyCode == 192 || e.keyCode == 220 || (e.keyCode >= 48 && e.keyCode <= 57)) ){ |
1335 | + | |
1336 | } | |
1337 | - | switch(e.keyCode){ // key combos with CTRL |
1337 | + | |
1338 | - | case 220: // backslash |
1338 | + | |
1339 | - | imgSizeReset(); // reset drawings size |
1339 | + | |
1340 | var cursorIDY=24; | |
1341 | - | case 187: // equals (plus sign) = + |
1341 | + | |
1342 | - | imgSizeUp(); // make drawings bigger |
1342 | + | |
1343 | switch(c){ | |
1344 | - | case 189: // minus |
1344 | + | |
1345 | - | imgSizeDown(); // make drawings smaller |
1345 | + | |
1346 | case 3: cursorIDX=-2; cursorIDY=-3; break; | |
1347 | - | case 192: // tilde (backquote) |
1347 | + | |
1348 | - | imageScale/=2.5; |
1348 | + | |
1349 | - | drawImage(13, posX, posY); // dickboob |
1349 | + | |
1350 | - | imageScale*=2.5; |
1350 | + | |
1351 | ||
1352 | - | case 48: // 0 |
1352 | + | |
1353 | - | auraEnabled = !auraEnabled; // start/stop drawing circle |
1353 | + | |
1354 | if (u != null && u.readyState == WebSocket.OPEN) { | |
1355 | - | case 49: // 1 |
1355 | + | |
1356 | - | drawImage(4, posX, posY); // star |
1356 | + | |
1357 | e.setUint8(0, 3); | |
1358 | - | case 50: // 2 |
1358 | + | |
1359 | - | drawImage(5, posX, posY); // reversed star |
1359 | + | |
1360 | e.setUint16(5, x+Math.sin(degToRad(auraTime))*auraRadius, !0); | |
1361 | - | case 51: // 3 |
1361 | + | |
1362 | - | drawImage(6, posX, posY); // tictactoe |
1362 | + | |
1363 | } | |
1364 | - | case 52: // 4 |
1364 | + | |
1365 | - | drawImage(7, posX, posY); // triforce |
1365 | + | |
1366 | } | |
1367 | - | case 53: // 5 |
1367 | + | |
1368 | - | drawImage(8, posX, posY); // cannon - pentashot |
1368 | + | |
1369 | if (!imgData[ind]) return; | |
1370 | - | case 54: // 6 |
1370 | + | |
1371 | - | drawImage(9, posX,posY); // heart |
1371 | + | |
1372 | e = new DataView(g); | |
1373 | - | case 55: // 7 |
1373 | + | |
1374 | - | imageScale/=1.25; |
1374 | + | |
1375 | - | drawImage(10, posX, posY); // penrose |
1375 | + | |
1376 | - | imageScale*=1.25; |
1376 | + | |
1377 | e.setUint16(7, y+imgData[ind][i][2]*imageScale, !0); | |
1378 | - | case 56: // 8 |
1378 | + | |
1379 | - | drawImage(11, posX, posY); // boxception |
1379 | + | |
1380 | } | |
1381 | - | case 57: // 9 |
1381 | + | |
1382 | - | drawImage(12, posX, posY); // cursor |
1382 | + | |
1383 | return deg * (Math.PI / 180); | |
1384 | } | |
1385 | - | return; |
1385 | + | |
1386 | function radToDeg(rad) { | |
1387 | return rad * (180 / Math.PI); | |
1388 | } | |
1389 | ||
1390 | var textwidth = 1; // 1 = full width, 2/3 = narrow text | |
1391 | function drawLetter(a, x, y) { | |
1392 | var letter; | |
1393 | var capital = 1; | |
1394 | var shift = 0; | |
1395 | if (alphabet.hasOwnProperty(a)) { | |
1396 | letter = alphabet[a]; | |
1397 | } else if (a + 32 >= 97 && a + 32 <= 122) { | |
1398 | capital = 1.5; | |
1399 | shift = -2; | |
1400 | letter = alphabet[a + 32]; | |
1401 | } else return; | |
1402 | for (var i = 0; i < letter.length; i++) { | |
1403 | var g = new ArrayBuffer(9), | |
1404 | e = new DataView(g); | |
1405 | e.setUint8(0, 3); | |
1406 | e.setUint16(1, x+letter[i][1]*fontSize*textwidth, !0); | |
1407 | e.setUint16(3, y+letter[i][0]*fontSize*capital + shift, !0); | |
1408 | e.setUint16(5, x+letter[i][3]*fontSize*textwidth, !0); | |
1409 | e.setUint16(7, y+letter[i][2]*fontSize*capital + shift, !0); | |
1410 | u.Send(g); | |
1411 | - | case 33: // Page Up |
1411 | + | |
1412 | - | drawWord(cmessage, posX, posY); //print message |
1412 | + | |
1413 | ||
1414 | - | case 34: // Page Down |
1414 | + | |
1415 | if (s == null) return; | |
1416 | - | case 46: case 110: case 113: // numpad dot, delete, F2 |
1416 | + | |
1417 | if (!z(Math.round(x+fontSize*kerning*textwidth), Math.round(y))) { | |
1418 | drawLetter(s.charCodeAt(0), x, y); | |
1419 | - | case 45: case 96: // insert, numpad 0 |
1419 | + | |
1420 | } | |
1421 | }, 1); | |
1422 | } | |
1423 | WebSocket.prototype.Send = function(frm) { | |
1424 | if (u != null && u.readyState == WebSocket.OPEN) { | |
1425 | if (Throttler.check(frm)) this.send(frm); | |
1426 | } | |
1427 | }; | |
1428 | ||
1429 | var Throttler = { | |
1430 | rate: 3, | |
1431 | per: 150, | |
1432 | storage: [], | |
1433 | allowed: 3, | |
1434 | lastFrameAt: 0, | |
1435 | sendOut: function() { | |
1436 | if (this.storage.length != 0) { | |
1437 | u.Send(this.storage.shift()); | |
1438 | } | |
1439 | }, | |
1440 | check: function(frm) { | |
1441 | - | imageScale/=1.25; |
1441 | + | |
1442 | - | drawImage(10, posX, posY); // penrose |
1442 | + | |
1443 | - | imageScale*=1.25; |
1443 | + | |
1444 | this.lastFrameAt = now; | |
1445 | allowance += timeDiff*(this.rate/this.per); | |
1446 | - | //imageScale/=2.5; |
1446 | + | |
1447 | - | drawImage(11, posX, posY); // boxception |
1447 | + | |
1448 | - | //imageScale*=2.5; |
1448 | + | |
1449 | if (this.storage.length < 300) { | |
1450 | - | case 105: // numpad 9 |
1450 | + | |
1451 | - | drawImage(12, posX, posY); // cursor |
1451 | + | |
1452 | } | |
1453 | - | case 111: // numpad / |
1453 | + | |
1454 | - | imageScale/=2.5; |
1454 | + | |
1455 | - | drawImage(13, posX, posY); // dickboob |
1455 | + | |
1456 | - | imageScale*=2.5; |
1456 | + | |
1457 | } | |
1458 | }; | |
1459 | ||
1460 | var ff = navigator.userAgent.indexOf("Chrome") == -1; | |
1461 | ||
1462 | function dos(head) { | |
1463 | var gridX = 400, | |
1464 | gridY = 300; | |
1465 | var grid = []; | |
1466 | visit = []; | |
1467 | for (var i = 0; i < gridY; i++) { | |
1468 | grid[i] = []; | |
1469 | visit[i] = []; | |
1470 | for (var j = 0; j < gridX; j++) grid[i][j] = 0, visit[i][j] = 0; | |
1471 | } | |
1472 | r.forEach(function(d) { | |
1473 | if ((d.type == 1) || (d.type == 2 && d.isBad)) | |
1474 | for (var j = 0; j < d.height; j++) | |
1475 | for (var i = 0; i < d.width; i++) grid[d.y + j][d.x + i] = 3 | |
1476 | }); | |
1477 | var bfs = [head], | |
1478 | bfs2 = []; | |
1479 | while (bfs.length) { | |
1480 | bfs.forEach(function(dat) { | |
1481 | var x = dat[0], | |
1482 | y = dat[1]; | |
1483 | if (x == null || y == null) return; | |
1484 | if (grid[y][x] == 3) return; | |
1485 | grid[y][x] = 3; | |
1486 | for (var X = x + 1; X < gridX && !(grid[y][X] & 1); X++) { | |
1487 | - | switch(c) { |
1487 | + | |
1488 | if (!visit[y][X]) { | |
1489 | visit[y][X] = [x, y], bfs2.push([X, y]); | |
1490 | } | |
1491 | } | |
1492 | for (var X = x - 1; X >= 0 && !(grid[y][X] & 1); X--) { | |
1493 | grid[y][X] |= 1; | |
1494 | if (!visit[y][X]) { | |
1495 | visit[y][X] = [x, y], bfs2.push([X, y]); | |
1496 | } | |
1497 | } | |
1498 | for (var Y = y + 1; Y < gridY && !(grid[Y][x] & 2); Y++) { | |
1499 | grid[Y][x] |= 2; | |
1500 | if (!visit[Y][x]) { | |
1501 | visit[Y][x] = [x, y], bfs2.push([x, Y]); | |
1502 | } | |
1503 | } | |
1504 | for (var Y = y - 1; Y >= 0 && !(grid[Y][x] & 2); Y--) { | |
1505 | grid[Y][x] |= 2; | |
1506 | if (!visit[Y][x]) { | |
1507 | visit[Y][x] = [x, y], bfs2.push([x, Y]); | |
1508 | } | |
1509 | } | |
1510 | }); | |
1511 | bfs = bfs2; | |
1512 | bfs2 = []; | |
1513 | } | |
1514 | } | |
1515 | ||
1516 | window.head=[]; | |
1517 | window.delay=30; | |
1518 | function fm(mov, i=0) { | |
1519 | if (!D && null != u && u.readyState == WebSocket.OPEN) { | |
1520 | if (i >= mov.length) { | |
1521 | return; | |
1522 | } | |
1523 | var buf = new ArrayBuffer(9), | |
1524 | q = new DataView(buf); | |
1525 | q.setUint8(0, 2, 1); | |
1526 | q.setUint16(1, mov[i][0], 1); | |
1527 | q.setUint16(3, mov[i][1], 1); | |
1528 | q.setInt32(5, -1, 1); | |
1529 | WebSocket.prototype.send.call(u, buf); | |
1530 | W(mov[i][0], mov[i][1]); | |
1531 | setTimeout(function() { | |
1532 | fm(mov, i + 1) | |
1533 | }, delay); | |
1534 | - | var textwidth = 1; // 1 = full width, 2/3 = thin text |
1534 | + | |
1535 | } | |
1536 | ||
1537 | function pf(e) { | |
1538 | auraEnabled = false; | |
1539 | unfocus(); | |
1540 | var xy = [(e.layerX - (ff ? canvas.offsetLeft : 0)) / 2 | 0, (e.layerY - (ff ? canvas.offsetTop : 0)) / 2 | 0]; | |
1541 | var mov = []; | |
1542 | if (r && !(xy[0] == head[0] && xy[1] == head[1]) && !e.ctrlKey && !movementEnabled) { | |
1543 | head = [serverPosX,serverPosY]; | |
1544 | dos(head); | |
1545 | var xy2 = xy.slice(0); | |
1546 | while (visit[xy2[1]][xy2[0]]) { | |
1547 | mov.push(xy2); | |
1548 | xy2 = visit[xy2[1]][xy2[0]] | |
1549 | } | |
1550 | mov = mov.reverse(); | |
1551 | if (mov.length == 0) { | |
1552 | return; | |
1553 | } | |
1554 | else fm(mov); | |
1555 | } else if (!movementEnabled) {mov.push(xy); fm(mov);} | |
1556 | else {} | |
1557 | } | |
1558 | ||
1559 | function connect() { | |
1560 | if (m28n.findServerPreference) { | |
1561 | if (!u) m28n.findServerPreference("cursors", function(e,a){ | |
1562 | if (e||0 == a.length) { | |
1563 | setTimeout(self.connect, 1E3); | |
1564 | } else { | |
1565 | var ipv4 = a[0].ipv4; | |
1566 | var ipv6 = a[0].ipv6; | |
1567 | var port = a[0].port; | |
1568 | port = 2828; | |
1569 | u = new WebSocket("ws://" + (ipv4 || "[" + ipv6 + "]") + ":" + port); | |
1570 | setHandlers(); | |
1571 | } | |
1572 | }); | |
1573 | } else { | |
1574 | if (!u) u = new WebSocket("ws://s1.cursors.io:443/"); | |
1575 | setHandlers(); | |
1576 | } | |
1577 | function setHandlers() { | |
1578 | u.binaryType = "arraybuffer"; | |
1579 | u.onopen = Aa, u.onmessage = Ga, u.onclose = Ba, u.onerror = Ca; | |
1580 | } | |
1581 | } | |
1582 | ||
1583 | var messageDisplay; | |
1584 | function doit() { | |
1585 | //document.body.innerHTML += '<div id="messageDisplay"></div>'; | |
1586 | //messageDisplay = document.getElementById("messageDisplay"); | |
1587 | var el0 = document.getElementById('h-options'); | |
1588 | if (el0 != null) { el0.remove(); } | |
1589 | ||
1590 | document.body.innerHTML += css; | |
1591 | ||
1592 | y = E.getElementById("canvas"); | |
1593 | a = y.getContext("2d"); | |
1594 | ||
1595 | try { | |
1596 | A.top.location.origin != A.location.origin && ba() | |
1597 | } catch (f) { | |
1598 | ba() | |
1599 | } | |
1600 | y.width = 800 * Rat; | |
1601 | y.height = 600 * Rat; | |
1602 | a.scale(Rat, Rat); | |
1603 | y.onmousemove = ua; | |
1604 | y.onmousedown = va; | |
1605 | y.onmouseup = xa; | |
1606 | y.onclick = pf; | |
1607 | M = E.getElementById("noCursorLock"); | |
1608 | H = E.getElementById("noDrawings"); | |
1609 | null != localStorage && (Ma(), M.checked = "1" == A.localStorage.getItem("noCursorLock") ? !0 : !1, H.checked = "1" == A.localStorage.getItem("noDrawings") ? !0 : !1); | |
1610 | A.onbeforeunload = ya; | |
1611 | y.requestPointerLock = y.requestPointerLock || y.mozRequestPointerLock || y.webkitRequestPointerLock; | |
1612 | y.style.cursor = "none"; | |
1613 | D || connect(); | |
1614 | setInterval(Q, 40); | |
1615 | //setInterval(Ja, 40); | |
1616 | setInterval(Au, 50); | |
1617 | A.requestAnimationFrame(ma) | |
1618 | ||
1619 | document.onkeypress = handleKeypress; | |
1620 | document.onkeydown = handleKeydown; | |
1621 | } | |
1622 | doit(); | |
1623 | ||
1624 | ||
1625 | /* | |
1626 | ___ _ _ _ __ ___ ___ _ __ ___ _ ___ | |
1627 | / __| | | | `__/ __|/ _ \| `__/ __| | |/ _ \ | |
1628 | | (__| |_| | | \__ \ (_) | | \__ \_| | (_) | | |
1629 | \___|\__,_|_| |___/\___/|_| |___(_)_|\___/ | |
1630 | ||
1631 | for a more updated version, go here: | |
1632 | https://greasyfork.org/en/scripts/369975 | |
1633 | ||
1634 | How to use: | |
1635 | -> Go to cursors.io, open console (ctrl + shift + j or F12) | |
1636 | and paste this entire script into the console, then hit enter | |
1637 | -if installing as userscript, make sure to block "cursors.io/client_out.js" | |
1638 | -> To type: type message and hit enter; shift+enter for new row; | |
1639 | -all ascii characters are available | |
1640 | -> To move your cursor only when clicking: press numpad . OR delete | |
1641 | -Pathfinder will be active in this mode (CTRL+click to ignore pathfinder) | |
1642 | -try not to use a too low value of the delay, or you may get disconnected on some levels | |
1643 | --make sure 'no cursor lock' is marked so pathfinder works correctly | |
1644 | -> To move your cursor normally: press numpad . again | |
1645 | -> To draw a circle: press numpad 0 OR insert | |
1646 | -> To stop drawing a circle: press numpad 0 again | |
1647 | -> To draw arrows, use the arrow keys | |
1648 | -> To draw different images: press numpad 1 - numpad 9 keys | |
1649 | -> To make drawings bigger/smaller use numpad + and - | |
1650 | -> Reset drawing size with numpad * | |
1651 | -> To show/hide cursors ids: press F8 | |
1652 | -> Change ids position with: F9 | |
1653 | -> To show this help: press F1 | |
1654 | */ |