Greasy Fork 还支持 简体中文。

cursors.io hack --working-- (2019)

cursorsio hack - drawing, texting, player ids, & more

目前為 2019-08-30 提交的版本,檢視 最新版本

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