Miracle Scripts

This script is no longer maintaned.

当前为 2020-03-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Miracle Scripts
  3. // @namespace Miracle Scripts
  4. // @version 3.1.0
  5. // @description This script is no longer maintaned.
  6. // @author Samira
  7. // @license MIT
  8. // @icon https://abload.de/img/mh3k8o.png
  9. // @match *://agma.io/
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. window.miracleScripts = {
  17.  
  18. // Source: http://stackoverflow.com/questions/1772179/get-character-value-from-keycode-in-javascript-then-trim#answer-23377822
  19. keyboardMap: [
  20. '', // [0]
  21. '', // [1]
  22. '', // [2]
  23. 'CANCEL', // [3]
  24. '', // [4]
  25. '', // [5]
  26. 'HELP', // [6]
  27. '', // [7]
  28. 'BACK_SPACE', // [8]
  29. 'TAB', // [9]
  30. '', // [10]
  31. '', // [11]
  32. 'CLEAR', // [12]
  33. 'ENTER', // [13]
  34. 'ENTER_SPECIAL', // [14]
  35. '', // [15]
  36. 'SHIFT', // [16]
  37. 'CONTROL', // [17]
  38. 'ALT', // [18]
  39. 'PAUSE', // [19]
  40. 'CAPS_LOCK', // [20]
  41. 'KANA', // [21]
  42. 'EISU', // [22]
  43. 'JUNJA', // [23]
  44. 'FINAL', // [24]
  45. 'HANJA', // [25]
  46. '', // [26]
  47. 'ESCAPE', // [27]
  48. 'CONVERT', // [28]
  49. 'NONCONVERT', // [29]
  50. 'ACCEPT', // [30]
  51. 'MODECHANGE', // [31]
  52. 'SPACE', // [32]
  53. 'PAGE_UP', // [33]
  54. 'PAGE_DOWN', // [34]
  55. 'END', // [35]
  56. 'HOME', // [36]
  57. 'LEFT', // [37]
  58. 'UP', // [38]
  59. 'RIGHT', // [39]
  60. 'DOWN', // [40]
  61. 'SELECT', // [41]
  62. 'PRINT', // [42]
  63. 'EXECUTE', // [43]
  64. 'PRINTSCREEN', // [44]
  65. 'INSERT', // [45]
  66. 'DELETE', // [46]
  67. '', // [47]
  68. '0', // [48]
  69. '1', // [49]
  70. '2', // [50]
  71. '3', // [51]
  72. '4', // [52]
  73. '5', // [53]
  74. '6', // [54]
  75. '7', // [55]
  76. '8', // [56]
  77. '9', // [57]
  78. 'COLON', // [58]
  79. 'SEMICOLON', // [59]
  80. 'LESS_THAN', // [60]
  81. 'EQUALS', // [61]
  82. 'GREATER_THAN', // [62]
  83. 'QUESTION_MARK', // [63]
  84. 'AT', // [64]
  85. 'A', // [65]
  86. 'B', // [66]
  87. 'C', // [67]
  88. 'D', // [68]
  89. 'E', // [69]
  90. 'F', // [70]
  91. 'G', // [71]
  92. 'H', // [72]
  93. 'I', // [73]
  94. 'J', // [74]
  95. 'K', // [75]
  96. 'L', // [76]
  97. 'M', // [77]
  98. 'N', // [78]
  99. 'O', // [79]
  100. 'P', // [80]
  101. 'Q', // [81]
  102. 'R', // [82]
  103. 'S', // [83]
  104. 'T', // [84]
  105. 'U', // [85]
  106. 'V', // [86]
  107. 'W', // [87]
  108. 'X', // [88]
  109. 'Y', // [89]
  110. 'Z', // [90]
  111. 'OS_KEY', // [91] Windows Key (Windows) or Command Key (Mac)
  112. '', // [92]
  113. 'CONTEXT_MENU', // [93]
  114. '', // [94]
  115. 'SLEEP', // [95]
  116. 'NUMPAD0', // [96]
  117. 'NUMPAD1', // [97]
  118. 'NUMPAD2', // [98]
  119. 'NUMPAD3', // [99]
  120. 'NUMPAD4', // [100]
  121. 'NUMPAD5', // [101]
  122. 'NUMPAD6', // [102]
  123. 'NUMPAD7', // [103]
  124. 'NUMPAD8', // [104]
  125. 'NUMPAD9', // [105]
  126. 'MULTIPLY', // [106]
  127. 'ADD', // [107]
  128. 'SEPARATOR', // [108]
  129. 'SUBTRACT', // [109]
  130. 'DECIMAL', // [110]
  131. 'DIVIDE', // [111]
  132. 'F1', // [112]
  133. 'F2', // [113]
  134. 'F3', // [114]
  135. 'F4', // [115]
  136. 'F5', // [116]
  137. 'F6', // [117]
  138. 'F7', // [118]
  139. 'F8', // [119]
  140. 'F9', // [120]
  141. 'F10', // [121]
  142. 'F11', // [122]
  143. 'F12', // [123]
  144. 'F13', // [124]
  145. 'F14', // [125]
  146. 'F15', // [126]
  147. 'F16', // [127]
  148. 'F17', // [128]
  149. 'F18', // [129]
  150. 'F19', // [130]
  151. 'F20', // [131]
  152. 'F21', // [132]
  153. 'F22', // [133]
  154. 'F23', // [134]
  155. 'F24', // [135]
  156. '', // [136]
  157. '', // [137]
  158. '', // [138]
  159. '', // [139]
  160. '', // [140]
  161. '', // [141]
  162. '', // [142]
  163. '', // [143]
  164. 'NUM_LOCK', // [144]
  165. 'SCROLL_LOCK', // [145]
  166. 'WIN_OEM_FJ_JISHO', // [146]
  167. 'WIN_OEM_FJ_MASSHOU', // [147]
  168. 'WIN_OEM_FJ_TOUROKU', // [148]
  169. 'WIN_OEM_FJ_LOYA', // [149]
  170. 'WIN_OEM_FJ_ROYA', // [150]
  171. '', // [151]
  172. '', // [152]
  173. '', // [153]
  174. '', // [154]
  175. '', // [155]
  176. '', // [156]
  177. '', // [157]
  178. '', // [158]
  179. '', // [159]
  180. 'CIRCUMFLEX', // [160]
  181. 'EXCLAMATION', // [161]
  182. 'DOUBLE_QUOTE', // [162]
  183. 'HASH', // [163]
  184. 'DOLLAR', // [164]
  185. 'PERCENT', // [165]
  186. 'AMPERSAND', // [166]
  187. 'UNDERSCORE', // [167]
  188. 'OPEN_PAREN', // [168]
  189. 'CLOSE_PAREN', // [169]
  190. 'ASTERISK', // [170]
  191. 'PLUS', // [171]
  192. 'PIPE', // [172]
  193. 'HYPHEN_MINUS', // [173]
  194. 'OPEN_CURLY_BRACKET', // [174]
  195. 'CLOSE_CURLY_BRACKET', // [175]
  196. 'TILDE', // [176]
  197. '', // [177]
  198. '', // [178]
  199. '', // [179]
  200. '', // [180]
  201. 'VOLUME_MUTE', // [181]
  202. 'VOLUME_DOWN', // [182]
  203. 'VOLUME_UP', // [183]
  204. '', // [184]
  205. '', // [185]
  206. 'SEMICOLON', // [186]
  207. 'EQUALS', // [187]
  208. 'COMMA', // [188]
  209. 'MINUS', // [189]
  210. 'PERIOD', // [190]
  211. 'SLASH', // [191]
  212. 'BACK_QUOTE', // [192]
  213. '', // [193]
  214. '', // [194]
  215. '', // [195]
  216. '', // [196]
  217. '', // [197]
  218. '', // [198]
  219. '', // [199]
  220. '', // [200]
  221. '', // [201]
  222. '', // [202]
  223. '', // [203]
  224. '', // [204]
  225. '', // [205]
  226. '', // [206]
  227. '', // [207]
  228. '', // [208]
  229. '', // [209]
  230. '', // [210]
  231. '', // [211]
  232. '', // [212]
  233. '', // [213]
  234. '', // [214]
  235. '', // [215]
  236. '', // [216]
  237. '', // [217]
  238. '', // [218]
  239. 'OPEN_BRACKET', // [219]
  240. 'BACK_SLASH', // [220]
  241. 'CLOSE_BRACKET', // [221]
  242. 'QUOTE', // [222]
  243. '', // [223]
  244. 'META', // [224]
  245. 'ALTGR', // [225]
  246. '', // [226]
  247. 'WIN_ICO_HELP', // [227]
  248. 'WIN_ICO_00', // [228]
  249. '', // [229]
  250. 'WIN_ICO_CLEAR', // [230]
  251. '', // [231]
  252. '', // [232]
  253. 'WIN_OEM_RESET', // [233]
  254. 'WIN_OEM_JUMP', // [234]
  255. 'WIN_OEM_PA1', // [235]
  256. 'WIN_OEM_PA2', // [236]
  257. 'WIN_OEM_PA3', // [237]
  258. 'WIN_OEM_WSCTRL', // [238]
  259. 'WIN_OEM_CUSEL', // [239]
  260. 'WIN_OEM_ATTN', // [240]
  261. 'WIN_OEM_FINISH', // [241]
  262. 'WIN_OEM_COPY', // [242]
  263. 'WIN_OEM_AUTO', // [243]
  264. 'WIN_OEM_ENLW', // [244]
  265. 'WIN_OEM_BACKTAB', // [245]
  266. 'ATTN', // [246]
  267. 'CRSEL', // [247]
  268. 'EXSEL', // [248]
  269. 'EREOF', // [249]
  270. 'PLAY', // [250]
  271. 'ZOOM', // [251]
  272. '', // [252]
  273. 'PA1', // [253]
  274. 'WIN_OEM_CLEAR', // [254]
  275. '' // [255]
  276. ],
  277.  
  278. watermark: ' ',
  279.  
  280. // Don't remove the spaces, they are used as separators! Source: https://emojiterra.com/de/liste/
  281. emojis: '😀 😃 😄 😁 😆 😅 😂 😉 😊 😇 😍 😘 😗 ☺️ 😚 😙 😋 😛 😜 😝 😐 😑 😶 😏 😒 😬 😌 😔 😪 😴 😷 😵 😎 😕 😟 😮 😯 😲 😳 😦 😧 😨 😰 😥 😢 😭 😱 😖 😣 😞 😓 😩 😫 😤 😡 😠 😈 👿 💀 💩 👹 👺 👻 👽 👾 😺 😸 😹 😻 😼 😽 🙀 😿 😾 🙈 🙉 🙊 💋 💌 💘 💝 💖 💗 💓 💞 💕 💟 💔 ❤️ 💛 💚 💙 💜 💯 💢 💥 💫 💦 💨 💣 💬 💭 💤 👋 ✋ 👌 ✌️ 👈 👉 👆 👇 ☝️ 👍 👎 ✊ 👊 👏 🙌 👐 🙏 💅 💪 👂 👃 👀 👅 👄 👶 👦 👧 👱 👨 👩 👴 👵 🙍 🙎 🙅 🙆 💁 🙋 🙇 👮 💂 👷 👸 👳 👲 👰 👼 🎅 💆 💇 🚶 🏃 💃 👯 🏇 🏂 🏄 🚣 🏊 🚴 🚵 🛀 👭 👫 👬 💏 💑 👪 👤 👥 👣 🐵 🐒 🐶 🐕 🐩 🐺 🐱 🐈 🐯 🐅 🐆 🐴 🐎 🐮 🐂 🐃 🐄 🐷 🐖 🐗 🐽 🐏 🐑 🐐 🐪 🐫 🐘 🐭 🐁 🐀 🐹 🐰 🐇 🐻 🐨 🐼 🐾 🐔 🐓 🐣 🐤 🐥 🐦 🐧 🐸 🐊 🐢 🐍 🐲 🐉 🐳 🐋 🐬 🐟 🐠 🐡 🐙 🐚 🐌 🐛 🐜 🐝 🐞 💐 🌸 💮 🌹 🌺 🌻 🌼 🌷 🌱 🌲 🌳 🌴 🌵 🌾 🌿 🍀 🍁 🍂 🍃 🍇 🍈 🍉 🍊 🍋 🍌 🍍 🍎 🍏 🍐 🍑 🍒 🍓 🍅 🍆 🌽 🍄 🌰 🍞 🍖 🍗 🍔 🍟 🍕 🍳 🍲 🍱 🍘 🍙 🍚 🍛 🍜 🍝 🍠 🍢 🍣 🍤 🍥 🍡 🍦 🍧 🍨 🍩 🍪 🎂 🍰 🍫 🍬 🍭 🍮 🍯 🍼 ☕ 🍵 🍶 🍷 🍸 🍹 🍺 🍻 🍴 🔪 🌍 🌎 🌏 🌐 🗾 🌋 🗻 🏠 🏡 🏢 🏣 🏤 🏥 🏦 🏨 🏩 🏪 🏫 🏬 🏭 🏯 🏰 💒 🗼 🗽 ⛪ ⛲ ⛺ 🌁 🌃 🌄 🌅 🌆 🌇 🌉 ♨️ 🎠 🎡 🎢 💈 🎪 🚂 🚃 🚄 🚅 🚆 🚇 🚈 🚉 🚊 🚝 🚞 🚋 🚌 🚍 🚎 🚐 🚑 🚒 🚓 🚔 🚕 🚖 🚗 🚘 🚙 🚚 🚛 🚜 🚲 🚏 ⛽ 🚨 🚥 🚦 🚧 ⚓ ⛵ 🚤 🚢 ✈️ 💺 🚁 🚟 🚠 🚡 🚀 ⌛ ⏳ ⌚ ⏰ 🕛 🕧 🕐 🕜 🕑 🕝 🕒 🕞 🕓 🕟 🕔 🕠 🕕 🕡 🕖 🕢 🕗 🕣 🕘 🕤 🕙 🕥 🕚 🕦 🌑 🌒 🌓 🌔 🌕 🌖 🌗 🌘 🌙 🌚 🌛 🌜 ☀️ 🌝 🌞 ⭐ 🌟 🌠 🌌 ☁️ ⛅ 🌀 🌈 🌂 ☔ ⚡ ❄️ ⛄ 🔥 💧 🌊 🎃 🎄 🎆 🎇 ✨ 🎈 🎉 🎊 🎋 🎍 🎎 🎏 🎐 🎑 🎀 🎁 🎫 🏆 ⚽ ⚾ 🏀 🏈 🏉 🎾 🎳 ⛳ 🎣 🎽 🎿 🎯 🎱 🔮 🎮 🎰 🎲 ♠️ ♥️ ♦️ ♣️ 🃏 🀄 🎴 🎭 🎨 👓 👔 👕 👖 👗 👘 👙 👚 👛 👜 👝 🎒 👞 👟 👠 👡 👢 👑 👒 🎩 🎓 💄 💍 💎 🔇 🔈 🔉 🔊 📢 📣 📯 🔔 🔕 🎼 🎵 🎶 🎤 🎧 📻 🎷 🎸 🎹 🎺 🎻 📱 📲 ☎️ 📞 📟 📠 🔋 🔌 💻 💽 💾 💿 📀 🎥 🎬 📺 📷 📹 📼 🔍 🔎 💡 🔦 🏮 📔 📕 📖 📗 📘 📙 📚 📓 📒 📃 📜 📄 📰 📑 🔖 💰 💴 💵 💶 💷 💸 💳 💹 💱 💲 ✉️ 📧 📨 📩 📤 📥 📦 📫 📪 📬 📭 📮 ✏️ ✒️ 📝 💼 📁 📂 📅 📆 📇 📈 📉 📊 📋 📌 📍 📎 📏 📐 ✂️ 🔒 🔓 🔏 🔐 🔑 🔨 🔫 🔧 🔩 🔗 🔬 🔭 📡 💉 💊 🚪 🚽 🚿 🛁 🚬 🗿 🏧 🚮 🚰 ♿ 🚹 🚺 🚻 🚼 🚾 🛂 🛃 🛄 🛅 ⚠️ 🚸 ⛔ 🚫 🚳 🚭 🚯 🚱 🚷 📵 🔞 ⬆️ ↗️ ➡️ ↘️ ⬇️ ↙️ ⬅️ ↖️ ↕️ ↔️ 🔃 🔄 🔙 🔚 🔛 🔜 🔝 🔯 ♈ ♉ ♊ ♋ ♌ ♍ ♎ ♏ ♐ ♑ ♒ ♓ ⛎ 🔀 🔁 🔂 ▶️ ◀️ 🔼 🔽 🎦 📶 📳 📴 ♻️ 🔱 📛 🔰 ⭕ ✅ ☑️ ✖️ ❌ ❎ ➕ ➖ ➗ ➰ ➿ 〽️ ✳️ ✴️ ❇️ ‼️ ⁉️ ❓ ❔ ❕ ❗ 〰️ ©️ ®️ ™️ 🔠 🔡 🔢 🔣 🔤 🅰️ 🆎 🅱️ 🆑 🆒 🆓 🆔 Ⓜ️ 🆕 🆖 🅾️ 🆗 🅿️ 🆘 🆙 🆚 🈁 🈂️ 🈷️ 🈶 🈯 🉐 🈹 🈚 🈲 🉑 🈸 🈴 🈳 ㊗️ ㊙️ 🈺 🈵 🔴 🔵 ⚫ ⚪ ⬛ ⬜ ◼️ ◻️ ◾ ◽ ▪️ ▫️ 🔶 🔷 🔸 🔹 🔺 🔻 💠 🔘 🔳 🔲 🏁 🚩 🎌',
  282.  
  283. settings: null,
  284.  
  285. hotkeys: null,
  286.  
  287. init: function() {
  288. this.setupPolyfills();
  289.  
  290. this.hotkeys = JSON.parse(localStorage.getItem('hotkeys'));
  291.  
  292. this.config();
  293.  
  294. this.moveRespawnBtn();
  295. this.players();
  296. this.animation();
  297. this.chatLog();
  298. this.dance();
  299. this.favSkins();
  300. this.paste();
  301. this.replacements();
  302. this.fpsPing();
  303. this.timer();
  304. this.alive();
  305. this.skinChanger();
  306. this.skinApplier();
  307. this.lineSplit();
  308. this.waste();
  309. this.nameColor();
  310. this.help();
  311. this.commands();
  312.  
  313. console.log('🌸 Miracle Scripts successfully loaded!');
  314. },
  315.  
  316. config: function() {
  317. var self = this;
  318. var settings = null;
  319.  
  320. var loadSettings = function (stringifiedSettings) {
  321. var defaultSettings = {
  322. // To get keycodes: https://keycode.info
  323. bindings: {
  324. animation: 17, // CTRL
  325. paste: 33, // PAGE UP
  326. dance: 34, // PAGE DOWN,
  327. chatLog: 76, // L
  328. skin1: 49, // 1
  329. skin2: 50, // 2
  330. skin3: 51, // 3
  331. skin4: 52, // 4
  332. skin5: 53, // 5
  333. skin6: 54, // 6
  334. skin7: 55, // 7
  335. skin8: 56, // 8
  336. skin9: 57, // 9
  337. },
  338. replacements: ":D|:smile:\n:*(|:sob:\n:'D|:sweat_smiley:\nxD|:joy:",
  339. primaryColor: '#f9138b',
  340. targetLanguage: 'en',
  341. favSkins: [],
  342. showClock: false,
  343. };
  344.  
  345. if (stringifiedSettings == null) {
  346. settings = defaultSettings;
  347. localStorage.setItem('miracleScripts', JSON.stringify(self.settings));
  348. } else {
  349. settings = JSON.parse(stringifiedSettings);
  350.  
  351. // Update for settings:
  352. if (typeof settings.primaryColor === 'undefined') {
  353. settings.primaryColor = defaultSettings.primaryColor;
  354. localStorage.setItem('miracleScripts', JSON.stringify(settings));
  355. }
  356. if (typeof settings.bindings.chatLog === 'undefined') {
  357. settings.bindings.chatLog = defaultSettings.bindings.chatLog;
  358. localStorage.setItem('miracleScripts', JSON.stringify(settings));
  359. }
  360. if (typeof settings.favSkins === 'undefined') {
  361. settings.favSkins = defaultSettings.favSkins;
  362. localStorage.setItem('miracleScripts', JSON.stringify(settings));
  363. }
  364. if (typeof settings.targetLanguage === 'undefined') {
  365. settings.targetLanguage = defaultSettings.targetLanguage;
  366. localStorage.setItem('miracleScripts', JSON.stringify(settings));
  367. }
  368. if (typeof settings.quickSkins === 'undefined') {
  369. settings.quickSkins = [];
  370. localStorage.setItem('miracleScripts', JSON.stringify(settings));
  371. }
  372. if (typeof settings.nameChangeDelay === 'undefined') {
  373. settings.nameChangeDelay = 1000;
  374. localStorage.setItem('miracleScripts', JSON.stringify(settings));
  375. }
  376. if (typeof settings.installedVersion === 'undefined') {
  377. settings.installedVersion = 1;
  378. localStorage.setItem('miracleScripts', JSON.stringify(settings));
  379. }
  380. if (typeof settings.players === 'undefined') {
  381. settings.players = [];
  382. localStorage.setItem('miracleScripts', JSON.stringify(settings));
  383. }
  384. if (typeof settings.bindings.skin1 === 'undefined') {
  385. settings.bindings.skin1 = defaultSettings.bindings.skin1;
  386. settings.bindings.skin2 = defaultSettings.bindings.skin2;
  387. settings.bindings.skin3 = defaultSettings.bindings.skin3;
  388. settings.bindings.skin4 = defaultSettings.bindings.skin4;
  389. settings.bindings.skin5 = defaultSettings.bindings.skin6;
  390. settings.bindings.skin6 = defaultSettings.bindings.skin6;
  391. settings.bindings.skin7 = defaultSettings.bindings.skin7;
  392. settings.bindings.skin8 = defaultSettings.bindings.skin8;
  393. settings.bindings.skin9 = defaultSettings.bindings.skin9;
  394. localStorage.setItem('miracleScripts', JSON.stringify(settings));
  395. }
  396. if (typeof settings.showClock === 'undefined') {
  397. settings.showClock = false;
  398. localStorage.setItem('miracleScripts', JSON.stringify(settings));
  399. }
  400. }
  401.  
  402. self.settings = settings;
  403. };
  404. loadSettings(localStorage.getItem('miracleScripts'));
  405.  
  406. if (settings.installedVersion < this.getVersionAsInt()) {
  407. if (settings.installedVersion > 1) { // We do not want to inform new scripts user of past updates
  408. if (settings.installedVersion < this.getVersionAsInt('2.4.3')) {
  409. window.alert('📢 Miracle Scripts Update: \n\n' +
  410. 'As of version 2.4.3 the nickname color change feature has been removed ' +
  411. 'according to an official decision of the Agma team.\n\n' +
  412. 'To avoid trouble for its users Miracle Scripts respects this decision. ' +
  413. 'Therefore Miracle Scripts is a legit extension for Agma and using it is safe.'
  414. );
  415. }
  416. if (settings.installedVersion < this.getVersionAsInt('2.5.6')) {
  417. self.swal(
  418. 'Miracle Scripts Update',
  419. 'You may now use 20 slots for skins (previously: 15). Type <i>/skin16</i> - <i>/skin20</i> in the chat box!');
  420. }
  421. if (settings.installedVersion < this.getVersionAsInt('2.5.8')) {
  422. self.swal(
  423. 'Miracle Scripts Update',
  424. 'New: You may now assign aliases and notes to players. The alias will be displayed in the friends list. To add an alias right click on a player\'s name in the chat or a cell and then click on "Show profile".');
  425. }
  426. if (settings.installedVersion < this.getVersionAsInt('2.6.0')) {
  427. self.swal(
  428. 'Miracle Scripts Update',
  429. 'New: You may now bind keys to skin slots. Per default the keys 1 - 9 are bound to <i>/skin1</i> - <i>/skin9</i>.');
  430. }
  431. if (settings.installedVersion < this.getVersionAsInt('2.6.1')) {
  432. self.swal(
  433. 'Miracle Scripts Update',
  434. 'New: Right click on a cell. Then click on <i>Use Player\'s Wearables</i> to use the same wearables as that player. (Of course you have to own the wearables.)');
  435. }
  436. if (settings.installedVersion < this.getVersionAsInt('2.6.4')) {
  437. self.swal(
  438. 'Miracle Scripts Update',
  439. 'New: Want to see how late it is? Activate the clock in the settings!');
  440. }
  441. if (settings.installedVersion < this.getVersionAsInt('3.0.0')) {
  442. self.swal(
  443. 'Miracle Scripts Update',
  444. '<b>ATTENTION!</b> This script won\'t get any new features! The Agma staff keeps making new restrictions to this script, so there is no point to continue development. With this update, the <i>/say</i> command has been removed, as the Agma staff enforced this.');
  445. }
  446. }
  447.  
  448. settings.installedVersion = this.getVersionAsInt();
  449. localStorage.setItem('miracleScripts', JSON.stringify(settings));
  450. self.settings = settings;
  451. }
  452.  
  453. var applyPrimaryColor = function () {
  454. var primaryColorCss = '.miracle-primary-color-font { color: ' + self.settings.primaryColor + ' !important } .miracle-primary-color-background { background-color: ' + self.settings.primaryColor + ' !important }; ';
  455. $('body').append('<style>' + primaryColorCss + '</style>');
  456. };
  457. applyPrimaryColor();
  458.  
  459. // We need to have a delay, because the menu is not loaded right away
  460. setTimeout(function () {
  461. var $playButton = $('#playBtn');
  462. var $specateButton = $('#spectateBtn');
  463.  
  464. $playButton.get(0).style.width = '40%';
  465. $specateButton.get(0).style.width = '40%';
  466.  
  467. var $settingsButton = $('<button class="spec" style="width: 40px; margin-left: 7px; text-align: center; padding: 10px 0 20px 0" title="Miracle Scripts Settings">📜</button>');
  468. $settingsButton.insertAfter($playButton);
  469.  
  470. var changeKey = function (event) {
  471. var name = this.name.substr(4);
  472. $(this).val(self.keyboardMap[event.keyCode]);
  473. self.settings.bindings[name] = event.keyCode;
  474. localStorage.setItem('miracleScripts', JSON.stringify(self.settings));
  475. };
  476.  
  477. var deleteKey = function () {
  478. var action = $(this).attr('data-action');
  479. $('#miracle-settings input[name=key_' + action + ']').val('undefined');
  480. self.settings.bindings[action] = null;
  481. localStorage.setItem('miracleScripts', JSON.stringify(self.settings));
  482. };
  483.  
  484. // Weird Agma scripting... press enter in the replacements textarea and the chat box gets focused!
  485. // Therefore catch the keydown event (that happens earlier) and insert the linebreak manually,
  486. // focus again (delayed) and go to the end of the text where the linebreak is.
  487. // We can improve this later on...
  488. var addReturn = function (event) {
  489. if (event.keyCode === 13) {
  490. var textarea = this;
  491. $(textarea).text($(this).text() + '\n').focus();
  492. setTimeout(function () {
  493. $(textarea).focus();
  494. textarea.setSelectionRange(textarea.value.length, textarea.value.length);
  495. }, 1);
  496. }
  497. };
  498. var changeReplacements = function () {
  499. self.settings.replacements = $(this).val();
  500. localStorage.setItem('miracleScripts', JSON.stringify(self.settings));
  501. };
  502. var changePrimaryColor = function () {
  503. self.settings.primaryColor = $(this).val();
  504. localStorage.setItem('miracleScripts', JSON.stringify(self.settings));
  505. applyPrimaryColor();
  506. };
  507. var changeTargetLanguage = function () {
  508. self.settings.targetLanguage = $(this).val();
  509. localStorage.setItem('miracleScripts', JSON.stringify(self.settings));
  510. };
  511. var changeClock = function() {
  512. self.settings.showClock = $(this).is(':checked');
  513. localStorage.setItem('miracleScripts', JSON.stringify(self.settings));
  514. }
  515.  
  516. var $modal = $('<div id="miracle-settings" class="miracle-primary-color-font" style="position: fixed; width: 100%; height: 100%; overflow-y: auto; padding: 50px; background-color: rgba(0,0,0,0.95); z-index: 999; display: none"></div>');
  517. $modal.append('<h1>Miracle Scripts Settings</h1>');
  518.  
  519. if (GM_info) {
  520. $modal.append('<small style="color: #717171">Version ' + GM_info.script.version + '</small>');
  521. }
  522.  
  523. var $firstRow = $('<td style="vertical-align: top; padding-right: 19px;">');
  524. var $secRow = $('<td style="vertical-align: top; padding-right: 19px;">');
  525. var $thirdRow = $('<td style="vertical-align: top; padding-right: 19px;">');
  526.  
  527.  
  528. var $element = $('<input name="key_skin1" value="' + self.keyboardMap[self.settings.bindings.skin1] + '"/>').keyup(changeKey);
  529. $firstRow.append('<br><br>Use-First-Skin-Key:<br>', $element);
  530. $element = $('<a href="#" data-action="skin1" class="miracle-primary-color-background" style="display: inline-block; padding: 3px 10px; color: white">✕</a>').click(deleteKey);
  531. $firstRow.append($element);
  532.  
  533. $element = $('<input name="key_skin2" value="' + self.keyboardMap[self.settings.bindings.skin2] + '"/>').keyup(changeKey);
  534. $firstRow.append('<br><br>Use-Second-Skin-Key:<br>', $element);
  535. $element = $('<a href="#" data-action="skin2" class="miracle-primary-color-background" style="display: inline-block; padding: 3px 10px; color: white">✕</a>').click(deleteKey);
  536. $firstRow.append($element);
  537.  
  538. $element = $('<input name="key_skin3" value="' + self.keyboardMap[self.settings.bindings.skin3] + '"/>').keyup(changeKey);
  539. $firstRow.append('<br><br>Use-Third-Skin-Key:<br>', $element);
  540. $element = $('<a href="#" data-action="skin3" class="miracle-primary-color-background" style="display: inline-block; padding: 3px 10px; color: white">✕</a>').click(deleteKey);
  541. $firstRow.append($element);
  542.  
  543. $element = $('<input name="key_skin4" value="' + self.keyboardMap[self.settings.bindings.skin4] + '"/>').keyup(changeKey);
  544. $firstRow.append('<br><br>Use-Fourth-Skin-Key:<br>', $element);
  545. $element = $('<a href="#" data-action="skin4" class="miracle-primary-color-background" style="display: inline-block; padding: 3px 10px; color: white">✕</a>').click(deleteKey);
  546. $firstRow.append($element);
  547.  
  548. $element = $('<input name="key_skin5" value="' + self.keyboardMap[self.settings.bindings.skin5] + '"/>').keyup(changeKey);
  549. $firstRow.append('<br><br>Use-Fifth-Skin-Key:<br>', $element);
  550. $element = $('<a href="#" data-action="skin5" class="miracle-primary-color-background" style="display: inline-block; padding: 3px 10px; color: white">✕</a>').click(deleteKey);
  551. $firstRow.append($element);
  552.  
  553. $element = $('<input name="key_skin6" value="' + self.keyboardMap[self.settings.bindings.skin6] + '"/>').keyup(changeKey);
  554. $secRow.append('<br><br>Use-Sixth-Skin-Key:<br>', $element);
  555. $element = $('<a href="#" data-action="skin6" class="miracle-primary-color-background" style="display: inline-block; padding: 3px 10px; color: white">✕</a>').click(deleteKey);
  556. $secRow.append($element);
  557.  
  558. $element = $('<input name="key_skin7" value="' + self.keyboardMap[self.settings.bindings.skin7] + '"/>').keyup(changeKey);
  559. $secRow.append('<br><br>Use-Seventh-Skin-Key:<br>', $element);
  560. $element = $('<a href="#" data-action="skin7" class="miracle-primary-color-background" style="display: inline-block; padding: 3px 10px; color: white">✕</a>').click(deleteKey);
  561. $secRow.append($element);
  562.  
  563. $element = $('<input name="key_skin8" value="' + self.keyboardMap[self.settings.bindings.skin8] + '"/>').keyup(changeKey);
  564. $secRow.append('<br><br>Use-Eighth-Skin-Key:<br>', $element);
  565. $element = $('<a href="#" data-action="skin8" class="miracle-primary-color-background" style="display: inline-block; padding: 3px 10px; color: white">✕</a>').click(deleteKey);
  566. $secRow.append($element);
  567.  
  568. $element = $('<input name="key_skin9" value="' + self.keyboardMap[self.settings.bindings.skin9] + '"/>').keyup(changeKey);
  569. $secRow.append('<br><br>Use-Ninth-Skin-Key:<br>', $element);
  570. $element = $('<a href="#" data-action="skin9" class="miracle-primary-color-background" style="display: inline-block; padding: 3px 10px; color: white">✕</a>').click(deleteKey);
  571. $secRow.append($element);
  572.  
  573. $element = $('<input name="key_animation" value="' + self.keyboardMap[self.settings.bindings.animation] + '"/>').keyup(changeKey);
  574. $thirdRow.append('<br><br>Animation-Key:<br>', $element);
  575. $element = $('<a href="#" data-action="animation" class="miracle-primary-color-background" style="display: inline-block; padding: 3px 10px; color: white">✕</a>').click(deleteKey);
  576. $thirdRow.append($element);
  577.  
  578. $element = $('<input name="key_paste" value="' + self.keyboardMap[self.settings.bindings.paste] + '"/>').keyup(changeKey);
  579. $thirdRow.append('<br><br>Paste-Key:<br>', $element);
  580. $element = $('<a href="#" data-action="paste" class="miracle-primary-color-background" style="display: inline-block; padding: 3px 10px; color: white">✕</a>').click(deleteKey);
  581. $thirdRow.append($element);
  582.  
  583. $element = $('<input name="key_dance" value="' + self.keyboardMap[self.settings.bindings.dance] + '"/>').keyup(changeKey);
  584. $thirdRow.append('<br><br>Dance-Key:<br>', $element);
  585. $element = $('<a href="#" data-action="dance" class="miracle-primary-color-background" style="display: inline-block; padding: 3px 10px; color: white">✕</a>').click(deleteKey);
  586. $thirdRow.append($element);
  587.  
  588. $element = $('<input name="key_chatLog" value="' + self.keyboardMap[self.settings.bindings.chatLog] + '"/>').keyup(changeKey);
  589. $thirdRow.append('<br><br>Chat-Log-Key:<br>', $element);
  590. $element = $('<a href="#" data-action="chatLog" class="miracle-primary-color-background" style="display: inline-block; padding: 3px 10px; color: white">✕</a>').click(deleteKey);
  591. $thirdRow.append($element);
  592.  
  593. var $table = $('<table>').append($('<tbody>').append($('<tr>').append($firstRow).append($secRow).append($thirdRow)));
  594. $modal.append($table)
  595.  
  596. $element = $('<select name="target_language"><option value="en">English</option><option value="de">German</option><option value="fr">French</option><option value="es">Spanish</option><option value="it">Italian</option><option value="nl">Dutch</option><option value="pl">Polish</option><option value="pt">Portuguese</option><option value="ru">Russian</option></select>').change(changeTargetLanguage);
  597. $modal.append('<br><br>Translate chat messages to:<br>', $element);
  598. $element.get(0).value = self.settings.targetLanguage;
  599.  
  600. $element = $('<input type="color" name="favcolor" value="' + self.settings.primaryColor + '"/>').change(changePrimaryColor);
  601. $modal.append('<br><br>User interface color:<br>', $element);
  602.  
  603. $element = $('<input type="checkbox" name="checkBox" value="1" ' + (self.settings.showClock ? 'checked' : '') + '/>').change(changeClock);
  604. $modal.append('<br><br>Show clock:<br>', $element);
  605.  
  606. $element = $('<textarea rows="6" style="width: 100%; max-width: 500px" placeholder="search|replace">').text(self.settings.replacements).keydown(addReturn).keyup(changeReplacements);
  607. $modal.append('<br><br>Chat-Replacements (1 per line):<br>', $element, '<br>💡 <span style="color: #717171">Avoid using the search text in the replacement!</span>');
  608.  
  609. $modal.append($('<br><a href="#" class="miracle-primary-color-background" style="display: inline-block; margin-top: 20px; padding: 10px; color: white">Close</a>').click(function () {
  610. $modal.hide();
  611. }));
  612. $modal.append($('<a href="#" class="miracle-primary-color-background" style="display: inline-block; margin-left: 20px; margin-top: 20px; padding: 10px; color: white">Export settings</a>').click(function () {
  613. self.download('miracle_settings.txt', localStorage.getItem('miracleScripts'));
  614. }));
  615. $modal.append($('<a href="#" class="miracle-primary-color-background" style="display: inline-block; margin-left: 20px; margin-top: 20px; padding: 10px; color: white">Import settings</a>').click(function () {
  616. var stringifiedSettings = window.prompt('Paste the settings here');
  617. if (stringifiedSettings !== null) {
  618. loadSettings(stringifiedSettings);
  619. localStorage.setItem('miracleScripts', stringifiedSettings);
  620. $modal.hide();
  621. self.message('Settings loaded! Reload Agma to refresh. 😄');
  622. }
  623. }));
  624. $modal.append($('<a href="http://agarioforums.net/showthread.php?tid=61388" target="_blank" class="miracle-primary-color-background" style="display: inline-block; margin-left: 20px; margin-top: 20px; padding: 10px; color: white">Support</a>'));
  625. $modal.append($('<a href="#" class="miracle-primary-color-background" style="display: inline-block; margin-left: 20px; margin-top: 20px; padding: 10px; color: white">Help</a>').click(function () {
  626. $modal.hide();
  627. self.$helpModal.show();
  628. }));
  629.  
  630. $('body').append($modal);
  631.  
  632. $settingsButton.click(function (event) {
  633. $modal.show();
  634.  
  635. event.preventDefault();
  636. });
  637.  
  638. window.addEventListener('miracleCommand', function(commandEvent) {
  639. if (commandEvent.command === '/miraclesettings' || commandEvent.command === '/miracleconfig') {
  640. $modal.show();
  641. $('#chtbox').val('');
  642. }
  643. });
  644. }, 500);
  645. },
  646.  
  647. moveRespawnBtn: function() {
  648. $('#advBox > div:last-child').css('position', 'absolute');
  649. $('#advBox > div:last-child').css('left', '48%');
  650. $('#advBox > div:last-child').css('marginTop', '5px');
  651. $('#advBox > div:nth-child(2)').css('marginLeft', '10%');
  652. },
  653.  
  654. players: function() {
  655. var self = this;
  656.  
  657. $('body').append('<style>#friendList .name { text-decoration: underline; cursor: pointer; }</style>');
  658.  
  659. $('#phpFriendlist').click(function(event) {
  660. if (event.target.classList.contains('name')) { // TODO check: what happens if player is online?
  661. insertPMText($(event.target).text());
  662. }
  663. });
  664.  
  665. $('#btnFriends').click(function() {
  666. var updater = function() {
  667. if ($('#friendDialogMessage').length > 0) {
  668. window.setTimeout(updater, 200);
  669. return;
  670. }
  671.  
  672. $('#phpFriendlist span.name, #requestList span.name').each(function() {
  673. var $nameElement = $(this);
  674. var name = $nameElement.text();
  675. self.settings.players.forEach(function(player) {
  676. if (player.name === name && player.alias) {
  677. $nameElement.attr('title', 'Accountname: ' + name);
  678. $nameElement.css('fontStyle', 'italic');
  679. $nameElement.text(player.alias);
  680. }
  681. });
  682. });
  683. };
  684. window.setTimeout(updater, 200);
  685. });
  686.  
  687. $('#contextUserProfile').click(function() {
  688. $('#miracle-player-settings').remove();
  689.  
  690. window.setTimeout(function() {
  691. if ($('.sweet-alert .sa-error').css('display') === 'block') {
  692. return; // No (public) profile available
  693. }
  694.  
  695. var player = null;
  696. var accountName = $('.sweet-alert h2 span:first()').text();
  697.  
  698. self.settings.players.some(function(candidate) {
  699. if (candidate.name === accountName) {
  700. player = candidate;
  701. return true;
  702. }
  703. });
  704.  
  705. var $editArea = $('<div id="miracle-player-settings">');
  706. var $aliasField = $('<input type="text" maxlength="30" placeholder="Alias" title="Alias" style="display: block; color: #333">').blur(function() {
  707. var alias = $(this).val();
  708. if (player) {
  709. player.alias = alias;
  710. } else {
  711. player = {name: accountName, alias: alias};
  712. self.settings.players.push(player);
  713. }
  714. localStorage.setItem('miracleScripts', JSON.stringify(self.settings));
  715. });
  716. if (player) {
  717. $aliasField.val(player.alias);
  718. }
  719. $editArea.append($aliasField);
  720. var $noteField = $('<textarea maxlength="250" placeholder="Notes" title="Notes" rows="4" style="width: 100%; padding: 10px; color: #333"></textarea>').blur(function() {
  721. var note = $(this).val();
  722. if (player) {
  723. player.note = note;
  724. } else {
  725. player = {name: accountName, note: note};
  726. self.settings.players.push(player);
  727. }
  728. localStorage.setItem('miracleScripts', JSON.stringify(self.settings));
  729. });
  730. if (player) {
  731. $noteField.val(player.note);
  732. }
  733. $editArea.append($noteField);
  734.  
  735. $editArea.insertBefore('.sweet-alert .sa-button-container');
  736.  
  737. if ($('.sweet-overlay').attr('data-listening') != 1) {
  738. $('.sweet-overlay').attr('data-listening', 1);
  739.  
  740. $('.sweet-overlay').click(function() {
  741. console.log('sweet bg clicked');
  742. $('#miracle-player-settings').remove();
  743. });
  744. $('.sweet-alert .sa-button-container button').click(function() {
  745. console.log('sweet btn clicked');
  746. $('#miracle-player-settings').remove();
  747. });
  748. }
  749. }, 300);
  750. });
  751.  
  752. },
  753.  
  754. animation: function () {
  755. var self = this;
  756.  
  757. var chatAnimate = function () {
  758. if ($('#chtbox').val().substr(0, 4) === '/pm ') {
  759. $('#chtbox').val('');
  760. }
  761.  
  762. // All available commands and combinations
  763. var items = ['wacky',
  764. 'spin', 'spinspin', 'spinspinspin', 'wackyspin', 'wackyspinspin', 'wackyspinspinspin',
  765. 'flip', 'flipflip', 'flipflipflip', 'wackyflip', 'wackyflipflip', 'wackyflipflipfip',
  766. 'shake', 'shakeshake', 'shakeshakeshake', 'wackyshake', 'wackyshakeshake', 'wackyshakeshakeshake',
  767. 'jump', 'jumpjump', 'jumpjumpjump', 'wackyjump', 'wackyjumpjump', 'wackyjumpjumpjump',
  768. ];
  769.  
  770. // Super-combinations!!
  771. if (self.getRandomInt(1, 3) === 1) {
  772. items = ['jumpspinflip', 'jumpflipshake', 'jumpspinshake', 'spinshakeflip'];
  773. }
  774.  
  775. // Choose randomly an item of the items array
  776. // Source: https://stackoverflow.com/questions/5915096/get-random-item-from-javascript-array
  777. var item = items[Math.floor(Math.random() * items.length)];
  778.  
  779. // Attempt to avoid triggering spam protection - probably useless :-/
  780. item += String.fromCharCode(8203).repeat(self.getRandomInt(1, 5));
  781.  
  782. // Add text into the chat box and focus it (Note: actually "/" is no longer necessary)
  783. $('#chtbox').val($('#chtbox').val() + item).focus();
  784.  
  785. // Stop the event so that the pressed key won't be written into the chat box!
  786. event.preventDefault();
  787. };
  788.  
  789. window.addEventListener('keydown', function (event) {
  790. // Do nothing if a menu is open
  791. if (document.getElementById('overlays').style.display !== 'none' || document.getElementById('advert').style.display !== 'none') {
  792. return;
  793. }
  794.  
  795. if (event.keyCode == self.settings.bindings.animation) {
  796. chatAnimate();
  797. }
  798. });
  799. },
  800.  
  801. paste: function () {
  802. var self = this;
  803. var emojiFontSize = (window.innerWidth * window.innerHeight > 2000000) ? 24 : 18;
  804. var css = '#miracle-emojis .miracle-emoji { display: inline-block; width: 40px; margin: 0 2px 2px 0; padding: 5px; border: 1px solid #333; font-size: ' + emojiFontSize + 'px; }\n' +
  805. '#miracle-emojis .miracle-emoji:hover { background-color: #FF69B4 }';
  806.  
  807. var emojis = this.emojis.split(' ');
  808. var emojiCode = '';
  809.  
  810. emojis.forEach(function (emoji) {
  811. emojiCode += '<a href="#" class="miracle-emoji">' + emoji + '</a>';
  812. });
  813.  
  814. var addEmoji = function () {
  815. setTimeout(function () {
  816. var $pasteInput = $(document).find('#miracle-emojis input[name=paste]');
  817.  
  818. // Add text into the chatbox and focus it
  819. $('#chtbox').val($('#chtbox').val() + $pasteInput.val()).focus();
  820. }, 200);
  821.  
  822. $modal.hide();
  823. };
  824.  
  825. var $modal = $('<div id="miracle-emojis" class="miracle-primary-color-font" style="position: fixed; width: 100%; height: 100%; padding: 50px; color: #FF69B4; background-color: rgba(0,0,0,0.95); overflow-y: auto; z-index: 999; display: none"></div>');
  826. $modal.append('<style>' + css + '</style>');
  827. $modal.append('<h1>Insert text or emoji</h1>');
  828. var $pasteInput = $('<input name="paste" value="" placeholder="Click to paste text, or (double)click emoji!" style="width: 300px; max-width: 100%" />');
  829. $modal.append('<br><br>Insert:<br>', $pasteInput);
  830. $modal.html($modal.html() + '<br><br>' + emojiCode);
  831. $modal.append($('<br><a href="#" class="miracle-primary-color-background" style="display: inline-block; margin-top: 20px; padding: 10px; color: white">Add</a>').click(addEmoji));
  832. $modal.append($('<a href="#" class="miracle-primary-color-background" style="display: inline-block; float: right; margin-top: 20px; padding: 10px; color: white">Cancel</a>').click(function () {
  833. $modal.hide();
  834. }));
  835.  
  836. $modal.find('input[name=paste]').click(function () {
  837. var text = window.prompt('Please paste your text here!');
  838.  
  839. if (text !== null) {
  840. var $pasteInput = $modal.find('input[name=paste]');
  841.  
  842. // Add text into the paste input
  843. $pasteInput.val($pasteInput.val() + text);
  844. }
  845. });
  846.  
  847. $modal.click(function (event) {
  848. if (event.target.classList.contains('miracle-emoji')) {
  849. var $target = $(this).find('input[name=paste]');
  850. $target.val($target.val() + $(event.target).text());
  851.  
  852. event.preventDefault();
  853. }
  854. });
  855.  
  856. $modal.dblclick(function (event) {
  857. if (event.target.classList.contains('miracle-emoji')) {
  858. $('#chtbox').val($('#chtbox').val() + $(event.target).text()).focus();
  859. $(this).hide();
  860.  
  861. event.preventDefault();
  862. }
  863. });
  864.  
  865. $('body').append($modal);
  866.  
  867. window.addEventListener('keydown', function (event) {
  868. // Do nothing if a menu is open
  869. if (document.getElementById('overlays').style.display !== 'none' || document.getElementById('advert').style.display !== 'none') {
  870. return;
  871. }
  872.  
  873. if (event.keyCode == self.settings.bindings.paste) {
  874. $modal.find('input[name=paste]').val('');
  875. $modal.toggle();
  876. }
  877. });
  878.  
  879. window.addEventListener('miracleCommand', function(commandEvent) {
  880. if (commandEvent.command === '/paste') {
  881. $modal.find('input[name=paste]').val('');
  882. $modal.toggle();
  883. $('#chtbox').val('');
  884. }
  885. });
  886. },
  887.  
  888. replacements: function () {
  889. var self = this;
  890.  
  891. $('#chtbox').keyup(function () {
  892. var lines = self.settings.replacements.split('\n');
  893.  
  894. var text = $('#chtbox').val();
  895.  
  896. lines.forEach(function (line) {
  897. var replacement = line.split('|');
  898. if (replacement.length === 2) {
  899. text = text.replace(replacement[0], replacement[1]);
  900. $('#chtbox').val(text).focus();
  901. }
  902. });
  903. });
  904. },
  905.  
  906. chatLog: function () {
  907. var self = this;
  908.  
  909. // We escape the message before we print them, so no one can inject JS code!
  910. var htmlEntities = function (str) {
  911. return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
  912. };
  913.  
  914. var originalFillText = CanvasRenderingContext2D.prototype.fillText;
  915. var lastChatNickname = null;
  916. var lastChatNicknameColor = null;
  917. var chatLogCode = '';
  918. var chatLog = [];
  919. CanvasRenderingContext2D.prototype.fillText = function () {
  920. if (this.canvas.id !== 'leaderboard' && this.canvas.height === 23) {
  921. var text = arguments[0];
  922. var xPos = arguments[1]; // Usually 3 for nicknames but bigger when a crown, donator icon etc. are displayed
  923. var lineSize = this.canvas.width; // ATTENTION: Not sure if that really is the total size (icons + nickname + message)
  924.  
  925. // Sometimes also numbers (int) are printed (probably masses on cells) so we filter for strings
  926. if (typeof text === 'string' && (this.fillStyle !== '#f5f6ce' && this.fillStyle !== '#444444')) {
  927. // Dirty fix for the missing icon in the initial welcome messages
  928. if (text == '') {
  929. text = '📢';
  930. }
  931. lastChatNickname = text;
  932. lastChatNicknameColor = this.fillStyle;
  933. }
  934. if (typeof text === 'string' && (this.fillStyle === '#f5f6ce' || this.fillStyle === '#444444')) {
  935. // Unfortunately chat messages will be printed more than just once and I don't know
  936. // how to identify them, so for now all messages will be stored and only new messages will be shown.
  937. // Of course this means messages won't be shown if they are sent more than once (by the same nickname).
  938. var found = false;
  939. for (var i = 0; i < chatLog.length; i++) {
  940. if (chatLog[i].nickname === lastChatNickname && chatLog[i].nicknameColor === lastChatNicknameColor && chatLog[i].message === text) {
  941. found = true;
  942. break;
  943. }
  944. }
  945.  
  946. if (!found) {
  947. var legit = text.indexOf(self.watermark) > -1 ? 'class="legit" title="🛡️ This seems to be a legit Miracle Scripts message"' : '';
  948. // NOTE: We might have to look for the coordinates of the text to find out the order of the messages (somehow)
  949. chatLogCode += '<div ' + legit + '><span class="time">' + (new Date().toLocaleTimeString()) + '</span> <span class="nickname" style="color: ' + lastChatNicknameColor + '">' + htmlEntities(lastChatNickname) + '</span>';
  950. chatLogCode += '<span class="message" style="color: #f5f6ce">' + htmlEntities(text) + '</span></div>';
  951. chatLog.push({nickname: lastChatNickname, nicknameColor: lastChatNicknameColor, message: text});
  952. }
  953. }
  954. }
  955.  
  956. return originalFillText.apply(this, arguments);
  957. };
  958.  
  959. var performSearch = function (searchElement) {
  960. var subject = searchElement.value.toLowerCase();
  961.  
  962. $('#miracle-complete-chatlog div').each(function () {
  963. var $entry = $(this);
  964.  
  965. if ($entry.text().toLowerCase().indexOf(subject) === -1 && subject != '') {
  966. $entry.hide();
  967. } else {
  968. $entry.show();
  969. }
  970. });
  971. };
  972.  
  973. var $modal = $('<div id="miracle-chatlog" class="miracle-primary-color-font" style="position: fixed; width: 100%; height: 100%; padding: 50px; color: #FF69B4; background-color: rgba(0,0,0,0.95); user-select: text; overflow-y: auto; z-index: 999; display: none"></div>');
  974. $modal.append('<style>#miracle-complete-chatlog div:hover { background-color: rgba(255,255,255,0.1) } #miracle-complete-chatlog .time { padding-right: 10px; color: #666; } #miracle-complete-chatlog div.legit { font-style: italic }</style>');
  975. $modal.append('<h1>Complete Chat Log</h1><br>');
  976. $modal.append('<div id="miracle-complete-chatlog"></div>');
  977. $modal.append($('<input type="text" style="display: inline-block; position: fixed; right: 20px; bottom: 20px;" placeholder="Type to search">').keyup(function () {
  978. performSearch(this);
  979. }));
  980. $modal.append($('<br><a href="#" class="miracle-primary-color-background" style="display: inline-block; margin-top: 20px; padding: 10px; color: white">Close</a>').click(function () {
  981. $modal.hide();
  982. }));
  983. $('body').append($modal);
  984.  
  985. $('#miracle-complete-chatlog').dblclick(function (event) {
  986. var $clickTarget;
  987.  
  988. // Each chat message is a div with spans in it. Either the spans or the div might be clicked.
  989. if (event.target.tagName.toLowerCase() === 'span') {
  990. $clickTarget = $(event.target).parent();
  991. } else {
  992. $clickTarget = $(event.target);
  993. }
  994.  
  995. var message = $clickTarget.find('.message').text();
  996.  
  997. // Messages usually start with ': ' but we do not want to "translate" it, so we remove it
  998. if (message.substr(0, 2) === ': ') {
  999. message = message.substr(2);
  1000. }
  1001.  
  1002. window.open('https://www.deepl.com/translator#en/' + self.settings.targetLanguage + '/' + message);
  1003. });
  1004.  
  1005. var showChatlog = function() {
  1006. $('#miracle-complete-chatlog').html(chatLogCode);
  1007. $modal.toggle();
  1008. $modal.get(0).scrollTo(0, $modal.get(0).scrollHeight);
  1009. };
  1010.  
  1011. window.addEventListener('keyup', function (event) {
  1012. // Ignore text input field so typing in them is possible
  1013. if (self.isWritingText()) {
  1014. return;
  1015. }
  1016.  
  1017. if (event.keyCode == self.settings.bindings.chatLog) {
  1018. showChatlog();
  1019. }
  1020. });
  1021.  
  1022. window.addEventListener('miracleCommand', function(commandEvent) {
  1023. if (commandEvent.command === '/chatlog') {
  1024. showChatlog();
  1025. $('#chtbox').val('');
  1026. }
  1027. });
  1028. },
  1029.  
  1030. favSkins: function () {
  1031. var self = this;
  1032.  
  1033. // We need to have a delay, because the menu is not loaded right away
  1034. setTimeout(function () {
  1035. var favIconClick = function () {
  1036. var id = parseInt($(this).parent().parent().find('button').attr('onclick').substr(11));
  1037.  
  1038. if (self.settings.favSkins.includes(id)) {
  1039. $(this).addClass('skin-not-fav');
  1040. $('#skinUseBtn' + id).parent().find('span').addClass('skin-not-fav');
  1041. var index = self.settings.favSkins.indexOf(id);
  1042. self.settings.favSkins.splice(index, 1);
  1043. } else {
  1044. $(this).removeClass('skin-not-fav');
  1045. self.settings.favSkins.push(id);
  1046. }
  1047. localStorage.setItem('miracleScripts', JSON.stringify(self.settings));
  1048. renderFavSkins();
  1049. };
  1050.  
  1051. var renderFavSkins = function () {
  1052. var $skins = null;
  1053.  
  1054. if ($('#fav-skins').length > 0) {
  1055. $skins = $('#fav-skins');
  1056. $skins.html('');
  1057. } else {
  1058. $skins = $('<div id="fav-skins" style="background-color: #4d4950"></div>');
  1059. $skins.insertAfter('#publicSkinsHeader');
  1060.  
  1061. $('#fav-skins').click(function (event) {
  1062. if (event.target.tagName.toLowerCase() === 'span') {
  1063. favIconClick.apply(event.target);
  1064. }
  1065. });
  1066. }
  1067. self.settings.favSkins.forEach(function (id) {
  1068. $skins.append('<div style="float: left; padding: 5px;"><img style="border: 1px solid rgba(0,0,0,.25); border-radius: 50%; box-shadow: 0 0 2px #000;" src="skins/' + id + '_lo.png?u=1575650762" alt=""><h4><span style="cursor: pointer">⭐</span></h4><button class="btn btn-primary skinuse-btn" onclick="toggleSkin(' + id + ');">Use</button></div>');
  1069. });
  1070. $skins.append('<div style="clear: both"></div>');
  1071. };
  1072.  
  1073. var addFavIcons = function () {
  1074. var $skins = $('#publicSkinsPage');
  1075. $skins.append('<style>.skin-not-fav { opacity: 0.3 }</style>');
  1076.  
  1077. $skins.find('h4').each(function () {
  1078. var $favIcon = $('<span style="cursor: pointer">⭐</span>');
  1079. var id = parseInt($(this).parent().find('button').attr('onclick').substr(11));
  1080.  
  1081. $favIcon.click(favIconClick);
  1082.  
  1083. $(this).append($favIcon);
  1084.  
  1085. if (! self.settings.favSkins.includes(id)) {
  1086. $favIcon.addClass('skin-not-fav');
  1087. }
  1088. });
  1089. };
  1090. var initialized = false;
  1091. $('#skinsCustomTab, #skinExampleMenu').click(function () {
  1092. if (!initialized) {
  1093. var checkState = function () {
  1094. if ($('#publicSkinsPage').html() !== '') {
  1095. addFavIcons();
  1096. renderFavSkins();
  1097. } else {
  1098. setTimeout(checkState, 30);
  1099. }
  1100. };
  1101. checkState();
  1102. initialized = true;
  1103. }
  1104. });
  1105. $('#phpSkins').click(function (event) {
  1106. if (event.target.classList.contains('publicskins-nav-btn')) {
  1107. addFavIcons();
  1108. }
  1109. });
  1110.  
  1111. }, 500);
  1112. },
  1113.  
  1114. skinChanger: function() {
  1115. var self = this;
  1116.  
  1117. // When the user changes the skin, display ID of the picked skin
  1118. var originalToggleSkin = window.toggleSkin;
  1119. window.toggleSkin = function () {
  1120. self.message('Picked skin with ID ' + arguments[0]);
  1121.  
  1122. return originalToggleSkin.apply(this, arguments);
  1123. };
  1124.  
  1125. var useSkinFromSlot = function (skinSlot, skinId) {
  1126. var skinUri = null;
  1127.  
  1128. if (skinId) {
  1129. if (skinId === 'this' || skinId === 'current' || skinId === 'my' || skinId === 'me' || skinId === 'now' || skinId === 'here') {
  1130. skinUri = self.getSkinUrl();
  1131. skinId = parseInt(skinUri.substr(skinUri.indexOf('skins/') + 6));
  1132.  
  1133. self.message('Skin ' + skinId + ' saved in slot ' + skinSlot + ' ✔️');
  1134. }
  1135.  
  1136. skinId = parseInt(skinId);
  1137. self.settings.quickSkins[skinSlot - 1] = skinId;
  1138. localStorage.setItem('miracleScripts', JSON.stringify(self.settings));
  1139. } else {
  1140. skinId = self.settings.quickSkins[skinSlot - 1];
  1141. if (!skinId) {
  1142. self.message('Skin not set yet, set with /skin' + skinSlot + ' id 😊', true);
  1143. $('#chtbox').val('');
  1144. return;
  1145. }
  1146. }
  1147.  
  1148. if (skinUri === null) {
  1149. self.useSkin(skinId);
  1150. }
  1151.  
  1152. $('#chtbox').val('');
  1153. };
  1154.  
  1155. window.addEventListener('miracleCommand', function(commandEvent) {
  1156.  
  1157. if (commandEvent.command === 'skin1' || commandEvent.command === '/skin1') {
  1158. useSkinFromSlot(1, commandEvent.argument1);
  1159. }
  1160. if (commandEvent.command === 'skin2' || commandEvent.command === '/skin2') {
  1161. useSkinFromSlot(2, commandEvent.argument1);
  1162. }
  1163. if (commandEvent.command === 'skin3' || commandEvent.command === '/skin3') {
  1164. useSkinFromSlot(3, commandEvent.argument1);
  1165. }
  1166. if (commandEvent.command === 'skin4' || commandEvent.command === '/skin4') {
  1167. useSkinFromSlot(4, commandEvent.argument1);
  1168. }
  1169. if (commandEvent.command === 'skin5' || commandEvent.command === '/skin5') {
  1170. useSkinFromSlot(5, commandEvent.argument1);
  1171. }
  1172. if (commandEvent.command === 'skin6' || commandEvent.command === '/skin6') {
  1173. useSkinFromSlot(6, commandEvent.argument1);
  1174. }
  1175. if (commandEvent.command === 'skin7' || commandEvent.command === '/skin7') {
  1176. useSkinFromSlot(7, commandEvent.argument1);
  1177. }
  1178. if (commandEvent.command === 'skin8' || commandEvent.command === '/skin8') {
  1179. useSkinFromSlot(8, commandEvent.argument1);
  1180. }
  1181. if (commandEvent.command === 'skin9' || commandEvent.command === '/skin9') {
  1182. useSkinFromSlot(9, commandEvent.argument1);
  1183. }
  1184. if (commandEvent.command === 'skin10' || commandEvent.command === '/skin10') {
  1185. useSkinFromSlot(10, commandEvent.argument1);
  1186. }
  1187. if (commandEvent.command === 'skin11' || commandEvent.command === '/skin11') {
  1188. useSkinFromSlot(11, commandEvent.argument1);
  1189. }
  1190. if (commandEvent.command === 'skin12' || commandEvent.command === '/skin12') {
  1191. useSkinFromSlot(12, commandEvent.argument1);
  1192. }
  1193. if (commandEvent.command === 'skin13' || commandEvent.command === '/skin13') {
  1194. useSkinFromSlot(13, commandEvent.argument1);
  1195. }
  1196. if (commandEvent.command === 'skin14' || commandEvent.command === '/skin14') {
  1197. useSkinFromSlot(14, commandEvent.argument1);
  1198. }
  1199. if (commandEvent.command === 'skin15' || commandEvent.command === '/skin15') {
  1200. useSkinFromSlot(15, commandEvent.argument1);
  1201. }
  1202. if (commandEvent.command === 'skin16' || commandEvent.command === '/skin16') {
  1203. useSkinFromSlot(16, commandEvent.argument1);
  1204. }
  1205. if (commandEvent.command === 'skin17' || commandEvent.command === '/skin17') {
  1206. useSkinFromSlot(17, commandEvent.argument1);
  1207. }
  1208. if (commandEvent.command === 'skin18' || commandEvent.command === '/skin18') {
  1209. useSkinFromSlot(18, commandEvent.argument1);
  1210. }
  1211. if (commandEvent.command === 'skin19' || commandEvent.command === '/skin19') {
  1212. useSkinFromSlot(19, commandEvent.argument1);
  1213. }
  1214. if (commandEvent.command === 'skin20' || commandEvent.command === '/skin20') {
  1215. useSkinFromSlot(20, commandEvent.argument1);
  1216. }
  1217. if (commandEvent.command === 'skin21' || commandEvent.command === '/skin21') {
  1218. self.message('Only 20 skin slots are available ❌', true);
  1219. $('#chtbox').val('').focus();
  1220. }
  1221. });
  1222.  
  1223. window.addEventListener('keyup', function (event) {
  1224. // Ignore text input field so typing in them is possible
  1225. if (self.isWritingText()) {
  1226. return;
  1227. }
  1228.  
  1229. if (event.keyCode == self.settings.bindings.skin1) {
  1230. useSkinFromSlot(1);
  1231. }
  1232. if (event.keyCode == self.settings.bindings.skin2) {
  1233. useSkinFromSlot(2);
  1234. }
  1235. if (event.keyCode == self.settings.bindings.skin3) {
  1236. useSkinFromSlot(3);
  1237. }
  1238. if (event.keyCode == self.settings.bindings.skin4) {
  1239. useSkinFromSlot(4);
  1240. }
  1241. if (event.keyCode == self.settings.bindings.skin5) {
  1242. useSkinFromSlot(5);
  1243. }
  1244. if (event.keyCode == self.settings.bindings.skin6) {
  1245. useSkinFromSlot(6);
  1246. }
  1247. if (event.keyCode == self.settings.bindings.skin7) {
  1248. useSkinFromSlot(7);
  1249. }
  1250. if (event.keyCode == self.settings.bindings.skin8) {
  1251. useSkinFromSlot(8);
  1252. }
  1253. if (event.keyCode == self.settings.bindings.skin9) {
  1254. useSkinFromSlot(9);
  1255. }
  1256. });
  1257. },
  1258.  
  1259. lineSplit: function() {
  1260. var self = this;
  1261.  
  1262. window.addEventListener('miracleCommand', function(commandEvent) {
  1263. if (commandEvent.command === '/linesplit') {
  1264. self.lineSplitAt = Date.now();
  1265. self.message('Linesplit •••••');
  1266.  
  1267. var doSplit = function() {
  1268. if (Date.now() - self.lineSplitAt < 1000) {
  1269. var factor = Math.min((Date.now() - self.lineSplitAt) / 700, 1);
  1270. var x = window.innerWidth / 2;
  1271. var y = factor * (window.innerHeight / 2);
  1272.  
  1273. $('canvas').trigger($.Event('mousemove', {clientX: x, clientY: y}));
  1274.  
  1275. window.requestAnimationFrame(doSplit);
  1276. } else {
  1277. if (Date.now() - self.lineSplitAt < 3000) {
  1278. if (self.splitAt === undefined || Date.now() - self.splitAt > 200) {
  1279. $('body').trigger($.Event('keydown', { keyCode: self.hotkeys.Space.c}));
  1280. $('body').trigger($.Event('keyup', { keyCode: self.hotkeys.Space.c}));
  1281. self.splitAt = Date.now();
  1282. }
  1283.  
  1284. window.requestAnimationFrame(doSplit);
  1285. }
  1286. }
  1287. };
  1288. doSplit();
  1289. $('#chtbox').val('');
  1290. }
  1291. });
  1292. },
  1293.  
  1294. dance: function () {
  1295. var self = this;
  1296.  
  1297. // Stop dancing on respawn
  1298. window.addEventListener('keydown', function (event) {
  1299. if (event.keyCode == self.hotkeys.M.c && ! self.isWritingText()) {
  1300. self.dancing = false;
  1301. }
  1302. });
  1303.  
  1304. var initDance = function() {
  1305. // Do nothing if a menu is open
  1306. if (document.getElementById('overlays').style.display !== 'none' || document.getElementById('advert').style.display !== 'none') {
  1307. return;
  1308. }
  1309.  
  1310. self.dancing = ! self.dancing;
  1311.  
  1312. if (self.dancing) {
  1313. self.performDance.apply(self);
  1314. }
  1315. };
  1316.  
  1317. window.addEventListener('keyup', function () {
  1318. if (event.keyCode == self.settings.bindings.dance) {
  1319. initDance();
  1320. }
  1321. });
  1322.  
  1323. window.addEventListener('miracleCommand', function(commandEvent) {
  1324. if (commandEvent.command === '/dance') {
  1325. initDance();
  1326. $('#chtbox').val('');
  1327. }
  1328. });
  1329. },
  1330.  
  1331. performDance: function () {
  1332. var self = this ? this : window.miracleScripts;
  1333.  
  1334. if (self.danceAngle === undefined) {
  1335. self.danceAngle = 0;
  1336. }
  1337.  
  1338. self.danceAngle += 20;
  1339.  
  1340. if (self.danceAngle > 360) {
  1341. self.danceAngle = 0;
  1342. }
  1343.  
  1344. var distance = 1000000; //Math.floor(Math.min(window.innerWidth, window.innerHeight) / 2);
  1345. var x = window.innerWidth / 2 + Math.sin(self.danceAngle * Math.PI / 180) * distance;
  1346. var y = window.innerHeight / 2 + Math.cos(self.danceAngle * Math.PI / 180) * distance;
  1347. $('canvas').trigger($.Event('mousemove', {clientX: x, clientY: y}));
  1348.  
  1349. // Stop dancing if dead ... to avoid continuing dancing after next respawn
  1350. if (document.getElementById('advert').style.display !== 'none') {
  1351. self.dancing = false;
  1352. }
  1353. if (self.dancing) {
  1354. window.requestAnimationFrame(self.performDance);
  1355. }
  1356. },
  1357.  
  1358. waste: function() {
  1359. var self = this;
  1360.  
  1361. window.addEventListener('keydown', function (event) {
  1362. if (event.keyCode == self.hotkeys.M.c && ! self.isWritingText()) {
  1363. self.wasting = false;
  1364. }
  1365. });
  1366.  
  1367. window.addEventListener('miracleCommand', function(commandEvent) {
  1368. if (commandEvent.command === '/waste') {
  1369. if (self.wasting) {
  1370. self.wasting = false;
  1371. self.message('Stopped wasting all mass.');
  1372. self.dancing = false;
  1373. } else {
  1374. self.wasting = true;
  1375. self.message('Wasting all mass... 💥');
  1376. if (! self.dancing) {
  1377. self.dancing = true;
  1378. self.performDance.apply(self);
  1379. }
  1380. $('#chtbox').val('spinshakeflip').focus();
  1381. }
  1382.  
  1383. var doWaste = function() {
  1384. // Stop wasting mass if dead ... to avoid continuing wasting after next respawn
  1385. if (document.getElementById('advert').style.display !== 'none') {
  1386. self.wasting = false;
  1387. }
  1388. if (! self.wasting) {
  1389. return;
  1390. }
  1391. $('body').trigger($.Event('keydown', { keyCode: self.hotkeys.W.c}));
  1392. $('body').trigger($.Event('keyup', { keyCode: self.hotkeys.W.c}));
  1393. window.requestAnimationFrame(doWaste);
  1394. };
  1395. doWaste();
  1396. }
  1397. });
  1398. },
  1399.  
  1400. fpsPing: function () {
  1401. var self = this;
  1402.  
  1403. window.addEventListener('miracleCommand', function(commandEvent) {
  1404. if (commandEvent.command === 'ping' || commandEvent.command === '/ping') {
  1405. window.setFPS(1);
  1406. var pingRating = 'Extremely bad! ❌', ping = $('#ping').text();
  1407. if (parseInt(ping) > 0) {
  1408. if (parseInt(ping) >= 0 && parseInt(ping) < 40) { pingRating = 'Perfect! ✔️'; }
  1409. if (parseInt(ping) >= 40 && parseInt(ping) < 70) { pingRating = 'Good! ✔️'; }
  1410. if (parseInt(ping) >= 70 && parseInt(ping) < 120) { pingRating = 'Acceptable! ✔️'; }
  1411. if (parseInt(ping) >= 120 && parseInt(ping) < 200) { pingRating = 'Bad! ❌'; }
  1412. if (parseInt(ping) >= 200 && parseInt(ping) < 990) { pingRating = 'Insanity! ❌'; }
  1413. if (parseInt(ping) >= 990 && parseInt(ping) < 4900) { pingRating = 'THIS IS MADNESS! ❌'; }
  1414. if (parseInt(ping) > 4900) { pingRating = 'M M M M M M M M M MONSTERPING! ❌'; }
  1415. } else {
  1416. ping = '∞ (infinite) ';
  1417. }
  1418. $('#chtbox').val('has a ping of: ' + ping + '. ' + pingRating + self.watermark).focus();
  1419. }
  1420. if (commandEvent.command === 'fps' || commandEvent.command === '/fps') {
  1421. window.setFPS(1);
  1422. var fpsRating = 'Perfect! ✔️', fps = $('#fps').text();
  1423. if (parseInt(fps) > 0) {
  1424. if (fps >= 0 && fps < 10) { fpsRating = 'Extremely bad! ❌'; }
  1425. if (fps >= 10 && fps < 30) { fpsRating = 'Bad! ❌'; }
  1426. if (fps >= 30 && fps < 40) { fpsRating = 'Acceptable! ✔️'; }
  1427. if (fps >= 40 && fps < 57) { fpsRating = 'Good! ✔️'; }
  1428. if (fps > 73) { fpsRating = 'Outstanding! ✔️'; }
  1429. if (fps > 97) { fpsRating = 'Fantastic! ✔️'; }
  1430. if (fps > 117) { fpsRating = 'GODLIKE! ✔️'; }
  1431. } else {
  1432. fpsRating = '';
  1433. }
  1434.  
  1435. $('#chtbox').val('has ' + fps + ' frames per second (fps). ' + fpsRating + self.watermark).focus();
  1436. }
  1437. });
  1438. },
  1439.  
  1440. timer: function() {
  1441. var self = this;
  1442.  
  1443. var timerStartedAt = null;
  1444. var timerMinutes = null;
  1445. var timeoutId = null;
  1446. var updateId = null;
  1447.  
  1448. var $timeUi = $('<div style="position: fixed; right: 20px; bottom: 225px; z-index: 998; color: #3e3e3e; pointer-events: none"></div>');
  1449. $('body').append($timeUi);
  1450.  
  1451.  
  1452. var updateUi = function () {
  1453.  
  1454. var time = '';
  1455. if (self.settings.showClock) {
  1456. var hours = (new Date).getHours();
  1457. var minutes = (new Date).getMinutes();
  1458. time = (hours < 10 ? '0' + hours : hours) + ':' + (minutes < 10 ? '0' + minutes : minutes);
  1459. if (timeoutId) {
  1460. time = ' - ' + time;
  1461. }
  1462. }
  1463.  
  1464. var remaining = '';
  1465. if (timeoutId) {
  1466. remaining = Math.ceil(((timerStartedAt + timerMinutes * 60 * 1000) - Date.now()) / 1000 / 60) + 'm';
  1467. }
  1468.  
  1469. if (time || remaining) {
  1470. $timeUi.text('🕒 ' + remaining + time);
  1471. } else {
  1472. $timeUi.text('');
  1473. }
  1474. };
  1475. updateUi();
  1476. updateId = setInterval(updateUi, 2000);
  1477.  
  1478. window.addEventListener('miracleCommand', function(commandEvent) {
  1479. if (commandEvent.command === 'timer' || commandEvent.command === '/timer') {
  1480. var argument1 = commandEvent.argument1;
  1481. var argument2 = commandEvent.argument2;
  1482.  
  1483. if (argument1) {
  1484. timerMinutes = parseInt(argument1);
  1485. if (argument2 === 'h' || argument2 === 'hour' || argument2 === 'hours') {
  1486. timerMinutes *= 60;
  1487. }
  1488. if (timeoutId !== null) {
  1489. clearTimeout(timeoutId);
  1490. }
  1491.  
  1492. if (argument1 === '0' || argument1 === 'reset' || argument1 === 'stop') {
  1493. self.message('🗑️ Timer removed');
  1494. } else {
  1495. timerStartedAt = Date.now();
  1496. timeoutId = setTimeout(function () {
  1497. timeoutId = null;
  1498. updateUi()
  1499. var message = '🕒 Alert! Timer has expired after ' + timerMinutes + ' minutes.';
  1500. self.message(message);
  1501. window.alert(message);
  1502. }, timerMinutes * 60 * 1000);
  1503. updateUi();
  1504.  
  1505. self.message('🕒 Timer set to ' + timerMinutes + ' minutes');
  1506. }
  1507. } else {
  1508. if (timeoutId === null) {
  1509. self.message('🕒 No timer has been set. Set with: /timer minutes', true);
  1510. } else {
  1511. var remaining = ((timerStartedAt + timerMinutes * 60 * 1000) - Date.now()) / 1000 / 60;
  1512. self.message('🕒 ' + Math.round(remaining * 10) / 10 + ' minutes remaining.');
  1513. }
  1514. }
  1515. $('#chtbox').val('').focus();
  1516. }
  1517. });
  1518. },
  1519.  
  1520. alive: function() {
  1521. var self = this;
  1522.  
  1523. var element = document.getElementById('playBtn');
  1524. element.addEventListener('click', function() {
  1525. if (! self.isAlive) {
  1526. self.spawnedAt = Date.now();
  1527. self.isAlive = true;
  1528. }
  1529. });
  1530. element = document.querySelector('.bottom-dashboard-box img[title=Respawn]');
  1531. element.addEventListener('click', function() {
  1532. self.spawnedAt = Date.now();
  1533. self.isAlive = true;
  1534. });
  1535. element = document.getElementById('advertContinue');
  1536. element.addEventListener('click', function() {
  1537. self.isAlive = false;
  1538. });
  1539.  
  1540. window.addEventListener('keydown', function (event) {
  1541. if (event.keyCode == self.hotkeys.M.c && ! self.isWritingText()) {
  1542. self.spawnedAt = Date.now();
  1543. self.isAlive = true;
  1544. }
  1545. });
  1546.  
  1547. window.addEventListener('miracleCommand', function(commandEvent) {
  1548. if (commandEvent.command === '/alive' || commandEvent.command === 'alive') {
  1549. if (! self.isAlive || document.getElementById('advert').style.display !== 'none') {
  1550. $('#chtbox').val('is not alive ☠');
  1551. } else {
  1552. var minutes = parseInt((Date.now() - self.spawnedAt) / 1000 / 60);
  1553. if (minutes < 1) {
  1554. minutes = parseInt((Date.now() - self.spawnedAt) / 1000) + ' Seconds & 0';
  1555. }
  1556. if (minutes > 60) {
  1557. minutes = parseInt(minutes / 60) + ' Hours & ' + (minutes % 60);
  1558. }
  1559. $('#chtbox').val('has been alive for ' + minutes + ' Minutes' + self.watermark);
  1560. }
  1561. }
  1562. });
  1563.  
  1564. },
  1565.  
  1566. nameColor: function() {
  1567. var self = this;
  1568.  
  1569. window.addEventListener('miracleCommand', function(commandEvent) {
  1570. if (commandEvent.command === '/namecolor' || commandEvent.command === '/colorname' || commandEvent.command === '/colorchange') {
  1571. self.message('🚫 This feature has been removed since the Agma staff does not allow it', true);
  1572. $('#chtbox').val('');
  1573. }
  1574. });
  1575. },
  1576.  
  1577. skinApplier: function() {
  1578. var self = this;
  1579.  
  1580. var $useWearablesItem = $('<li class="contextmenu-item enabled"><div class="context-icon"><i class="fa fa-graduation-cap"></i></div><p>Use Player\'s Wearables</p></li>');
  1581. $useWearablesItem.insertAfter('#contextPlayer');
  1582. var $useSkinItem = $('<li class="contextmenu-item enabled"><div class="context-icon"><i class="fa fa-eye"></i></div><p>Use Player\'s Skin</p></li>');
  1583. $useSkinItem.insertAfter('#contextPlayer');
  1584.  
  1585. $useSkinItem.click(function() {
  1586. var skinUrl = self.getSkinUrl('#contextPlayerSkin');
  1587. if (skinUrl === null) {
  1588. self.message('This player does not use a skin or no player selected 🚫', true);
  1589. } else {
  1590. var skinId = parseInt(skinUrl.substr(22)); // Cut off "https://agma.io/skins/"
  1591. self.useSkin(skinId);
  1592. }
  1593. });
  1594.  
  1595. $useWearablesItem.click(function() {
  1596. var extractWearableId = function(style) {
  1597. var pos = style.indexOf('background-image: url("wearables/');
  1598. if (pos === -1) {
  1599. return null;
  1600. }
  1601. return parseInt(style.substr(pos + 33));
  1602. }
  1603.  
  1604. var wearables = [
  1605. extractWearableId($('#contextPlayerWear1').attr('style')),
  1606. extractWearableId($('#contextPlayerWear2').attr('style')),
  1607. extractWearableId($('#contextPlayerWear3').attr('style')),
  1608. extractWearableId($('#contextPlayerWear4').attr('style')),
  1609. extractWearableId($('#contextPlayerWear5').attr('style')),
  1610. ];
  1611.  
  1612. var useWearables = function(wearables) {
  1613. window.azad(true);
  1614.  
  1615. setTimeout(function () {
  1616. $('#skinExampleMenu').click();
  1617.  
  1618.  
  1619. setTimeout(function () {
  1620.  
  1621. $('#wearablesTab a').click()
  1622.  
  1623. setTimeout(function () {
  1624. // First remove all current wearables
  1625. var oldWearables = [
  1626. extractWearableId($('#wearExampleShop1').attr('style')),
  1627. extractWearableId($('#wearExampleShop2').attr('style')),
  1628. extractWearableId($('#wearExampleShop3').attr('style')),
  1629. extractWearableId($('#wearExampleShop4').attr('style')),
  1630. extractWearableId($('#wearExampleShop5').attr('style')),
  1631. ]
  1632. oldWearables.forEach(function(id) {
  1633. //toggleWearable(id, 0, 0, 0, false);
  1634. $('#wearableUseBtn' + id).click();
  1635. });
  1636.  
  1637.  
  1638. wearables.forEach(function(id) {
  1639. $('#wearableUseBtn' + id).click();
  1640. });
  1641.  
  1642. setTimeout(function () {
  1643. $('#shopModalDialog button.close').click();
  1644.  
  1645. setTimeout(function () {
  1646. window.setNick(document.getElementById('nick').value);
  1647. }, 200);
  1648. }, 200);
  1649. }, 1000);
  1650.  
  1651. }, 200);
  1652. }, 200);
  1653. }
  1654. useWearables(wearables);
  1655. });
  1656. },
  1657.  
  1658. help: function() {
  1659. var $modal = $('<div class="miracle-primary-color-font" style="position: fixed; width: 100%; height: 100%; padding: 50px; background-color: rgba(0,0,0,0.95); z-index: 999; display: none"></div>');
  1660. $modal.append('<h1>Miracle Scripts Help</h1>');
  1661.  
  1662. var helpText = '<br><span style="color: #717171">Available chat commands are: </span><br><br><table>' +
  1663. '<tr><th style="padding-right: 70px"><i>Command</i></th><th><i>Description</i></th></tr>' +
  1664. '<tr><td><code>/help</code></td><td>Show this help</td></tr>' +
  1665. '<tr><td><code>/miracle</code></td><td>Show version info</td></tr>' +
  1666. '<tr><td><code>/miraclesettings</code></td><td>Show the miracle settings page</td></tr>' +
  1667. '<tr><td><code>/skin<n></code></td><td>Change to skin &lt;n></td></tr>' +
  1668. '<tr><td><code>/skin<n> this</code></td><td>Store current skin as skin <n></td></tr>' +
  1669. '<tr><td><code>/skin<n> &lt;id></code></td><td>Store skin with ID &lt;id> as skin &lt;n></td></tr>' +
  1670. '<tr><td><code>/skinid</code></td><td>Send a chat message with your skin ID</td></tr>' +
  1671. '<tr><td><code>/useskin &lt;id></code></td><td>Use skin with the given ID</td></tr>' +
  1672. '<tr><td><code>/chatlog</code></td><td>Show the extended chat log</td></tr>' +
  1673. '<tr><td><code>/shout &lt;text></code></td><td>Purchase a megaphone shout for 20000 coins></td></tr>' +
  1674. '<tr><td><code>/paste</code></td><td>Show the emojis and text paste page</td></tr>' +
  1675. '<tr><td><code>/timer &lt;n></code></td><td>Set timer for &lt;n> minutes</td></tr>' +
  1676. '<tr><td><code>/timer &lt;n> h</code></td><td>Set timer for &lt;n> hours</td></tr>' +
  1677. '<tr><td><code>/timer stop</code></td><td>Stop the timer</td></tr>' +
  1678. '<tr><td><code>/xp</code></td><td>Send a chat message with your level and next level\'s progress</td></tr>' +
  1679. '<tr><td><code>/powerups</code></td><td>Send a chat message with your powerup amounts</td></tr>' +
  1680. '<tr><td><code>/fps</code></td><td>Send a chat message with current fps</td></tr>' +
  1681. '<tr><td><code>/ping</code></td><td>Send a chat message with current ping</td></tr>' +
  1682. '<tr><td><code>/online</code></td><td>For how long are you online in the current session?</td></tr>' +
  1683. '<tr><td><code>/alive</code></td><td>For how long are you alive?</td></tr>' +
  1684. '<tr><td><code>/solo</code></td><td>Show the solo server message</td></tr>' +
  1685. '<tr><td><code>/dice</code></td><td>Roll a dice with 6 sides</td></tr>' +
  1686. '<tr><td><code>/dice &lt;n></code></td><td>Roll a dice with &lt;n> sides</td></tr>' +
  1687. '<tr><td><code>/linesplit</code></td><td>Let your cell make a linesplit</td></tr>' +
  1688. '<tr><td><code>/waste</code></td><td>Waste all your mass</td></tr>' +
  1689. '<tr><td><code>/dance</code></td><td>Let your cell dance</td></tr>' +
  1690. '</table>';
  1691.  
  1692. $modal.append(helpText);
  1693.  
  1694. $modal.append($('<br><a href="#" class="miracle-primary-color-background" style="display: inline-block; margin-top: 20px; padding: 10px; color: white">Close</a>').click(function () {
  1695. $modal.hide();
  1696. }));
  1697.  
  1698. $('body').append($modal);
  1699.  
  1700. this.$helpModal = $modal;
  1701.  
  1702. window.addEventListener('miracleCommand', function(commandEvent) {
  1703. if (commandEvent.command === '/help' || commandEvent.command === '/miraclehelp') {
  1704. $('#chtbox').val('').focus();
  1705. $modal.show();
  1706. }
  1707. });
  1708. },
  1709.  
  1710. commands: function () {
  1711. var self = this;
  1712. var minutes, skinId;
  1713.  
  1714. var sessionStartedAt = Date.now();
  1715.  
  1716. $('#chtbox').keydown(function (event) {
  1717. if (event.keyCode === 13) {
  1718. var message = $('#chtbox').val();
  1719. var command = message.split(' ')[0];
  1720. var argument1 = message.split(' ')[1];
  1721. var argument2 = message.split(' ')[2];
  1722.  
  1723. if (message === 'time' || command === '/time' || command === '/localtime') {
  1724. var now = new Date();
  1725. $('#chtbox').val('Local time: ' + now.toLocaleString() + self.watermark).focus();
  1726. }
  1727.  
  1728. if (message === 'minutes' || command === '/minutes' || message === 'online' || command === '/online') {
  1729. if (message === 'minutes' || command === '/minutes') {
  1730. self.message('⛔ The /minutes command is deprecated, please use /online instead.', true);
  1731. }
  1732.  
  1733. minutes = parseInt((Date.now() - sessionStartedAt) / 1000 / 60);
  1734. if (minutes < 1) {
  1735. minutes = parseInt((Date.now() - self.spawnedAt) / 1000) + ' Seconds & 0';
  1736. }
  1737. if (minutes > 60) {
  1738. minutes = parseInt(minutes / 60) + ' Hours & ' + (minutes % 60);
  1739. }
  1740. $('#chtbox').val('is online for: ' + minutes + ' Minutes in the current session' + self.watermark).focus();
  1741. }
  1742.  
  1743. if (command === '/solo') {
  1744. $('#chtbox').val('⚠️⚠️⚠️ SOLO SERVER ⚠️⚠️⚠️ No teaming!! No hay equipo!! Pas d\'équipe!! Kein Teaming!!').focus();
  1745. }
  1746.  
  1747. if (command === '/miracle') {
  1748. var miracleInfo = 'is using 𝘔𝘪𝘳𝘢𝘤𝘭𝘦 𝘚𝘤𝘳𝘪𝘱𝘵𝘴, version ';
  1749.  
  1750. if (GM_info) {
  1751. miracleInfo += GM_info.script.version;
  1752. } else {
  1753. miracleInfo += 'unknown';
  1754. }
  1755.  
  1756. $('#chtbox').val(miracleInfo + self.watermark).focus();
  1757. }
  1758.  
  1759. if (command === '/skinid' || command === '/sayskin') {
  1760. var skinUri = self.getSkinUrl();
  1761. skinId = parseInt(skinUri.substr(skinUri.indexOf('skins/') + 6));
  1762. $('#chtbox').val('uses the skin with the ID ' + skinId + self.watermark);
  1763. return;
  1764. }
  1765.  
  1766. if (command === '/useskin') {
  1767. skinId = parseInt(argument1);
  1768. if (! (skinId > 0)) {
  1769. self.message('Invalid skin ID given. Example usage of command: /useskin 123', true);
  1770. } else {
  1771. self.useSkin(skinId);
  1772. }
  1773.  
  1774. $('#chtbox').val('');
  1775. }
  1776.  
  1777. if (command.substr(0, 4) === '/say' || (command === '/party' && argument1.substr(0, 4) === '/say') || (command === '/pm' && argument2.substr(0, 4) === '/say')) {
  1778. self.message('🚫 This feature has been removed since the Agma staff does not allow it', true);
  1779. $('#chtbox').val('');
  1780. }
  1781.  
  1782. if (command === '/dice') {
  1783. var max = (argument1 > 0) ? parseInt(argument1) : 6;
  1784. var number = self.getRandomInt(1, max);
  1785. $('#chtbox').val('rolled a dice with ' + max + ' sides. Result: ' + number + self.watermark);
  1786. }
  1787.  
  1788. if (command === '/powerups' || command === '/powers') {
  1789. // Note: If the amount of a powerup is 1, no number will be displayed.
  1790. var powerups = ($('#invRecombine p').text() || 0) + ' rec, ' +
  1791. ($('#invSpeed p').text() || ($('#invSpeed').css('display') === 'none' ? 0 : 1)) + ' speed, ' +
  1792. ($('#invGrowth p').text() || ($('#invGrowth').css('display') === 'none' ? 0 : 1)) + ' growth, ' +
  1793. ($('#invSpawnVirus p').text() || ($('#invSpawnVirus').css('display') === 'none' ? 0 : 1)) + ' virus, ' +
  1794. ($('#invSpawnMothercell p').text() || ($('#invSpawnMothercell').css('display') === 'none' ? 0 : 1)) + ' red virus, ' +
  1795. ($('#invSpawnPortal p').text() || ($('#invSpawnPortal').css('display') === 'none' ? 0 : 1)) + ' portal, ' +
  1796. ($('#invSpawnGoldOre p').text() || ($('#invSpawnGoldOre').css('display') === 'none' ? 0 : 1)) + ' block, ' +
  1797. ($('#invFreeze p').text() || ($('#invFreeze').css('display') === 'none' ? 0 : 1)) + ' freeze, ' +
  1798. ($('#inv360Shot p').text() || ($('#inv360Shot').css('display') === 'none' ? 0 : 1)) + ' push ';
  1799. $('#chtbox').val(self.watermark + 'has ' + powerups);
  1800. }
  1801.  
  1802. if (command === '/xp' || command === '/progress') {
  1803. var xp = parseInt($('.xpBarTop span').text());
  1804. var text = '█'.repeat(xp / 10) + '▒'.repeat(10 - parseInt(xp / 10)) + ' ' + xp + '%';
  1805. $('#chtbox').val('is currently level ' + $('#level2').text() + ' with ' + text + ' of the next level completed' + self.watermark);
  1806. }
  1807.  
  1808. if (command === '/megaphone' || command === '/megashout' || command === '/shout') {
  1809. // Notes: 1-7 = colors. The shout message can have max 130 chars, but chat messages can be only 100(?) chars long so np
  1810. self.warnBeforeMegaShout(message.substr(message.indexOf(' ') + 1), self.getRandomInt(1, 7));
  1811. $('#chtbox').val('');
  1812. }
  1813.  
  1814. var commandEvent = new Event('miracleCommand');
  1815. commandEvent.message = message;
  1816. commandEvent.command = command;
  1817. commandEvent.argument1 = argument1;
  1818. commandEvent.argument2 = argument2;
  1819. window.dispatchEvent(commandEvent);
  1820. }
  1821. });
  1822. },
  1823.  
  1824. /**
  1825. * True if currently a HTML text element is focused
  1826. */
  1827. isWritingText: function() {
  1828. return document.activeElement.type === 'text' || document.activeElement.type === 'password' || document.activeElement.type === 'textarea';
  1829. },
  1830.  
  1831. /**
  1832. * Let the browser download string data as a text file with a given filename.
  1833. */
  1834. download: function (filename, text) {
  1835. var element = document.createElement('a');
  1836. element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
  1837. element.setAttribute('download', filename);
  1838.  
  1839. element.style.display = 'none';
  1840. document.body.appendChild(element);
  1841.  
  1842. element.click();
  1843.  
  1844. document.body.removeChild(element);
  1845. },
  1846.  
  1847. /**
  1848. * Converts a version string (for example "1.5.7") to an integer (for example 1005007)
  1849. * If no string version is given, the current version of the script will be used.
  1850. */
  1851. getVersionAsInt: function(stringVersion) {
  1852. if (stringVersion === undefined) {
  1853. stringVersion = typeof GM_info !== 'undefined' ? GM_info.script.version : '0';
  1854. }
  1855.  
  1856. var parts = stringVersion.split('.');
  1857. if (parts.length === 1) {
  1858. parts.push('0');
  1859. }
  1860. if (parts.length === 2) {
  1861. parts.push('0');
  1862. }
  1863.  
  1864. return parseInt(parts[0]) * 1000000 + parseInt(parts[1]) * 1000 + parseInt(parts[2]);
  1865. },
  1866.  
  1867. /**
  1868. * Returns a random number between min and max (both inclusive)
  1869. * Source: MDN
  1870. */
  1871. getRandomInt: function (min, max) {
  1872. return Math.round(Math.random() * (max - min) + min);
  1873. },
  1874.  
  1875. /**
  1876. * Use the curser div to display a message at the top of the screen.
  1877. *
  1878. * @param message
  1879. * @param isError
  1880. */
  1881. message: function (message, isError) {
  1882. var curser = document.querySelector('#curser');
  1883.  
  1884. curser.textContent = message;
  1885. curser.style.display = 'block';
  1886. curser.style.color = isError ? 'rgb(255, 0, 0)' : 'rgb(0, 192, 0)';
  1887.  
  1888. window.setTimeout(function () {
  1889. curser.style.display = 'none';
  1890. }, 5000);
  1891. },
  1892.  
  1893. /**
  1894. * Show a sweet alert (modal/popup) with a given title and message.
  1895. */
  1896. swal: function (title, message, html) {
  1897. if (html === undefined) {
  1898. html = true;
  1899. }
  1900. window.swal({
  1901. title: '📢 <span class="miracle-primary-color-font">' + title + '</span>',
  1902. text: message,
  1903. html: html
  1904. });
  1905. },
  1906.  
  1907. /**
  1908. * Returns the URI of my skin or null if not skin has been set.
  1909. * Use this.skinUrl() to get it.
  1910. */
  1911. getSkinUrl: function(sourceSelector) {
  1912. if (sourceSelector === undefined) {
  1913. sourceSelector = '#skinExampleMenu';
  1914. }
  1915. var skinUrlRaw = $(sourceSelector).css('background-image');
  1916.  
  1917. var parts = skinUrlRaw.split('"');
  1918.  
  1919. if (parts.length !== 3) {
  1920. return null;
  1921. } else {
  1922. return parts[1];
  1923. }
  1924. },
  1925.  
  1926. /**
  1927. * Tries to pick a skin that is identified by its skin ID.
  1928. * Opens the skin menu, chooses the skin, and closes the menu again.
  1929. * The skin must be available for the current player (e.g. because it's a public one).
  1930. */
  1931. useSkin: function(skinId) {
  1932. window.azad(true);
  1933.  
  1934. setTimeout(function () {
  1935. $('#skinExampleMenu').click();
  1936.  
  1937. var checkLoaded = function () {
  1938. var loaded = ($('#skinsFree tr').length > 1);
  1939. if (loaded) {
  1940. window.toggleSkin(skinId);
  1941.  
  1942. setTimeout(function () {
  1943. $('#shopModalDialog button.close').click();
  1944.  
  1945. setTimeout(function () {
  1946. window.setNick(document.getElementById('nick').value);
  1947. }, 200);
  1948. }, 200);
  1949. } else {
  1950. setTimeout(checkLoaded, 300);
  1951. }
  1952. };
  1953. checkLoaded();
  1954. }, 200);
  1955. },
  1956.  
  1957. /**
  1958. * This is an original Agma function but the original is not accessible - so this is a copy.
  1959. */
  1960. warnBeforeMegaShout: function(msg, color) {
  1961. swal({
  1962. title: "Confirm",
  1963. text: 'If you click "Buy", you will purchase the megaphone shout.',
  1964. type: "warning",
  1965. showCancelButton: true,
  1966. confirmButtonColor: "#4CAF50",
  1967. confirmButtonText: "Yes, confirm purchase",
  1968. cancelButtonText: "No, cancel purchase"
  1969. }, function() {
  1970. //Confirm purchase
  1971. //console.log('purchased megaphone');
  1972. purchaseMega(msg,color);
  1973. //window.location.href = linkURL;
  1974. });
  1975. },
  1976.  
  1977. setupPolyfills: function() {
  1978. // Polyfill for old browser so they have String.fromCodePoint()
  1979. if (!String.fromCodePoint) (function(stringFromCharCode) {
  1980. var fromCodePoint = function(_) {
  1981. var codeUnits = [], codeLen = 0, result = "";
  1982. for (var index=0, len = arguments.length; index !== len; ++index) {
  1983. var codePoint = +arguments[index];
  1984. // correctly handles all cases including `NaN`, `-Infinity`, `+Infinity`
  1985. // The surrounding `!(...)` is required to correctly handle `NaN` cases
  1986. // The (codePoint>>>0) === codePoint clause handles decimals and negatives
  1987. if (!(codePoint < 0x10FFFF && (codePoint>>>0) === codePoint))
  1988. throw RangeError("Invalid code point: " + codePoint);
  1989. if (codePoint <= 0xFFFF) { // BMP code point
  1990. codeLen = codeUnits.push(codePoint);
  1991. } else { // Astral code point; split in surrogate halves
  1992. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  1993. codePoint -= 0x10000;
  1994. codeLen = codeUnits.push(
  1995. (codePoint >> 10) + 0xD800, // highSurrogate
  1996. (codePoint % 0x400) + 0xDC00 // lowSurrogate
  1997. );
  1998. }
  1999. if (codeLen >= 0x3fff) {
  2000. result += stringFromCharCode.apply(null, codeUnits);
  2001. codeUnits.length = 0;
  2002. }
  2003. }
  2004. return result + stringFromCharCode.apply(null, codeUnits);
  2005. };
  2006. try { // IE 8 only supports `Object.defineProperty` on DOM elements
  2007. Object.defineProperty(String, "fromCodePoint", {
  2008. "value": fromCodePoint, "configurable": true, "writable": true
  2009. });
  2010. } catch(e) {
  2011. String.fromCodePoint = fromCodePoint;
  2012. }
  2013. }(String.fromCharCode));
  2014. },
  2015. };
  2016.  
  2017. window.miracleScripts.init();
  2018. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址