· 6 years ago · Oct 21, 2019, 05:48 AM
1// ==UserScript==
2// @name Ultimate piano script
3// @namespace http://tampermonkey.net/
4// @version 0.1
5// @description try to take over the world!
6// @author You
7// @match http://*/*
8// @grant none
9// ==/UserScript==
10
11(function() {
12 'use strict';
13
14 // Your code here...
15 milar(part.name.toLowerCase(), target.toLowerCase(), 1) >= 60) {
16 return part;
17 break;
18 }
19 }
20}
21
22var z = 0;
23var follow = setInterval(function () {
24 if (following) {
25 for (var _id in MPP.client.ppl) {
26 if (!MPP.client.ppl.hasOwnProperty(_id)) continue; //if the id is yours do not follow yourself
27 var part = MPP.client.ppl[_id];
28 if (!followId) return;
29 if (part._id === followId) { //follows only that ID
30 var angle = (z) * (Math.PI/fDegree);
31 MPP.client.sendArray([{
32 m: "m",
33 x: part.x + Math.sin(angle)*fRadius,
34 y: part.y + Math.cos(angle)*fRadius
35 }]);
36 z += fSpeed;
37 }
38 }
39 }
40}, 1);
41
42// functions end //
43
44// midi btn
45$("body #bottom .relative").append('<div id="blah-btn" class="ugly-button blah_btn" style="position: absolute;bottom: 25px;right: 832px;width: 100px"; title="Creates a new lobby">New Lobby...</div>');
46
47 $.getScript("https://ledlamp.github.io/electrashave-sound-selector/Sounds.js")
48
49// event listners start //
50
51window.addEventListener("beforeunload", function(event) {
52 if (closeCheck) {
53 event.returnValue = "If you wish to stop this confirmation message when you close/refresh the page search for \"closeCheck\" in the script and set this to false.";
54 }
55});
56// event listners end //
57
58$(function () {
59
60 var test_mode = (window.location.hash && window.location.hash.match(/^(?:#.+)*#test(?:#.+)*$/i));
61
62 //var gSeeOwnCursor = (window.location.hash && window.location.hash.match(/^(?:#.+)*#seeowncursor(?:#.+)*$/i));
63 //var lSeeOwnCursor = true; //silly
64
65 var gMidiOutTest = (window.location.hash && window.location.hash.match(/^(?:#.+)*#midiout(?:#.+)*$/i));
66
67 if (!Array.prototype.indexOf) {
68 Array.prototype.indexOf = function (elt) {
69 var len = this.length >>> 0;
70 var from = Number(arguments[1]) || 0;
71 from = (from < 0) ? Math.ceil(from) : Math.floor(from);
72 if (from < 0) from += len;
73 for (; from < len; from++) {
74 if (from in this && this[from] === elt) return from;
75 }
76 return -1;
77 };
78 }
79
80 window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function (cb) {
81 setTimeout(cb, 1000 / 30); //60
82 };
83
84 //thanks electrashave!
85 function msgBox(about, info, duration, target) {
86 window.gAlert = new Notification({
87 title: about,
88 html: info,
89 target: target,
90 duration: duration
91 });
92 }
93
94 setCmdChar = function() {
95 var promptChar = prompt('Enter a new symbol to be used for commands. (currently ' + cmdChar + ')', cmdChar);
96 cmdChar = promptChar.substring(0,1).toLowerCase();
97 msgBox('CMD symbol set to', ''+cmdChar, 2000, '#piano');
98 };
99
100
101
102 var DEFAULT_VELOCITY = 0.5;
103
104
105
106
107 var TIMING_TARGET = 1000;
108
109
110
111
112 // Utility
113
114 ////////////////////////////////////////////////////////////////
115
116
117
118 var Rect = function (x, y, w, h) {
119 this.x = x;
120 this.y = y;
121 this.w = w;
122 this.h = h;
123 this.x2 = x + w;
124 this.y2 = y + h;
125 };
126 Rect.prototype.contains = function (x, y) {
127 return (x >= this.x && x <= this.x2 && y >= this.y && y <= this.y2);
128 };
129
130 // performing translation
131
132 ////////////////////////////////////////////////////////////////
133
134 var Translation = (function () {
135 var strings = {
136 "people are playing": {
137 "pt": "pessoas est√£o jogando",
138 "es": "personas est√°n jugando",
139 "ru": "—á–µ–ª–æ–≤–µ–∫ –∏–≥—Ä–∞–µ—Ç",
140 "fr": "personnes jouent",
141 "ja": "人が遊んでいる",
142 "de": "Leute spielen",
143 "zh": "人被打",
144 "nl": "mensen spelen",
145 "pl": "osób grają",
146 "hu": "ember j√°tszik"
147 },
148 "New Room...": {
149 "pt": "Nova Sala ...",
150 "es": "Nueva sala de...",
151 "ru": "–ù–æ–≤—ã–π –Ω–æ–º–µ—Ä...",
152 "ja": "新しい部屋",
153 "zh": "新房间",
154 "nl": "nieuwe Kamer",
155 "hu": "√∫j szoba"
156 },
157 "room name": {
158 "pt": "nome da sala",
159 "es": "sala de nombre",
160 "ru": "–Ω–∞–∑–≤–∞–Ω–∏–µ –∫–æ–º–Ω–∞—Ç—ã",
161 "fr": "nom de la chambre",
162 "ja": "ルーム名",
163 "de": "Raumnamen",
164 "zh": "房间名称",
165 "nl": "kamernaam",
166 "pl": "nazwa pokój",
167 "hu": "szoba neve"
168 },
169 "Visible (open to everyone)": {
170 "pt": "Visível (aberto a todos)",
171 "es": "Visible (abierto a todo el mundo)",
172 "ru": "Visible (–æ—Ç–∫—Ä—ã—Ç—ã–π –¥–ª—è –≤—Å–µ—Ö)",
173 "fr": "Visible (ouvert à tous)",
174 "ja": "目に見える(誰にでも開いている)",
175 "de": "Sichtbar (offen für alle)",
176 "zh": "可见(向所有人开放)",
177 "nl": "Zichtbaar (open voor iedereen)",
178 "pl": "Widoczne (otwarte dla wszystkich)",
179 "hu": "Látható (nyitott mindenki számára)"
180 },
181 "Enable Chat": {
182 "pt": "Ativar bate-papo",
183 "es": "Habilitar chat",
184 "ru": "–í–∫–ª—é—á–∏—Ç—å —á–∞—Ç",
185 "fr": "Activer discuter",
186 "ja": "チャットを有効にする",
187 "de": "aktivieren Sie chatten",
188 "zh": "启用聊天",
189 "nl": "Chat inschakelen",
190 "pl": "Włącz czat",
191 "hu": "a csevegést"
192 }
193 // todo: it, tr, th, sv, ar, fi, nb, da, sv, he, cs, ko, ro, vi, id, nb, el, sk, bg, lt, sl, hr
194 // todo: Connecting, Offline mode, input placeholder, Notifications
195 };
196
197 var setLanguage = function (lang) {
198 language = lang
199 };
200
201 var getLanguage = function () {
202 if (window.navigator && navigator.language && navigator.language.length >= 2) {
203 return navigator.language.substr(0, 2).toLowerCase();
204 } else {
205 return "en";
206 }
207 };
208
209 var get = function (text, lang) {
210 if (typeof lang === "undefined") lang = language;
211 var row = strings[text];
212 if (row == undefined) return text;
213 var string = row[lang];
214 if (string == undefined) return text;
215 return string;
216 };
217
218 var perform = function (lang) {
219 if (typeof lang === "undefined") lang = language;
220 $(".translate").each(function (i, ele) {
221 var th = $(this);
222 if (ele.tagName && ele.tagName.toLowerCase() == "input") {
223 if (typeof ele.placeholder != "undefined") {
224 th.attr("placeholder", get(th.attr("placeholder"), lang))
225 }
226 } else {
227 th.text(get(th.text(), lang));
228 }
229 });
230 };
231
232 var language = getLanguage();
233
234 return {
235 setLanguage: setLanguage,
236 getLanguage: getLanguage,
237 get: get,
238 perform: perform
239 };
240 })();
241
242 Translation.perform();
243
244
245
246
247 // AudioEngine classes
248
249 ////////////////////////////////////////////////////////////////
250
251 var AudioEngine = function () {};
252
253 AudioEngine.prototype.init = function (cb) {
254 this.volume = 0.6;
255 this.sounds = {};
256 return this;
257 };
258
259 AudioEngine.prototype.load = function (id, url, cb) {};
260
261 AudioEngine.prototype.play = function () {};
262
263 AudioEngine.prototype.stop = function () {};
264
265 AudioEngine.prototype.setVolume = function (vol) {
266 this.volume = vol;
267 };
268
269
270 AudioEngineSM2 = function () {};
271
272 AudioEngineSM2.prototype = new AudioEngine();
273
274 AudioEngineSM2.prototype.init = function (cb) {
275 AudioEngine.prototype.init.call(this);
276
277 window.SM2_DEFER = true;
278 var script = document.createElement("script");
279 script.src = "/soundmanager2/soundmanager2.js";
280
281 var loaded = false;
282 script.onload = function () {
283 if (loaded) return;
284 if (typeof SoundManager === "undefined") {
285 setTimeout(script.onload, 4000);
286 return;
287 }
288 loaded = true;
289
290 //sound manager settings
291 window.soundManager = new SoundManager();
292 soundManager.url = "/soundmanager2/";
293 soundManager.debugMode = test_mode ? true : false;
294 soundManager.useHTML5Audio = false;
295 soundManager.flashVersion = 9;
296 soundManager.multiShot = true;
297 soundManager.useHighPerformance = true;
298 soundManager.beginDelayedInit();
299 if (cb) soundManager.onready(cb);
300 };
301 setTimeout(script.onload, 4000);
302
303 document.body.appendChild(script);
304 return this;
305 };
306
307 AudioEngineSM2.prototype.load = function (id, url, cb) {
308 this.sounds[id] = soundManager.createSound({
309 id: id,
310 url: url,
311 autoLoad: true,
312 volume: this.volume,
313 onload: cb
314 });
315 };
316
317 AudioEngineSM2.prototype.play = function (id, vol, delay_ms) {
318 var self = this;
319 setTimeout(function () {
320 soundManager.play(id, {
321 volume: self.volume * 100.0
322 });
323 }, delay_ms);
324 };
325
326 AudioEngineSM2.prototype.setVolume = function (vol) {
327 AudioEngine.prototype.setVolume.call(this, vol);
328 for (var i in this.sounds) {
329 if (this.sounds.hasOwnProperty(i)) {
330 this.sounds[i].setVolume(this.volume * 100.0);
331 }
332 }
333 };
334
335
336 AudioEngineWeb = function () {};
337
338 AudioEngineWeb.prototype = new AudioEngine();
339
340 AudioEngineWeb.prototype.init = function (cb) {
341 AudioEngine.prototype.init.call(this);
342 this.context = new AudioContext();
343 this.gainNode = this.context.createGain();
344 this.gainNode.connect(this.context.destination);
345 this.gainNode.gain.value = this.volume;
346 this.playings = {};
347 if (cb) setTimeout(cb, 0);
348 return this;
349 };
350
351 AudioEngineWeb.prototype.load = function (id, url, cb) {
352 var audio = this;
353 var req = new XMLHttpRequest();
354 req.open("GET", url);
355 req.responseType = "arraybuffer";
356 req.addEventListener("readystatechange", function (evt) {
357 if (req.readyState !== 4) return;
358 try {
359 audio.context.decodeAudioData(req.response, function (buffer) {
360 audio.sounds[id] = buffer;
361 if (cb) cb();
362 });
363 } catch (e) { //was commented
364 throw new Error(e.message
365 + " / id: " + id
366 + " / url: " + url
367 + " / status: " + req.status
368 + " / ArrayBuffer: " + (req.response instanceof ArrayBuffer)
369 + " / byteLength: " + (req.response && req.response.byteLength ? req.response.byteLength : "undefined"));
370 //was commented
371 new Notification({
372 id: "audio-download-error",
373 title: "Problem",
374 text: "For some reason, an audio download failed with a status of " + req.status + ". " + " I blame antivirus software.",
375 target: "#piano",
376 duration: 10000
377 });
378 }
379 });
380 req.send();
381 };
382
383 AudioEngineWeb.prototype.play = function (id, vol, delay_ms, part_id) {
384 if (!this.sounds.hasOwnProperty(id)) return;
385 var time = this.context.currentTime + (delay_ms / 1000);
386 var source = this.context.createBufferSource();
387 source.buffer = this.sounds[id];
388 var gain = this.context.createGain();
389 gain.gain.value = vol;
390 source.connect(gain);
391 gain.connect(this.gainNode);
392 source.start(time);
393 // Patch from ste-art remedies stuttering under heavy load
394 if (this.playings[id]) {
395 var playing = this.playings[id];
396 playing.gain.gain.setValueAtTime(playing.gain.gain.value, time);
397 playing.gain.gain.linearRampToValueAtTime(0.0, time + 0.1);
398 playing.source.stop(time + 0.1);
399 /*playing.gain.gain.linearRampToValueAtTime(0.0, time + 0.5); //Ray's fix for single notes being pressed multiple times
400 playing.source.stop(time + 0.6);*/
401 }
402 this.playings[id] = {
403 "source": source,
404 "gain": gain,
405 "part_id": part_id
406 };
407 };
408
409 AudioEngineWeb.prototype.stop = function (id, delay_ms, part_id) {
410 if (this.playings.hasOwnProperty(id) && this.playings[id] && this.playings[id].part_id === part_id) {
411 var time = this.context.currentTime + (delay_ms / 1000);
412 var gain = this.playings[id].gain.gain;
413 gain.setValueAtTime(gain.value, time);
414 gain.linearRampToValueAtTime(gain.value * 0.1, time + 0.16);
415 gain.linearRampToValueAtTime(0.0, time + 1.9);
416 this.playings[id].source.stop(time + 2.0);
417 this.playings[id] = null;
418 }
419 };
420
421 AudioEngineWeb.prototype.setVolume = function (vol) {
422 AudioEngine.prototype.setVolume.call(this, vol);
423 this.gainNode.gain.value = this.volume;
424 };
425
426
427
428
429 // VolumeSlider inst
430
431 ////////////////////////////////////////////////////////////////
432
433 var VolumeSlider = function (ele, cb) {
434 this.rootElement = ele;
435 this.cb = cb;
436 var range = document.createElement("input");
437 try {
438 range.type = "range";
439 } catch (e) {
440 // Hello, IE9
441 }
442 if (range.min !== undefined) {
443 this.range = range;
444 this.rootElement.appendChild(range);
445 range.className = "volume-slider"; //volume settings
446 range.min = "0.0";
447 range.max = "1.0";
448 range.step = "0.01";
449 $(range).on("change", function (evt) {
450 cb(range.value);
451 });
452 } else {
453 if (window.console) console.warn("Warning: for some stupid reason there's no volume-slider");
454 // todo
455 }
456 };
457
458 VolumeSlider.prototype.set = function (v) {
459 if (this.range !== undefined) {
460 this.range.value = v;
461 } else {
462 // todo
463 }
464 };
465
466
467
468
469 // Renderer classes
470
471 ////////////////////////////////////////////////////////////////
472
473 var Renderer = function () {};
474
475 Renderer.prototype.init = function (piano) {
476 this.piano = piano;
477 this.resize();
478 return this;
479 };
480
481 Renderer.prototype.resize = function (width, height) {
482 if (typeof width == "undefined") width = $(this.piano.rootElement).width();
483 if (typeof height == "undefined") height = Math.floor(width * 0.2);
484 $(this.piano.rootElement).css({
485 "height": height + "px",
486 marginTop: Math.floor($(window).height() / 2 - height / 2) + "px"
487 });
488 this.width = width;
489 this.height = height;
490 };
491
492 Renderer.prototype.visualize = function (key, color) {};
493
494
495
496
497 var DOMRenderer = function () {
498 Renderer.call(this);
499 };
500
501 DOMRenderer.prototype = new Renderer();
502
503 DOMRenderer.prototype.init = function (piano) {
504 // create keys in dom
505 for (var i in piano.keys) {
506 if (!piano.keys.hasOwnProperty(i)) continue;
507 var key = piano.keys[i];
508 var ele = document.createElement("div");
509 key.domElement = ele;
510 piano.rootElement.appendChild(ele);
511 // "key sharp cs cs2"
512 ele.note = key.note;
513 ele.id = key.note;
514 ele.className = "key " + (key.sharp ? "sharp " : " ") + key.baseNote + " " + key.note + " loading";
515 var table = $('<table width="100%" height="100%" style="pointer-events:none"></table>');
516 var td = $('<td valign="bottom"></td>');
517 table.append(td);
518 td.valign = "bottom";
519 $(ele).append(table);
520 }
521 // add event listeners
522 var mouse_down = false;
523 $(piano.rootElement).mousedown(function (event) {
524 // todo: IE10 doesn't support the pointer-events css rule on the "blips"
525 var ele = event.target;
526 if ($(ele).hasClass("key") && piano.keys.hasOwnProperty(ele.note)) {
527 var key = piano.keys[ele.note];
528 press(key.note);
529 mouse_down = true;
530 event.stopPropagation();
531 };
532 //event.preventDefault();
533 });
534 piano.rootElement.addEventListener("touchstart", function (event) {
535 for (var i in event.changedTouches) {
536 var ele = event.changedTouches[i].target;
537 if ($(ele).hasClass("key") && piano.keys.hasOwnProperty(ele.note)) {
538 var key = piano.keys[ele.note];
539 press(key.note);
540 mouse_down = true;
541 event.stopPropagation();
542 }
543 }
544 //event.preventDefault();
545 }, false);
546 $(window).mouseup(function (event) {
547 mouse_down = false;
548 });
549
550 Renderer.prototype.init.call(this, piano);
551 return this;
552 };
553
554 DOMRenderer.prototype.resize = function (width, height) {
555 Renderer.prototype.resize.call(this, width, height);
556 };
557
558 DOMRenderer.prototype.visualize = function (key, color) { //mess with Logan
559 var k = $(key.domElement);
560 k.addClass("play");
561 setTimeout(function () {
562 k.removeClass("play");
563 }, 100);
564 // "blips"
565 var d = $('<div style="width:100%;height:10%;margin:0;padding:0"> </div>');
566 d.css("background", color);
567 k.find("td").append(d);
568 d.fadeOut(1000, function () {
569 d.remove();
570 });
571 };
572
573
574
575
576 var CanvasRenderer = function () {
577 Renderer.call(this);
578 };
579
580 CanvasRenderer.prototype = new Renderer();
581
582 CanvasRenderer.prototype.init = function (piano) {
583 this.canvas = document.createElement("canvas");
584 this.ctx = this.canvas.getContext("2d");
585 piano.rootElement.appendChild(this.canvas);
586
587 Renderer.prototype.init.call(this, piano); // calls resize()
588
589 // create render loop
590 var self = this;
591 var render = function () {
592 self.redraw();
593 requestAnimationFrame(render);
594 };
595 requestAnimationFrame(render);
596
597 // add event listeners
598 var mouse_down = false;
599 var last_key = null;
600 $(piano.rootElement).mousedown(function(event) {
601 mouse_down = true;
602 event.preventDefault();
603
604 var pos = CanvasRenderer.translateMouseEvent(event);
605 var hit = self.getHit(pos.x, pos.y);
606 if(hit) {
607 press(hit.key.note, volume);
608 last_key = hit.key;
609 }
610 });
611 piano.rootElement.addEventListener("touchstart", function (event) { //mess with Logan
612 mouse_down = true;
613 event.preventDefault();
614 for (var i in event.changedTouches) {
615 var pos = CanvasRenderer.translateMouseEvent(event);
616 var hit = self.getHit(pos.x, pos.y);
617 if (hit) {
618 last_key = hit.key;
619 }
620 }
621 }, false);
622 $(window).mouseup(function (event) {
623 if (last_key) {
624 release(last_key.note);
625 }
626 mouse_down = false;
627 last_key = null;
628 });
629 $(piano.rootElement).mousemove(function(event) { //enables you to hold mouse and drag across notes.
630 if(!mouse_down) return;
631 var pos = CanvasRenderer.translateMouseEvent(event);
632 var hit = self.getHit(pos.x, pos.y);
633 if(hit && hit.key != last_key) {
634 press(hit.key.note, volume);
635 last_key = hit.key;
636 release(last_key.note); //fix for sustain ignoring mouse being dragged across keys -Logan
637 }
638 });
639
640 return this;
641 };
642
643 CanvasRenderer.prototype.resize = function (width, height) {
644 Renderer.prototype.resize.call(this, width, height);
645 if (this.width < 52 * 2) this.width = 52 * 2;
646 if (this.height < this.width * 0.2) this.height = Math.floor(this.width * 0.2);
647 this.canvas.width = this.width;
648 this.canvas.height = this.height;
649
650 // calculate key sizes
651 this.whiteKeyWidth = Math.floor(this.width / 52);
652 this.whiteKeyHeight = Math.floor(this.height * 0.9);
653 this.blackKeyWidth = Math.floor(this.whiteKeyWidth * 0.75);
654 this.blackKeyHeight = Math.floor(this.height * 0.5);
655
656 this.blackKeyOffset = Math.floor(this.whiteKeyWidth - (this.blackKeyWidth / 2));
657 this.keyMovement = Math.floor(this.whiteKeyHeight * 0.015);
658
659 this.whiteBlipWidth = Math.floor(this.whiteKeyWidth * 0.7);
660 this.whiteBlipHeight = Math.floor(this.whiteBlipWidth * 0.8);
661 this.whiteBlipX = Math.floor((this.whiteKeyWidth - this.whiteBlipWidth) / 2);
662 this.whiteBlipY = Math.floor(this.whiteKeyHeight - this.whiteBlipHeight * 1.2);
663 this.blackBlipWidth = Math.floor(this.blackKeyWidth * 0.7);
664 this.blackBlipHeight = Math.floor(this.blackBlipWidth * 0.8);
665 this.blackBlipY = Math.floor(this.blackKeyHeight - this.blackBlipHeight * 1.2);
666 this.blackBlipX = Math.floor((this.blackKeyWidth - this.blackBlipWidth) / 2);
667
668 // prerender white key
669 this.whiteKeyRender = document.createElement("canvas");
670 this.whiteKeyRender.width = this.whiteKeyWidth;
671 this.whiteKeyRender.height = this.height + 10;
672 var ctx = this.whiteKeyRender.getContext("2d");
673 if (ctx.createLinearGradient) {
674 var gradient = ctx.createLinearGradient(0, 0, 0, this.whiteKeyHeight);
675 gradient.addColorStop(0, "#eee");
676 gradient.addColorStop(0.35, "#fff");
677 gradient.addColorStop(1, "#dad4d4");
678 ctx.fillStyle = gradient;
679 } else {
680 ctx.fillStyle = "#fff";
681 }
682 ctx.strokeStyle = "#000";
683 ctx.lineJoin = "round";
684 ctx.lineCap = "round";
685 ctx.lineWidth = 10;
686 ctx.strokeRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.whiteKeyWidth - ctx.lineWidth, this.whiteKeyHeight - ctx.lineWidth);
687 ctx.lineWidth = 2.5; //4 - shadow between the white keys
688 ctx.fillRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.whiteKeyWidth - ctx.lineWidth, this.whiteKeyHeight - ctx.lineWidth);
689
690 // prerender black key
691 this.blackKeyRender = document.createElement("canvas");
692 this.blackKeyRender.width = this.blackKeyWidth + 10;
693 this.blackKeyRender.height = this.blackKeyHeight + 10;
694 var ctx = this.blackKeyRender.getContext("2d");
695 if (ctx.createLinearGradient) {
696 var gradient = ctx.createLinearGradient(0, 0, 0, this.blackKeyHeight);
697 gradient.addColorStop(0, "#000");
698 gradient.addColorStop(1, "#444");
699 ctx.fillStyle = gradient;
700 } else {
701 ctx.fillStyle = "#000";
702 }
703 ctx.strokeStyle = "#222";
704 ctx.lineJoin = "round";
705 ctx.lineCap = "round";
706 ctx.lineWidth = 8;
707 ctx.strokeRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.blackKeyWidth - ctx.lineWidth, this.blackKeyHeight - ctx.lineWidth);
708 ctx.lineWidth = 4;
709 ctx.fillRect(ctx.lineWidth / 2, ctx.lineWidth / 2, this.blackKeyWidth - ctx.lineWidth, this.blackKeyHeight - ctx.lineWidth);
710
711 // prerender shadows
712 this.shadowRender = [];
713 var y = -this.canvas.height * 2;
714 for (var j = 0; j < 2; j++) {
715 var canvas = document.createElement("canvas");
716 this.shadowRender[j] = canvas;
717 canvas.width = this.canvas.width;
718 canvas.height = this.canvas.height;
719 var ctx = canvas.getContext("2d");
720 var sharp = j ? true : false;
721 ctx.lineJoin = "round";
722 ctx.lineCap = "round";
723 ctx.lineWidth = 1;
724 ctx.shadowColor = "rgba(0, 0, 0, 0.5)";
725 ctx.shadowBlur = this.keyMovement * 3;
726 ctx.shadowOffsetY = -y + this.keyMovement;
727 if (sharp) {
728 ctx.shadowOffsetX = this.keyMovement;
729 } else {
730 ctx.shadowOffsetX = 0;
731 ctx.shadowOffsetY = -y + this.keyMovement;
732 }
733 for (var i in this.piano.keys) {
734 if (!this.piano.keys.hasOwnProperty(i)) continue;
735 var key = this.piano.keys[i];
736 if (key.sharp != sharp) continue;
737
738 if (key.sharp) {
739 ctx.fillRect(this.blackKeyOffset + this.whiteKeyWidth * key.spatial + ctx.lineWidth / 2,
740 y + ctx.lineWidth / 2,
741 this.blackKeyWidth - ctx.lineWidth, this.blackKeyHeight - ctx.lineWidth);
742 } else {
743 ctx.fillRect(this.whiteKeyWidth * key.spatial + ctx.lineWidth / 2,
744 y + ctx.lineWidth / 2,
745 this.whiteKeyWidth - ctx.lineWidth, this.whiteKeyHeight - ctx.lineWidth);
746 }
747 }
748 }
749
750 // update key rects
751 for (var i in this.piano.keys) {
752 if (!this.piano.keys.hasOwnProperty(i)) continue;
753 var key = this.piano.keys[i];
754 if (key.sharp) {
755 key.rect = new Rect(this.blackKeyOffset + this.whiteKeyWidth * key.spatial, 0,
756 this.blackKeyWidth, this.blackKeyHeight);
757 } else {
758 key.rect = new Rect(this.whiteKeyWidth * key.spatial, 0,
759 this.whiteKeyWidth, this.whiteKeyHeight);
760 }
761 }
762 };
763
764 CanvasRenderer.prototype.visualize = function (key, color) {
765 key.timePlayed = Date.now();
766 key.blips.push({
767 "time": key.timePlayed,
768 "color": color
769 });
770 };
771
772 CanvasRenderer.prototype.redraw = function () {
773 var now = Date.now();
774 var timeLoadedEnd = now - 1000;
775 var timePlayedEnd = now - 100;
776 var timeBlipEnd = now - 1000;
777
778 this.ctx.save();
779 this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
780 // draw all keys
781 for (var j = 0; j < 2; j++) {
782 this.ctx.globalAlpha = 1.0; //unloaded keys colour
783 this.ctx.drawImage(this.shadowRender[j], 0, 0);
784 var sharp = j ? true : false;
785 for (var i in this.piano.keys) {
786 if (!this.piano.keys.hasOwnProperty(i)) continue;
787 var key = this.piano.keys[i];
788 if (key.sharp != sharp) continue;
789
790 if (!key.loaded) {
791 this.ctx.globalAlpha = 0.2;
792 } else if (key.timeLoaded > timeLoadedEnd) {
793 this.ctx.globalAlpha = ((now - key.timeLoaded) / 1000) * 0.8 + 0.2;
794 } else {
795 this.ctx.globalAlpha = 1.0;
796 }
797 var y = 0;
798 if (key.timePlayed > timePlayedEnd) {
799 y = Math.floor(this.keyMovement - (((now - key.timePlayed) / 100) * this.keyMovement));
800 }
801 var x = Math.floor(key.sharp ? this.blackKeyOffset + this.whiteKeyWidth * key.spatial : this.whiteKeyWidth * key.spatial);
802 var image = key.sharp ? this.blackKeyRender : this.whiteKeyRender;
803 this.ctx.drawImage(image, x, y);
804
805 // render blips
806 if (key.blips.length) {
807 var alpha = this.ctx.globalAlpha;
808 var w, h;
809 if (key.sharp) {
810 x += this.blackBlipX;
811 y = this.blackBlipY;
812 w = this.blackBlipWidth;
813 h = this.blackBlipHeight;
814 } else {
815 x += this.whiteBlipX;
816 y = this.whiteBlipY;
817 w = this.whiteBlipWidth;
818 h = this.whiteBlipHeight;
819 }
820 for (var b = 0; b < key.blips.length; b++) {
821 var blip = key.blips[b];
822 if (blip.time > timeBlipEnd) {
823 this.ctx.fillStyle = blip.color;
824 this.ctx.globalAlpha = alpha - ((now - blip.time) / 1000);
825 this.ctx.fillRect(x, y, w, h);
826 } else {
827 key.blips.splice(b, 1);
828 --b;
829 }
830 y -= Math.floor(h * 1.1); //blips space apart
831 }
832 }
833 }
834 }
835 this.ctx.restore();
836 };
837
838 CanvasRenderer.prototype.getHit = function (x, y) {
839 for (var j = 0; j < 2; j++) {
840 var sharp = j ? false : true; // black keys first
841 for (var i in this.piano.keys) {
842 if (!this.piano.keys.hasOwnProperty(i)) continue;
843 var key = this.piano.keys[i];
844 if (key.sharp != sharp) continue;
845 if (key.rect.contains(x, y)) {
846 var v = y / (key.sharp ? this.blackKeyHeight : this.whiteKeyHeight);
847 v += 0.25;
848 v *= DEFAULT_VELOCITY;
849 if (v > 1.0) v = 1.0;
850 return {
851 "key": key,
852 "v": v
853 };
854 }
855 }
856 }
857 return null;
858 };
859
860
861 CanvasRenderer.isSupported = function () {
862 var canvas = document.createElement("canvas");
863 return !!(canvas.getContext && canvas.getContext("2d"));
864 };
865
866 CanvasRenderer.translateMouseEvent = function (evt) {
867 var element = evt.target;
868 var offx = 0;
869 var offy = 0;
870 do {
871 offx += element.offsetLeft;
872 offy += element.offsetTop;
873 } while (element = element.offsetParent);
874 return {
875 x: evt.pageX - offx,
876 y: evt.pageY - offy
877 }
878 };
879
880
881
882
883 // Pianoctor
884
885 ////////////////////////////////////////////////////////////////
886
887 var PianoKey = function(note, octave, num) {
888 this.note = note + octave;
889 this.baseNote = note;
890 this.octave = octave;
891 this.sharp = note.indexOf("s") != -1;
892 this.loaded = false;
893 this.timeLoaded = 0;
894 this.domElement = null;
895 this.timePlayed = 0;
896 this.blips = [];
897 this.num = num; //Ltranspose
898 };
899
900 var Piano = function (rootElement) {
901
902 var piano = this;
903 piano.rootElement = rootElement;
904 piano.keys = {};
905
906 var white_spatial = 0;
907 var black_spatial = 0;
908 var black_it = 0;
909 var black_lut = [2, 1, 2, 1, 1];
910 var addKey = function(note, octave, num) {
911 var key = new PianoKey(note, octave, num);
912 piano.keys[key.note] = key;
913 if (key.sharp) {
914 key.spatial = black_spatial;
915 black_spatial += black_lut[black_it % 5];
916 ++black_it;
917 } else {
918 key.spatial = white_spatial;
919 ++white_spatial;
920 }
921 }
922 if (test_mode) { //Logan check!
923 addKey("c", 2);
924
925 } else {
926 addKey("a", -1, 1);
927 addKey("as", -1, 2);
928 addKey("b", -1, 3);
929 var notes = "c cs d ds e f fs g gs a as b".split(" ");
930 var count = 4;
931
932 for(var oct = 0; oct < 7; oct++) {
933 for(var i in notes) {
934 addKey(notes[i], oct, count);
935 count++;
936 }
937 }
938 addKey("c", 7); //default key
939 addKey("cs", 7); //extra key
940 addKey("d", 7); //extra key
941 addKey("ds", 7); //extra key
942 addKey("e", 7); //extra key
943
944 }
945
946
947 var render_engine = CanvasRenderer.isSupported() ? CanvasRenderer : DOMRenderer;
948 this.renderer = new render_engine().init(this);
949
950 $(window).resize(function () {
951 piano.renderer.resize();
952 });
953
954
955 window.AudioContext = window.AudioContext || window.webkitAudioContext || undefined;
956 var audio_engine = (window.AudioContext === undefined) ? AudioEngineSM2 : AudioEngineWeb;
957
958 // Firefox 25 supports WebAudio, but a decodeAudioData issue is blocking until 26
959 // https://bugzilla.mozilla.org/show_bug.cgi?id=865553
960 var search_str = " Firefox/";
961 var idx = navigator.userAgent.indexOf(search_str);
962 if (idx !== -1) {
963 var version = parseFloat(navigator.userAgent.substring(idx + search_str.length));
964 if (isNaN(version) || version < 26.0) {
965 audio_engine = AudioEngineSM2;
966 }
967 }
968
969 this.audio = new audio_engine().init(function () {
970 for (var i in piano.keys) {
971 if (!piano.keys.hasOwnProperty(i)) continue;
972 (function () {
973 var key = piano.keys[i];
974 if (useDefaultSounds) {
975 piano.audio.load(key.note, "https://raw.githubusercontent.com/rei2hu/piano-sounds/master/kawai/" + key.note + ".wav", function () {
976 key.loaded = true;
977 key.timeLoaded = Date.now();
978 if (key.domElement) // todo: move this to renderer somehow
979 $(key.domElement).removeClass("loading");
980 });
981 } else {
982 //Lsounds
983 piano.audio.load(key.note, "https://dl.dropboxusercontent.com/u/24213061/HDPiano/" + key.note + ".wav", function () {
984 key.loaded = true;
985 key.timeLoaded = Date.now();
986 if (key.domElement)
987 $(key.domElement).removeClass("loading");
988 });
989 }
990 })();
991 }
992 });
993 };
994
995 Piano.prototype.play = function(note, vol, participant, delay_ms) {
996 if(!this.keys.hasOwnProperty(note)) return;
997 var key = this.keys[note];
998 if(key.loaded) this.audio.play(key.note, vol, delay_ms, participant.id);
999 if(typeof gMidiOutTest === "function") gMidiOutTest(key.note, vol * 100, delay_ms);
1000 var self = this;
1001 var jq_namediv = $(typeof participant == "undefined" ? null : participant.nameDiv);
1002 if(jq_namediv) {
1003 setTimeout(function() {
1004 self.renderer.visualize(key, typeof participant == "undefined" ? "yellow" : (participant.color || "#777"));
1005 jq_namediv.addClass("play");
1006 setTimeout(function() {
1007 jq_namediv.removeClass("play");
1008 }, 30);
1009 }, delay_ms);
1010 }
1011 };
1012
1013 Piano.prototype.stop = function(note, participant, delay_ms) {
1014 if(!this.keys.hasOwnProperty(note)) return;
1015 var key = this.keys[note];
1016 if(key.loaded) this.audio.stop(key.note, delay_ms, participant.id);
1017 if(typeof gMidiOutTest === "function") gMidiOutTest(key.note, 0, delay_ms);
1018 };
1019
1020 var gPiano = new Piano(document.getElementById("piano"));
1021
1022 var gAutoSustain = true;
1023 var gSustain = false;
1024
1025 var gHeldNotes = {};
1026 var gSustainedNotes = {};
1027
1028 // roll
1029 function roll(id, vol, i) {
1030 if (octTemp == 1) { //check Logan
1031 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1032 gClient.startNote(id, vol);
1033 return;
1034 }
1035 setTimeout(function() {
1036 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1037 gClient.startNote(id, vol);
1038 }, delays + (delays * i));
1039 }
1040 // pressing
1041 function pressing(id, vol) {
1042 if (ouch) {
1043 for (i=0; i <= ouchN; i++) {
1044 setTimeout( function() { gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);}, ouchD * i);
1045 if (!politePlay) {
1046 setTimeout( function() { gClient.startNote(id, vol);}, ouchD * i)
1047 }
1048 }
1049
1050 } else {
1051 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1052 if (!politePlay) {
1053 gClient.startNote(id, vol);
1054 }
1055 }
1056 }
1057
1058 // press
1059 function press(id, vol) {
1060 //thanks electrashave!
1061 var pKey = gPiano.keys[id];
1062 for (as in MPP.piano.keys) {
1063 var key = MPP.piano.keys[as];
1064 if (key.num == (pKey.num + transLvl)) {
1065 id = key.note
1066 }
1067 }
1068
1069 if (mouseNote) {
1070 // thanks Chacha!
1071 try {
1072 var rect = gPiano.keys[id].rect;
1073 var t = 900; // 900
1074 var x = (rect.x + rect.x2) / 2; // Position within piano
1075 x /= gPiano.renderer.width; // Position within renderer
1076 x *= 95; // 100% minus left offset (3%) minus right offset (2%)
1077 x += 3; // Left offset of 3%, gives position within window
1078 var y = rect.h; // === rect.y2 - rect.y
1079 y -= gPiano.renderer.height * 0.75; // Center around midpoint between black and white keys.
1080 y /= 10; // Scale to fit the keys. (This is arbitrary since the height of the keys will vary between users anyway.)
1081 y += 50; // Center on middle of screen
1082 x += (Math.random()+Math.random()-1)*0.5; // Alters x slightly each press
1083 y += (Math.random()+Math.random()+Math.random()+Math.random()-2)*2.5; // Alters y slightly each press
1084 setTimeout(()=>gClient.sendArray([{ m: "m", x: x, y: y }]), t); // Wait for t before
1085 } catch (e) {console.log("mouseNote err: " + e)} // If there's an error log it
1086 }
1087
1088 var me = gClient.getOwnParticipant();
1089
1090 if (randNoteColour && !ignoreNotes && !politePlay) {
1091 me = gClient.getOwnParticipant();
1092 me.color = Col();
1093
1094 } else if (ignoreNotes && politePlay) {
1095 randNoteColour = true;
1096 me = gClient.getOwnParticipant();
1097 me.color = "purple";
1098
1099 } else if (ignoreNotes) {
1100 randNoteColour = true;
1101 me = gClient.getOwnParticipant();
1102 me.color = "red";
1103
1104 } else if (politePlay) {
1105 randNoteColour = true;
1106 me = gClient.getOwnParticipant();
1107 me.color = "blue";
1108 }
1109
1110
1111 if (delPlay) {
1112 setTimeout(function() {
1113 gPiano.play(id, vol !== undefined ? vol : DEFAULT_VELOCITY, gClient.getOwnParticipant(), 0);
1114 gClient.startNote(id, vol);
1115 }, delTime);
1116 }
1117
1118 var note = id.replace(/[0-9]/g, '').replace("-", "");
1119 var octave = parseInt(id.replace(/[^\d.]/, '').replace('s', ''));
1120 if (octTemp >= 3) {
1121 if (octTemp > 4) {
1122 octave = octave - 2;
1123 } else {
1124 octave = octave - 1;
1125 }
1126 }
1127 for (i = 0; i < octTemp; i++) {
1128 if (rollTemp) {
1129 roll(note + (octave + i), vol, i);
1130 } else {
1131 pressing(note + (octave + i), vol);
1132 }
1133 }
1134 gHeldNotes[id] = true;
1135 gSustainedNotes[id] = true;
1136
1137 }
1138 // release roll
1139 function releaseRoll(id, i) {
1140 setTimeout(function() {
1141 gPiano.stop(id, gClient.getOwnParticipant(), 0);
1142 gClient.stopNote(id);
1143 gSustainedNotes[id] = false;
1144 }, delays + (delays * i));
1145 }
1146
1147 // releasing
1148 function releasing(id) {
1149 gPiano.stop(id, gClient.getOwnParticipant(), 0);
1150 gClient.stopNote(id);
1151 gSustainedNotes[id] = false;
1152 }
1153
1154 // release
1155 function release(id) {
1156 if (gHeldNotes[id]) {
1157 gHeldNotes[id] = false;
1158 if (gAutoSustain || gSustain) {
1159 gSustainedNotes[id] = true;
1160 } else {
1161 if (gNoteQuota.spend(1)) {
1162 var octave = parseInt(id.replace(/[^\d.]/, '').replace('s', ''));
1163 var note = id.replace(/[0-9]/g, '').replace("-", "");
1164 if (octTemp >= 3) {
1165 if (octTemp > 4) {
1166 octave = octave - 2;
1167 } else {
1168 octave = octave - 1;
1169 }
1170 }
1171 for (i = 0; i < octTemp; i++) {
1172 if (rollTemp) {
1173 releaseRoll(note + (octave + i), i);
1174 } else {
1175 releasing(note + (octave + i));
1176 }
1177 }
1178 }
1179 }
1180 }
1181 }
1182
1183 function pressSustain() {
1184 gSustain = true;
1185 }
1186
1187 function releaseSustain() {
1188 gSustain = false;
1189 if (!gAutoSustain) {
1190 for (var id in gSustainedNotes) {
1191 if (gSustainedNotes.hasOwnProperty(id) && gSustainedNotes[id] && !gHeldNotes[id]) {
1192 if (gNoteQuota.spend(0)) {
1193 gPiano.stop(id, gClient.getOwnParticipant(), 0);
1194 gClient.stopNote(id);
1195 }
1196 }
1197 }
1198 }
1199 }
1200
1201
1202
1203
1204 // internet science
1205
1206 ////////////////////////////////////////////////////////////////
1207
1208 var channel_id = decodeURIComponent(window.location.pathname);
1209 if(channel_id.substr(0, 1) == "/") channel_id = channel_id.substr(1);
1210 if(channel_id.startsWith("piano")) channel_id = channel_id.substr(6);
1211 if(channel_id == "") channel_id = "lobby";
1212
1213 var wssport = window.location.hostname == "www.multiplayerpiano.com" ? 443 : 1234;
1214 var gClient = new Client("ws://" + window.location.hostname + ":" + wssport);
1215 gClient.setChannel(channel_id);
1216 gClient.start();
1217
1218 // Setting status
1219 (function () {
1220 gClient.on("count", function (status) {
1221 $("#status").text(status);
1222 });
1223 gClient.on("count", function (count) {
1224 if (count > 0) {
1225 $("#status").html('<span class="number">' + count + '</span> ' + (count == 1 ? 'player' : 'players'));
1226 document.title = "Relyks.Piano [v" + botVersion + "] (" + count + ")";
1227 } else {
1228 document.title = "Relyks's Bot [v" + botVersion + "]";
1229 }
1230 });
1231 })();
1232
1233 // Handle changes to participants
1234 (function () {
1235 gClient.on("participant added", function (part) {
1236
1237 part.displayX = 0.75; //150
1238 part.displayY = 25; //50
1239
1240 // add nameDiv
1241 var div = document.createElement("div");
1242 div.className = "name";
1243 div.participantId = part.id;
1244 div.textContent = part.name || selfName; // ""
1245 div.style.backgroundColor = part.color || "#777";
1246 if (gClient.participantId === part.id) {
1247 $(div).addClass("me");
1248 }
1249 if (gClient.channel && gClient.channel.crown && gClient.channel.crown.participantId === part.id) {
1250 $(div).addClass("owner");
1251 }
1252 if (gPianoMutes.indexOf(part._id) !== -1) {
1253 $(part.nameDiv).addClass("muted-notes");
1254 }
1255 if (gChatMutes.indexOf(part._id) !== -1) {
1256 $(part.nameDiv).addClass("muted-chat");
1257 }
1258 div.style.display = "none";
1259 part.nameDiv = $("#names")[0].appendChild(div);
1260 $(part.nameDiv).fadeIn(500); //2000
1261
1262 // sort names
1263 var arr = $("#names .name");
1264 arr.sort(function (a, b) {
1265 a = a.style.backgroundColor; // todo: sort based on user id instead
1266 b = b.style.backgroundColor;
1267 if (a > b) return 1;
1268 else if (a < b) return -1;
1269 else return 0;
1270 });
1271 $("#names").html(arr);
1272
1273 // add cursorDiv //gSeeOwnCursor
1274 if (gClient.participantId !== part.id || showOwnMouse) {
1275 var div = document.createElement("div");
1276 div.className = "cursor";
1277 div.style.display = "none";
1278 part.cursorDiv = $("#cursors")[0].appendChild(div);
1279 $(part.cursorDiv).fadeIn(500); //2000
1280
1281 //sets mouse position on join (thanks Josh)
1282 part.cursorDiv.style.left = 46.73 + "%";
1283 part.cursorDiv.style.top = 19.60 + "%";
1284
1285 var div = document.createElement("div");
1286 div.className = "name";
1287 div.style.backgroundColor = part.color || "#777"
1288 div.textContent = part.name || selfName; // ""
1289 part.cursorDiv.appendChild(div);
1290
1291 } else {
1292 part.cursorDiv = undefined;
1293 }
1294 });
1295 gClient.on("participant removed", function (part) { //when the participant leaves
1296 // remove nameDiv
1297 var nd = $(part.nameDiv);
1298 var cd = $(part.cursorDiv);
1299 cd.fadeOut(500); //2000
1300 nd.fadeOut(450, function () { //2000
1301 nd.remove();
1302 cd.remove();
1303 part.nameDiv = undefined;
1304 part.cursorDiv = undefined;
1305 });
1306 });
1307 gClient.on("participant update", function (part) {
1308 var name = part.name || "";
1309 var color = part.color || "#777";
1310 part.nameDiv.style.backgroundColor = color;
1311 part.nameDiv.textContent = name;
1312 $(part.cursorDiv)
1313 .find(".name")
1314 .text(name)
1315 .css("background-color", color);
1316 });
1317 gClient.on("ch", function (msg) {
1318 for (var id in gClient.ppl) {
1319 if (gClient.ppl.hasOwnProperty(id)) {
1320 var part = gClient.ppl[id];
1321 if (part.id === gClient.participantId) {
1322 $(part.nameDiv).addClass("me");
1323 } else {
1324 $(part.nameDiv).removeClass("me");
1325 }
1326 if (msg.ch.crown && msg.ch.crown.participantId === part.id) {
1327 $(part.nameDiv).addClass("owner");
1328 $(part.cursorDiv).addClass("owner");
1329 } else {
1330 $(part.nameDiv).removeClass("owner");
1331 $(part.cursorDiv).removeClass("owner");
1332 }
1333 if (gPianoMutes.indexOf(part._id) !== -1) {
1334 $(part.nameDiv).addClass("muted-notes");
1335 } else {
1336 $(part.nameDiv).removeClass("muted-notes");
1337 }
1338 if (gChatMutes.indexOf(part._id) !== -1) {
1339 $(part.nameDiv).addClass("muted-chat");
1340 } else {
1341 $(part.nameDiv).removeClass("muted-chat");
1342 }
1343 }
1344 }
1345 });
1346 })();
1347
1348
1349 // Handle changes to crown
1350 (function () {
1351 var jqcrown = $('<div id="crown"></div>').appendTo(document.body).hide();
1352 var jqcountdown = $('<span></span>').appendTo(jqcrown);
1353 var countdown_interval;
1354 jqcrown.click(function () {
1355 gClient.sendArray([{
1356 m: "chown",
1357 id: gClient.participantId
1358 }]);
1359 });
1360 gClient.on("ch", function (msg) {
1361 if (msg.ch.crown) {
1362 var crown = msg.ch.crown;
1363 if (!crown.participantId || !gClient.ppl[crown.participantId]) {
1364 var land_time = crown.time + 2000 - gClient.serverTimeOffset;
1365 var avail_time = crown.time + 15000 - gClient.serverTimeOffset;
1366 jqcountdown.text("");
1367 jqcrown.show();
1368 if (land_time - Date.now() <= 0) {
1369 jqcrown.css({
1370 "left": crown.endPos.x + "%",
1371 "top": crown.endPos.y + "%"
1372 });
1373 } else {
1374 jqcrown.css({
1375 "left": crown.startPos.x + "%",
1376 "top": crown.startPos.y + "%"
1377 });
1378 jqcrown.addClass("spin");
1379 jqcrown.animate({
1380 "left": crown.endPos.x + "%",
1381 "top": crown.endPos.y + "%"
1382 }, 2000, "linear", function () {
1383 jqcrown.removeClass("spin");
1384 });
1385 }
1386 clearInterval(countdown_interval);
1387 countdown_interval = setInterval(function () {
1388 var time = Date.now();
1389 if (time >= land_time) {
1390 var ms = avail_time - time;
1391 if (ms > 0) {
1392 jqcountdown.text(Math.ceil(ms / 1000) + "s");
1393 } else {
1394 jqcountdown.text("");
1395 clearInterval(countdown_interval);
1396 }
1397 }
1398 }, 1000);
1399 } else {
1400 jqcrown.hide();
1401 }
1402 } else {
1403 jqcrown.hide();
1404 }
1405 });
1406 gClient.on("disconnect", function () {
1407 jqcrown.fadeOut(2000);
1408 });
1409 })();
1410
1411
1412// Josh's playThing
1413 function playThing(notes, veloc, delay, times) {
1414 setTimeout(function() {
1415 gClient.sendArray([{
1416 m: "n",
1417 t: times,
1418 n: [{
1419 n: notes,
1420 v: veloc
1421 }]
1422 }]);
1423 }, delay);
1424 //console.log(notes);
1425 }
1426
1427
1428// Playing notes
1429 gClient.on("n", function(msg) {
1430 var t = msg.t - gClient.serverTimeOffset + TIMING_TARGET - Date.now();
1431 var participant = gClient.findParticipantById(msg.p);
1432 if (gPianoMutes.indexOf(participant._id) !== -1)
1433 return;
1434 for (var i = 0; i < msg.n.length; i++) {
1435 var note = msg.n[i];
1436 var octave = parseInt(note.n.replace( /[^\d.]/, '').replace('s', ''));
1437 if (octave > 7) {
1438 return;
1439 }
1440 var ms = t + (note.d || 0);
1441 if (ms < 0) {
1442 ms = 0;
1443 } else if (ms > 10000) continue;
1444 if (ignoreNotes) {
1445 if (participant.id == gClient.participantId) {
1446 if (note.s) {
1447 gPiano.stop(note.n, participant, ms);
1448 } else {
1449 var vel = (typeof note.v !== "undefined") ? parseFloat(note.v) : DEFAULT_VELOCITY;
1450 if (vel < 0) vel = 0;
1451 else if (vel > 1) vel = 1;
1452 gPiano.play(note.n, vel, participant, ms);
1453 }
1454 }
1455 } else {
1456 if (note.s) {
1457 gPiano.stop(note.n, participant, ms);
1458 } else {
1459 var vel = (typeof note.v !== "undefined") ? parseFloat(note.v) : DEFAULT_VELOCITY;
1460 if (vel < 0) vel = 0;
1461 else if (vel > 1) vel = 1;
1462 gPiano.play(note.n, vel, participant, ms);
1463 if (copyNotes){
1464 playThing(note.n,vel,note.d||0, t);
1465 }
1466 }
1467 }
1468 }
1469 });
1470
1471 // Send cursor updates
1472 // mouse optimizations by Alex
1473 var mx = 0, last_mx = -2.5, my = 0, last_my = -2.5;
1474 setInterval(function() {
1475 if (Math.abs(mx - last_mx) > 0.1 || Math.abs(my - last_my) > 0.1) {
1476 last_mx = mx;
1477 last_my = my;
1478 if (!incognito){
1479 gClient.sendArray([{m: "m", x: mx, y: my}]);
1480 }
1481 }
1482 }, 50);
1483
1484 $(document).mousemove(function(event) {
1485 mx = ((event.pageX / $(window).width()) * 100).toFixed(2);
1486 my = ((event.pageY / $(window).height()) * 100).toFixed(2);
1487 });
1488
1489 // Animate cursors
1490 setInterval(function() {
1491 for (var id in gClient.ppl) {
1492 if (!gClient.ppl.hasOwnProperty(id)) continue;
1493 var part = gClient.ppl[id];
1494 if (part.cursorDiv && (Math.abs(part.x - part.displayX) > 0.1 || Math.abs(part.y - part.displayY) > 0.1)) {
1495 part.displayX += (part.x - part.displayX) * 0.25;
1496 part.displayY += (part.y - part.displayY) * 0.25;
1497 part.cursorDiv.style.left = part.displayX + "%";
1498 part.cursorDiv.style.top = part.displayY + "%";
1499 if (autoFollow && part._id != selfId) {
1500 followId = part._id;
1501 }
1502 }
1503 }
1504 }, 1);
1505
1506 // Room settings button
1507 (function () {
1508 gClient.on("ch", function (msg) {
1509 if (gClient.isOwner()) {
1510 $("#room-settings-btn").show();
1511 $("#room-settings-btn").animate({opacity:0.7},100); //animates it thanks B@K$
1512 } else {
1513 $("#room-settings-btn").css("display","block"); //shows it
1514 $("#room-settings-btn").animate({opacity:0.3},100);
1515 }
1516 });
1517 $("#room-settings-btn").click(function (evt) { //room settings button
1518 if (gClient.channel && gClient.isOwner()) {
1519 var settings = gClient.channel.settings;
1520 openModal("#room-settings");
1521 setTimeout(function () {
1522 $("#room-settings .checkbox[name=visible]").prop("checked", settings.visible);
1523 $("#room-settings .checkbox[name=chat]").prop("checked", settings.chat);
1524 $("#room-settings .checkbox[name=crownsolo]").prop("checked", settings.crownsolo);
1525 }, 100);
1526 }
1527 });
1528 $("#room-settings .submit").click(function () {
1529 var settings = {
1530 visible: $("#room-settings .checkbox[name=visible]").is(":checked"),
1531 chat: $("#room-settings .checkbox[name=chat]").is(":checked"),
1532 crownsolo: $("#room-settings .checkbox[name=crownsolo]").is(":checked")
1533 };
1534 gClient.sendArray([{
1535 m: "chset",
1536 set: settings
1537 }]);
1538 closeModal();
1539 });
1540 $("#room-settings .drop-crown").click(function () {
1541 gClient.sendArray([{
1542 m: "chown"
1543 }]);
1544 closeModal();
1545 });
1546 })();
1547
1548 // Handle notifications
1549 gClient.on("notification", function (msg) {
1550 new Notification(msg);
1551 });
1552
1553 //cursor float
1554 /*gClient.on("ch", function (msg) {
1555 var chidlo = msg.ch._id.toLowerCase();
1556 if (chidlo === "a" || chidlo.substr() === "a") {
1557 $(".cursor").addClass("floating");
1558 } else {
1559
1560 $(".cursor").addClass("floating");
1561
1562 }
1563 });*/
1564
1565 // Don't forget spin
1566 /*gClient.on("ch", function (msg) {
1567 var chidlo = msg.ch._id.toLowerCase();
1568 if (chidlo === "spin" || chidlo.substr(-5) === "/spin") {
1569 $("#piano").addClass("spin");
1570 } else {
1571 $("#piano").removeClass("spin");
1572 }
1573 });*/
1574
1575 // Crownsolo notice
1576 gClient.on("ch", function (msg) {
1577 if (msg.ch.settings.crownsolo) {
1578 if ($("#crownsolo-notice").length == 0) {
1579 $('<div id="crownsolo-notice">').text('Only owner can play mode').appendTo("body").fadeIn(500);
1580 }
1581 } else {
1582 $("#crownsolo-notice").remove();
1583 }
1584 });
1585 gClient.on("disconnect", function () {
1586 $("#crownsolo-notice").remove();
1587 $("#nochat-notice").remove();
1588 });
1589
1590
1591
1592 var gPianoMutes = ["3ed152147e36d229cf5b7cba", "9b8df25492874a938ce9fb74"];
1593
1594 var gChatMutes = [];
1595
1596 //animated name stuff
1597 if (animName) {
1598 setInterval(function() {
1599 if (heyThereKitty == MPP.client.getOwnParticipant().name) return;
1600 updateName(heyThereKitty); //name to print
1601 if (followId == heyThereKittyId) return;
1602 followId = heyThereKittyId;
1603 }, 2100);
1604 }
1605
1606 // thanks Kappa
1607 /*
1608 var i = 0;
1609 setInterval(function() {
1610 MPP.client.sendArray([{
1611 m: "userset"
1612 , set: {
1613 name: selfName.slice(i % selfName.length) + selfName.slice(0, i++ % selfName.length)
1614 }
1615 }]);
1616 }, 2100)
1617 */
1618
1619 var volume_slider = new VolumeSlider(document.getElementById("volume"), function (v) {
1620 gPiano.audio.setVolume(v);
1621 if (window.localStorage) localStorage.volume = v;
1622 });
1623 volume_slider.set(gPiano.audio.volume);
1624
1625 var Note = function (note, octave) {
1626 this.note = note;
1627 this.octave = octave || 0;
1628 };
1629
1630
1631
1632 var n = function (a, b) {
1633 return {
1634 note: new Note(a, b),
1635 held: false
1636 };
1637 };
1638 //Logan, these are the key bindings for on the piano
1639 var key_binding = {
1640 65: n("gs"),
1641 90: n("a"),
1642 83: n("as"),
1643 88: n("b"),
1644 67: n("c", 1),
1645 70: n("cs", 1),
1646 86: n("d", 1),
1647 71: n("ds", 1),
1648 66: n("e", 1),
1649 78: n("f", 1),
1650 74: n("fs", 1),
1651 77: n("g", 1),
1652 75: n("gs", 1),
1653 188: n("a", 1),
1654 76: n("as", 1),
1655 190: n("b", 1),
1656 191: n("c", 2),
1657 222: n("cs", 2),
1658
1659 49: n("gs", 1),
1660 81: n("a", 1),
1661 50: n("as", 1),
1662 87: n("b", 1),
1663 69: n("c", 2),
1664 52: n("cs", 2),
1665 82: n("d", 2),
1666 53: n("ds", 2),
1667 84: n("e", 2),
1668 89: n("f", 2),
1669 55: n("fs", 2),
1670 85: n("g", 2),
1671 56: n("gs", 2),
1672 73: n("a", 2),
1673 57: n("as", 2),
1674 79: n("b", 2),
1675 80: n("c", 3),
1676 189: n("cs", 3),
1677 219: n("d", 3),
1678 187: n("ds", 3),
1679 221: n("e", 3)
1680 };
1681
1682 var capsLockKey = false; //here are some settings, Logan
1683 var gSustain = false;
1684 var keys = [];
1685 var volTemp = 1;
1686
1687 function handleKeyDown(evt) {
1688 var key = evt.keyCode;
1689 keys[key] = true;
1690
1691 // volume changing
1692 if (keys[107]) {
1693 volume > 0.9 ? volume = 1 : volume += 0.1;
1694 msgBox('Note Volume', 'Volume: ' + parseFloat(volume.toFixed(2)), 1000, '#piano');
1695
1696 } else if (keys[109]) {
1697 volume < 0.1 ? volume = 0 : volume -= 0.1;
1698 msgBox('Note Volume', 'Volume: ' + parseFloat(volume.toFixed(2)), 1000, '#piano');
1699 }
1700 // multi-octave toggling
1701 if (keys[38]) {
1702 octTemp > 6 ? octTemp = 7 : ++octTemp;
1703 msgBox('Multi-octave', 'Level ' + octTemp, 1000, '#piano');
1704
1705 } else if (keys[40]) {
1706 octTemp < 2 ? octTemp = 1 : --octTemp;
1707 msgBox('Multi-octave', 'Level ' + octTemp, 1000, '#piano');
1708 }
1709
1710 // roll toggling
1711 if (keys[35] && rollTemp) {
1712 rollTemp = false;
1713 msgBox('Roll', 'Disabled', 1000, '#piano');
1714
1715 } else if (keys[35] && !rollTemp) {
1716 rollTemp = true;
1717 msgBox('Roll', 'Enabled', 1000, '#piano');
1718 }
1719
1720 // sustain toggling
1721 //Insert key
1722 if (keys[45] && !susTemp) {
1723 msgBox('Sustain', 'Enabled', 1000, '#piano');
1724 susTemp = true;
1725
1726 } else if (keys[45] && susTemp) {
1727 msgBox('Sustain', 'Disabled', 1000, '#piano');
1728 susTemp = false;
1729 }
1730 if (!susTemp) {
1731 gAutoSustain = false;
1732 } else if (susTemp) {
1733 gAutoSustain = true;
1734 }
1735
1736 var code = parseInt(evt.keyCode); //move up and make use of more Logan
1737
1738 //numpad5
1739 if (code == 101 || code == 12) { //delay
1740 delPlay = !delPlay; //swaps it
1741 if (!delPlay) {
1742 msgBox('Delay', 'Disabled', 1000, '#piano');
1743 } else {
1744 msgBox('Delay', 'Enabled', 1000, '#piano');
1745 }
1746 //Pagedown
1747 } else if (code == 34) { //ignore
1748 ignoreNotes = !ignoreNotes;
1749 if (!ignoreNotes) {
1750 msgBox('Ignore Notes', 'Disabled', 1000, '#piano');
1751 } else {
1752 msgBox('Ignore Notes', 'Enabled', 1000, '#piano');
1753 }
1754 //Pageup
1755 } else if (code == 33) { //bot on/off [clean this logan]
1756 if (bot == 2) {
1757 bot = 0;
1758 msgBox('Commands', 'Disabled', 1000, '#piano');
1759 } else if (bot == 0) {
1760 bot = 1;
1761 msgBox('Commands', 'For everyone', 1000, '#piano');
1762 } else if (bot == 1) {
1763 bot = 2;
1764 msgBox('Commands', 'Only for you', 1000, '#piano');
1765 }
1766
1767 //numpad *
1768 } else if (code == 106) { //bot on/off //♥ REMOVE AND JUST MAKE NUMPAD - GO TO 0 ♥//
1769 if (timeStamp) {
1770 timeStamp = false;
1771 msgBox('Timestamps', 'Off', 1000, '#piano');
1772 } else {
1773 timeStamp = true;
1774 msgBox('Timestamps', 'On', 1000, '#piano');
1775 }
1776
1777 //numpad 0
1778 } else if (code == 96) { //reconnect
1779 MPP.client.stop();
1780 MPP.client.start();
1781 msgBox('Reconnecting...', '', 2000, '#piano');
1782
1783 //numpad 1
1784 } else if (code == 97) { //private room
1785 var room_name = randStr(28);
1786 changeRoom(room_name, "right", {
1787 "visible": false,
1788 "chat": true,
1789 "crownsolo": false,
1790 "lobby": false
1791 });
1792 //numpad 2
1793 } else if (code == 98) { //illuminati hotkey (until I find a better use)
1794 if (autoFollow) {
1795 autoFollow = false;
1796 following = false;
1797 followId = null;
1798 msgBox('Auto Follow', 'Off', 2000, '#blah-btn');
1799 } else {
1800 autoFollow = true;
1801 following = true;
1802 msgBox('Auto Follow', 'On', 2000, '#blah-btn');
1803 }
1804 //tab
1805 } else if (code == 9) { //hotkeymsg
1806 tab(); //ring ring..
1807
1808 //ctrl
1809 } else if (code == 17) { //drop crown
1810 gClient.sendArray([{
1811 m: "chown"
1812 }]);
1813 msgBox('Dropping crown', '', 1000, '#piano');
1814
1815 //alt
1816 } else if (code == 18) { //pickup crown
1817 gClient.sendArray([{
1818 m: "chown",
1819 id: gClient.participantId
1820 }]);
1821 msgBox('Picking up crown', '', 1000, '#piano');
1822
1823 //H
1824 } else if (code == 72) { //display help
1825 new Notification({id: "volume", title: "Hotkeys (thanks B@K$ for the design)", html: '\
1826 <h3>๖ۣۜHold to display binds and hotkeys...</h3>\
1827 <font color="#FF0066">Page Up:</font>Turns on/off chat commands (excluding !js and !room)<br />\
1828 <font color="#FF0066">Page Down</font> Ignores everyone elses notes<br />\
1829 <font color="#FF0066">End</font> Toggles rolling on multi-octaves<br />\
1830 <font color="#FF0066">Up/Down Arrows</font> Turns sets number of multi-octave<br />\
1831 <font color="#FF0066">Left/Right Arrows</font> electrashave\'s note transposing<br />\
1832 <font color="#FF0066">Insert</font> Toggles sustain (default was backspace)<br />\
1833 <font color="#FF0066">Backspace</font> Alerts you if someone in the friends list array joins<br />\
1834 <font color="#FF0066">Delete</font> Toggles an alert sound and notifcation if "Logan" is said<br />\
1835 <font color="#FF0066">Home *new</font> Toggles Polite Play Mode<br />\
1836 <font color="#FF0066">\\</font> Speech to text for Chrome (click accept then speak)<br />\
1837 <font color="#FF0066">Spacebar</font> Plays low notes while held<br />\
1838 <font color="#FF0066">~</font> Plays high notes while held<br />\
1839 <font color="#FF0066">Tab</font> Sends hotkey message<br />\
1840 <font color="#FF0066">3</font> Toggles owner only mode (need crown)<br />\
1841 <font color="#FF0066">6</font> Toggles room visibility (need crown)<br />\
1842 <font color="#FF0066">Numpad + -</font> Change note volume<br />\
1843 <font color="#FF0066">Numpad *</font> Toggles timestamps in chat<br />\
1844 <font color="#FF0066">Numpad .</font> Meow meow meow<br />\
1845 <font color="#FF0066">Numpad 0</font> Quick reconnect<br />\
1846 <font color="#FF0066">Numpad 1</font> Play Alone<br />\
1847 <font color="#FF0066">Numpad 2</font> Auto Follow<br />\
1848 <font color="#FF0066">Numpad 3</font> Lenny<br />\
1849 <font color="#FF0066">Numpad 4</font> Toggle Bunny<br />\
1850 <font color="#FF0066">Numpad 5</font> Toggles delay<br />\
1851 <font color="#FF0066">Numpad 6</font> Toggles Pong<br />\
1852 <font color="#FF0066">Numpad 7</font> Toggles text to speech<br />\
1853 <font color="#FF0066">Numpad 8</font> Toggles SomeGuy\'s incognito<br />\
1854 <font color="#FF0066">Alt</font> Picks up the crown<br />\
1855 <font color="#FF0066">Ctrl</font> Drops the crown<br />\
1856 <font color="#FF0066">H</font> Displays displays Hotkeys again<br />\
1857 <font color="#FF3399">!lhelp</font> Displays local commands in chat<br />\
1858 To stop this message displaying every time you start the script search for <font color="#FF0066">i_know_how_to_use_this_bot</font> and change <font color="#CC0000">false</font> to <font color="#0066FF">true</font>.<br />\
1859 ', target: "#blah-btn", duration: 600});
1860
1861//--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST//
1862 //numpad .
1863 } else if (code == 110) { //hotkey test
1864 if (meow) {
1865 meow = false;
1866 msgBox('Cat Mode', 'Off', 1000, '#blah-btn');
1867 } else {
1868 meow = true;
1869 msgBox('Cat Mode', 'On', 1000, '#blah-btn');
1870 }
1871
1872
1873//--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST//
1874
1875
1876 // ♥ Thanks Josh ♥ //
1877 // \ key
1878 } else if (code == 220) { //Yoshify's speech to text
1879 if (listening) {
1880 listening = false;
1881 Voice.stop();
1882 msgBox('Speech to Text', 'Stopping Capture', 3000, '#blah-btn');
1883 } else {
1884 listening = true;
1885 Voice.start();
1886 msgBox('Speech to Text', 'Listening (press again to send)', 3000, '#blah-btn');
1887 }
1888
1889 //numpad 7
1890 } else if (code == 103) { //speech toggle
1891 if (speechStatus) {
1892 speechStatus = false;
1893 speechSynthesis.cancel();
1894 msgBox('Text to Speech', 'Off', 1000, '#blah-btn');
1895 } else {
1896 speechStatus = true;
1897 msgBox('Text to Speech', 'On', 1000, '#blah-btn');
1898 }
1899 //del
1900 } else if (code == 46) { //alert on name said in chat toggle
1901 if (alertName) {
1902 alertName = false;
1903 msgBox('Alert on key-word', 'Off', 1000, '#blah-btn');
1904 } else {
1905 alertName = true;
1906 msgBox('Alert on key-word', 'On', 1000, '#blah-btn');
1907 }
1908 //home
1909 } else if (code == 36) { //politePlay
1910 if (politePlay) {
1911 politePlay = false;
1912 msgBox('Polite Play', 'Off', 1000, '#blah-btn');
1913 } else {
1914 politePlay = true;
1915 msgBox('Polite Play', 'On (others cannot hear your notes)', 1000, '#blah-btn');
1916 }
1917
1918 //backspace
1919 } else if (code == 8) { //alert on friends join toggle
1920 if (alertOnFriendJoin) {
1921 alertOnFriendJoin = false;
1922 msgBox('Alert on Friend Join', 'Off', 1000, '#blah-btn');
1923 } else {
1924 alertOnFriendJoin = true;
1925 msgBox('Alert on Friend Join', 'On', 1000, '#blah-btn');
1926 }
1927 // . key
1928 } else if (code == 51) { //owner only
1929 if (crownSoloToggle) {
1930 crownSoloToggle = false;
1931 MPP.client.sendArray([{m: "chset", set: {crownsolo: false}}]);
1932 msgBox('Owner Only', 'Off', 1000, '#blah-btn');
1933 } else {
1934 crownSoloToggle = true;
1935 MPP.client.sendArray([{m: "chset", set: {crownsolo: true}}]);
1936 msgBox('Owner Only', 'On', 1000, '#blah-btn');
1937 }
1938 // 6 key
1939 } else if (code == 54) { //hide room
1940 if (roomVisibleToggle) {
1941 roomVisibleToggle = false;
1942 MPP.client.sendArray([{m: "chset", set: {visible: false}}]);
1943 msgBox('Room Visible', 'No', 1000, '#blah-btn');
1944 } else {
1945 roomVisibleToggle = true;
1946 MPP.client.sendArray([{m: "chset", set: {visible: true}}]);
1947 msgBox('Room Visible', 'Yes', 1000, '#blah-btn');
1948 }
1949
1950
1951 } else if (code == 104) { //mouse updates
1952 if (incognito) {
1953 incognito = false;
1954 msgBox('Incognito', 'Off', 1000, '#blah-btn');
1955 } else {
1956 incognito = true;
1957 msgBox('Incognito', 'On', 1000, '#blah-btn');
1958 }
1959
1960 } else if (code == 105) { //copy notes
1961 if (copyNotes) {
1962 copyNotes = false;
1963 msgBox('Copy Notes', 'Off', 1000, '#blah-btn');
1964 } else {
1965 copyNotes = true;
1966 msgBox('Copy Notes', 'On', 1000, '#blah-btn');
1967 }
1968
1969 } else if (code == 100) { //cursor bunny
1970 testflipB = !testflipB;
1971 if (!testflipB) {
1972 msgBox('Bunny', 'Off', 1000, '#blah-btn');
1973 } else {
1974 setTimeout(function () {
1975 client = MPP.client;
1976 var bunny = new Bunny(client);
1977 worker.onmessage = function(event)
1978 {
1979 if(event.data.args)
1980 if(event.data.args.action==0){
1981 if(testflipB){ bunny.tick(); }
1982 }
1983 }
1984 worker.postMessage({delay:120,args:{action:0}});
1985 }, 120);
1986
1987
1988 var Bunny = function (client) {
1989 this.client = client;
1990
1991 this.vx = 1.5;
1992 this.vy = 2.2;
1993
1994 var self = this;
1995 self.part = self.client.ppl[self.client.participantId];
1996 client.on("ch", function () {
1997 self.part = self.client.ppl[self.client.participantId];
1998 });
1999 }
2000
2001 Bunny.prototype.tick = function () {
2002 if (!this.client.isConnected() || !this.part) return;
2003 this.part.x += this.vx;
2004 this.part.y += this.vy;
2005 if (this.part.x < 0) {
2006 this.vx = -this.vx;
2007 } else if (this.part.x > 100) {
2008 this.vx = -this.vx;
2009 }
2010 if (this.part.y < 0) {
2011 this.vy = -this.vy;
2012 } else if (this.part.y > 0) { //0 makes the ceiling which it bounces off
2013 this.vy = -this.vy;
2014 }
2015 this.client.sendArray([{
2016 m: "m",
2017 x: this.part.x,
2018 y: this.part.y
2019 }]);
2020 this.client.sendArray([{
2021 m: "m",
2022 x: this.part.x,
2023 y: this.part.y
2024 }]);
2025 worker.postMessage({delay:120,args:{action:0}});
2026 };
2027 msgBox('Bunny', 'On', 1000, '#blah-btn');
2028 }
2029
2030 //msgBox('Pong', 'Off', 1000, '#blah-btn');
2031
2032 } else if (code == 102) { //cursor pong
2033 testflipP = !testflipP;
2034 if (!testflipP) {
2035 msgBox('Pong', 'Off', 1000, '#blah-btn');
2036
2037 } else {
2038 //on
2039 setTimeout(function() {
2040 client = MPP.client;
2041 var pong = new Pong(client);
2042 worker.onmessage = function(event) {
2043 if (event.data.args)
2044 if (event.data.args.action == 0) {
2045 if (testflipP) {
2046 pong.tick();
2047 }
2048 }
2049 }
2050 worker.postMessage({
2051 delay: 60
2052 , args: {
2053 action: 0
2054 }
2055 });
2056 }, 60);
2057
2058
2059 var Pong = function(client) {
2060 this.client = client;
2061
2062 this.vx = 0.1875; //0.75
2063 this.vy = 0.275; //1.1
2064
2065 var self = this;
2066 self.part = self.client.ppl[self.client.participantId];
2067 client.on("ch", function() {
2068 self.part = self.client.ppl[self.client.participantId];
2069 });
2070 }
2071
2072 Pong.prototype.tick = function() {
2073 if (!this.client.isConnected() || !this.part) return;
2074 this.part.x += this.vx;
2075 this.part.y += this.vy;
2076 if (this.part.x < 0) {
2077 this.vx = -this.vx;
2078 } else if (this.part.x > 100) {
2079 this.vx = -this.vx;
2080 }
2081 if (this.part.y < 0) {
2082 this.vy = -this.vy;
2083 } else if (this.part.y > 100) {
2084 this.vy = -this.vy;
2085 }
2086
2087 //x is <--> 100 is --> 0 is <--
2088 //y is ^v 0 is ^ 100 is v
2089
2090 this.vx += Math.random() * 0.1 - 0.05;
2091 this.vy += Math.random() * 0.1 - 0.05;
2092 this.client.sendArray([{ //were two of these
2093 m: "m"
2094 , x: this.part.x
2095 , y: this.part.y
2096 }]);
2097 if (this.part.x < -10 || this.part.y < -10 || this.part.x > 110 || this.part.y > 110) {
2098 this.part.x = 50;
2099 this.part.y = 50;
2100 //resets the velocity when setting position
2101 this.vx = -this.vx;
2102 this.vy = -this.vy;
2103 }
2104 worker.postMessage({
2105 delay: 60
2106 , args: {
2107 action: 0
2108 }
2109 });
2110 };
2111 msgBox('Pong', 'On', 1000, '#blah-btn');
2112 }
2113
2114 } else if (code == 99) { //lenny
2115 var msgTmp = $("input").val(); //retain old text
2116 $("body #chat input").val(msgTmp + " ( ͡◕ ͜ʖ ͡◕)");
2117
2118 //numpad /
2119 } else if (code == 111) { //hotkey spam
2120 for(var key in MPP.piano.keys) MPP.press(key, volume);
2121
2122 //thanks electrashave!
2123 } else if (code == 39) {
2124 transLvl++;
2125 msgBox('Transposing (by electrashave)', 'Transpose level: ' + transLvl, 1000, '#blah-btn');
2126
2127 //thanks electrashave!
2128 } else if (code == 37) {
2129 transLvl--;
2130 msgBox('Transposing (by electrashave)', 'Transpose level: ' + transLvl, 1000, '#blah-btn');
2131 }
2132
2133 if (key_binding[code] !== undefined) {
2134 var binding = key_binding[code];
2135 if (!binding.held) {
2136 binding.held = true;
2137 if (gNoteQuota.spend(0)) {
2138 var note = binding.note;
2139 var octave = 1 + note.octave;
2140 // extra octaves
2141 if (keys[16])++octave;
2142 else if (keys[32])--octave == --octave + -octave;
2143 else if (keys[18])++octave == ++octave + +octave;
2144 else if (keys[192])++octave == ++octave + ++octave;
2145 else if (capsLockKey)--octave;
2146 var note = note.note;
2147 var vol = volume;
2148
2149 if (volume > 5) {
2150 volume = 5;
2151 }
2152 press(note + octave, vol);
2153 }
2154 }
2155
2156 if (++gKeyboardSeq == 3) {
2157 gKnowsYouCanUseKeyboard = true;
2158 if (window.gKnowsYouCanUseKeyboardTimeout) clearTimeout(gKnowsYouCanUseKeyboardTimeout);
2159 if (localStorage) localStorage.knowsYouCanUseKeyboard = true;
2160 if (window.gKnowsYouCanUseKeyboardNotification) gKnowsYouCanUseKeyboardNotification.close();
2161 }
2162
2163 evt.preventDefault();
2164 evt.stopPropagation();
2165 return false;
2166 } else if (code == 20) { // Caps Lock
2167 capsLockKey = true;
2168 evt.preventDefault();
2169 } else if (code === 0x20) { // Space Bar
2170 evt.preventDefault();
2171 } else if (code == 9) { // Tab (don't tab away from the piano)
2172 evt.preventDefault();
2173 } else if (code == 8) { // Backspace (don't navigate Back)
2174 evt.preventDefault();
2175 }
2176 };
2177
2178 //FIX BELOW MESS
2179
2180 var keys = [];
2181
2182 function handleKeyUp(evt) {
2183 var key = evt.keyCode;
2184 keys[key] = false;
2185 var code = parseInt(evt.keyCode);
2186 if (key_binding[code] !== undefined) {
2187 var binding = key_binding[code];
2188 if (binding.held) {
2189 keys[key] = false;
2190 binding.held = false;
2191
2192 if (!gAutoSustain && !gSustain) {
2193 if (gNoteQuota.spend(octTemp)) {
2194 var note = binding.note;
2195 var octave = 1 + note.octave;
2196 // extra octaves
2197 if (keys[16])++octave;
2198 else if (keys[32])--octave == --octave + -octave;
2199 else if (keys[18])++octave == ++octave + +octave;
2200 else if (keys[192])++octave == ++octave + ++octave;
2201 else if (capsLockKey)--octave;
2202 var note = note.note;
2203 release(note + octave); //was missing octave which didn't stop the note - Logan
2204 }
2205 }
2206 }
2207
2208 evt.preventDefault();
2209 evt.stopPropagation();
2210 return false;
2211 } else if (code == 20) { // Caps Lock
2212 capsLockKey = false;
2213 evt.preventDefault();
2214 } else if (code === 0x20) { // Space Bar
2215 evt.preventDefault();
2216 } else if (code == 8) { // Backspace (don't navigate Back)
2217 evt.preventDefault();
2218 }
2219 };
2220
2221 function handleKeyPress(evt) {
2222 evt.preventDefault();
2223 evt.stopPropagation();
2224 if (evt.keyCode == 27 || evt.keyCode == 13) {
2225 //add some stuff here Logan
2226 }
2227 return false;
2228 };
2229
2230 var recapListener = function (evt) {
2231 captureKeyboard();
2232 };
2233
2234 function captureKeyboard() {
2235 $("#piano").off("mousedown", recapListener);
2236 $("#piano").off("touchstart", recapListener);
2237 $(document).on("keydown", handleKeyDown);
2238 $(document).on("keyup", handleKeyUp);
2239 $(window).on("keypress", handleKeyPress);
2240 };
2241
2242 function releaseKeyboard() {
2243 $(document).off("keydown", handleKeyDown);
2244 $(document).off("keyup", handleKeyUp);
2245 $(window).off("keypress", handleKeyPress);
2246 $("#piano").on("mousedown", recapListener);
2247 $("#piano").on("touchstart", recapListener);
2248 };
2249
2250 captureKeyboard();
2251
2252
2253 var velocityFromMouseY = function () {
2254 return 0.1 + (my / 100) * 0.6;
2255 };
2256
2257
2258
2259
2260 // NoteQuota
2261 var gNoteQuota = (function () {
2262 var last_rat = 0;
2263 var nqjq = $("#quota .value");
2264 setInterval(function () {
2265 gNoteQuota.tick();
2266 }, 2000);
2267 return new NoteQuota(function (points) {
2268 // update UI
2269 var rat = (points / this.max) * 100; // 100
2270 if (rat <= last_rat)
2271 nqjq.stop(true, true).css("width", rat.toFixed(0) + "%");
2272 else
2273 nqjq.stop(true, true).animate({
2274 "width": rat.toFixed(0) + "%"
2275 }, 2000, "linear");
2276 last_rat = rat;
2277 });
2278 })();
2279 gClient.on("nq", function (nq_params) {
2280 gNoteQuota.setParams(nq_params);
2281 });
2282 gClient.on("disconnect", function () {
2283 gNoteQuota.setParams(NoteQuota.PARAMS_OFFLINE);
2284 });
2285
2286
2287
2288 // click participant names
2289 (function () {
2290 var ele = document.getElementById("names");
2291 var touchhandler = function (e) {
2292 var target_jq = $(e.target);
2293 if (target_jq.hasClass("name")) {
2294 target_jq.addClass("play");
2295 if (e.target.participantId == gClient.participantId) {
2296 var id = e.target.participantId;
2297 var part = gClient.ppl[id] || null;
2298 if (part) {
2299 participantMenu(part);
2300 e.stopPropagation();
2301 }
2302 } else if (e.target.participantId) {
2303 var id = e.target.participantId;
2304 var part = gClient.ppl[id] || null;
2305 if (part) {
2306 participantMenu(part);
2307 e.stopPropagation();
2308 }
2309 }
2310 }
2311 };
2312 ele.addEventListener("mousedown", touchhandler);
2313 ele.addEventListener("touchstart", touchhandler);
2314 var releasehandler = function (e) {
2315 $("#names .name").removeClass("play");
2316 };
2317 document.body.addEventListener("mouseup", releasehandler);
2318 document.body.addEventListener("touchend", releasehandler);
2319
2320 var removeParticipantMenus = function () {
2321 $(".participant-menu").fadeOut(500);
2322 $(".participantSpotlight").hide(); //what is this?
2323 document.removeEventListener("mousedown", removeParticipantMenus);
2324 document.removeEventListener("touchstart", removeParticipantMenus);
2325 };
2326
2327 var participantMenu = function (part) {
2328 if (!part) return;
2329 removeParticipantMenus();
2330 document.addEventListener("mousedown", removeParticipantMenus);
2331 document.addEventListener("touchstart", removeParticipantMenus);
2332 $("#" + part.id).find(".enemySpotlight").show(); //what is this D:
2333 var menu = $('<div class="participant-menu"></div>');
2334 $("body").append(menu);
2335 // move menu to name position
2336 var jq_nd = $(part.nameDiv);
2337 var pos = jq_nd.position();
2338 menu.css({
2339 "top": pos.top + jq_nd.height() + 15,
2340 "left": pos.left + 6,
2341 "background": part.color || "black"
2342 });
2343 menu.on("mousedown touchstart", function (evt) {
2344 evt.stopPropagation();
2345 var target = $(evt.target);
2346 if (target.hasClass("menu-item")) {
2347 target.addClass("clicked"); //why is this needed?
2348 menu.fadeOut(500, function () {
2349 removeParticipantMenus();
2350 });
2351 }
2352 });
2353 // this spaces stuff out but also can be used for informational purposes
2354 $('<div class="info"></div>').appendTo(menu).text(part._id)
2355 .on("mousedown touchstart", function (evt) {
2356 //prompt("Press CTRL C to copy "+ part.name +"'s ID", part._id);
2357 prompt(part.name.endsWith("s") ? "Press CTRL C to copy "+ part.name +"' ID" : "Press CTRL C to copy "+ part.name +"'s ID", part._id);
2358 });
2359
2360 // added menu items
2361
2362 // rename
2363 if (part._id == gClient.getOwnParticipant()._id) {
2364 $('<div class="menu-item">• Rename</div>').appendTo(menu)
2365 .on("mousedown touchstart", function (evt) {
2366 openModal("#rename", "input[name=name]");
2367 setTimeout(function () {
2368 $("#rename input[name=name]").val(gClient.ppl[gClient.participantId].name);
2369 $("#rename input[name=color]").val(gClient.ppl[gClient.participantId].color);
2370 }, 100);
2371 });
2372 }
2373
2374
2375 // master and unmaster
2376 if (masters.indexOf(part._id) == -1) {
2377 $('<div class="menu-item">• Master</div>').appendTo(menu)
2378 .on("mousedown touchstart", function (evt) {
2379 masters.push(part._id);
2380 gClient.sendArray([{ m: "a", message: "Mastered " + part.name + "."}])
2381 });
2382 } else {
2383 $('<div class="menu-item">• Unmaster</div>').appendTo(menu)
2384 .on("mousedown touchstart", function (evt) {
2385 delete masters[masters.indexOf(part._id)];
2386 gClient.sendArray([{ m: "a", message: "Unmastered " + part.name + "."}])
2387 });
2388 }
2389
2390
2391 // op and deop
2392 if (ops.indexOf(part._id) == -1) {
2393 $('<div class="menu-item">• Op</div>').appendTo(menu)
2394 .on("mousedown touchstart", function (evt) {
2395 ops.push(part._id);
2396 gClient.sendArray([{ m: "a", message: "Opped " + part.name + "."}])
2397 });
2398 } else {
2399 $('<div class="menu-item">• Deop</div>').appendTo(menu)
2400 .on("mousedown touchstart", function (evt) {
2401 delete ops[ops.indexOf(part._id)];
2402 gClient.sendArray([{ m: "a", message: "deopped " + part.name + "."}])
2403 });
2404 }
2405
2406 if (part._id != gClient.getOwnParticipant()._id) {
2407
2408 // follow and rest
2409 if (!followId) {
2410 $('<div class="menu-item">• Follow >.<</div>').appendTo(menu)
2411 .on("mousedown touchstart", function (evt) {
2412 following = true;
2413 followId = part._id;
2414
2415 msgBox('Following', part.name, 2000, '#piano');
2416 });
2417 } else {
2418 $('<div class="menu-item">• Rest <.></div>').appendTo(menu)
2419 .on("mousedown touchstart", function (evt) {
2420 following = false;
2421 followId = null;
2422 msgBox('Stopping', 'Phew...', 2000, '#piano');
2423 });
2424 }
2425
2426 if (gPianoMutes.indexOf(part._id) == -1) {
2427 $('<div class="menu-item">• Mute Notes</div>').appendTo(menu)
2428 .on("mousedown touchstart", function (evt) {
2429 gPianoMutes.push(part._id);
2430 $(part.nameDiv).addClass("muted-notes");
2431 });
2432 } else {
2433 $('<div class="menu-item">• Unmute Notes</div>').appendTo(menu)
2434 .on("mousedown touchstart", function (evt) {
2435 var i;
2436 while ((i = gPianoMutes.indexOf(part._id)) != -1)
2437 gPianoMutes.splice(i, 1);
2438 $(part.nameDiv).removeClass("muted-notes");
2439 });
2440 }
2441 if (gChatMutes.indexOf(part._id) == -1) {
2442 $('<div class="menu-item">• Mute Chat</div>').appendTo(menu)
2443 .on("mousedown touchstart", function (evt) {
2444 gChatMutes.push(part._id);
2445 $(part.nameDiv).addClass("muted-chat");
2446 });
2447 } else {
2448 $('<div class="menu-item">• Unmute Chat</div>').appendTo(menu)
2449 .on("mousedown touchstart", function (evt) {
2450 var i;
2451 while ((i = gChatMutes.indexOf(part._id)) != -1)
2452 gChatMutes.splice(i, 1);
2453 $(part.nameDiv).removeClass("muted-chat");
2454 });
2455 }
2456 if (!(gPianoMutes.indexOf(part._id) >= 0) || !(gChatMutes.indexOf(part._id) >= 0)) {
2457 $('<div class="menu-item">• Mute Completely</div>').appendTo(menu)
2458 .on("mousedown touchstart", function (evt) {
2459 gPianoMutes.push(part._id);
2460 gChatMutes.push(part._id);
2461 $(part.nameDiv).addClass("muted-notes");
2462 $(part.nameDiv).addClass("muted-chat");
2463 });
2464 }
2465 if ((gPianoMutes.indexOf(part._id) >= 0) || (gChatMutes.indexOf(part._id) >= 0)) {
2466 $('<div class="menu-item">• Unmute Completely</div>').appendTo(menu)
2467 .on("mousedown touchstart", function (evt) {
2468 var i;
2469 while ((i = gPianoMutes.indexOf(part._id)) != -1)
2470 gPianoMutes.splice(i, 1);
2471 while ((i = gChatMutes.indexOf(part._id)) != -1)
2472 gChatMutes.splice(i, 1);
2473 $(part.nameDiv).removeClass("muted-notes");
2474 $(part.nameDiv).removeClass("muted-chat");
2475 });
2476 }
2477
2478 // ban and unban
2479
2480
2481 if (gClient.isOwner()) {
2482 $('<div class="menu-item give-crown">• Give Crown</div>').appendTo(menu)
2483 .on("mousedown touchstart", function (evt) {
2484 gClient.sendArray([{
2485 m: "chown",
2486 id: part.id
2487 }]);
2488 });
2489
2490 $('<div class="menu-item kickban">• Kickban</div>').appendTo(menu).on("mousedown touchstart", function (evt)
2491 {
2492 var minutes = prompt ("How many minutes? (0-60)", "60");
2493
2494 if(minutes === null) return;
2495 minutes = parseFloat(minutes) || 0;
2496
2497 var ms = minutes * 60 * 1000;
2498
2499 gClient.sendArray([{m: "kickban", _id: part._id, ms: ms}]);
2500 });
2501 }
2502 }
2503 menu.fadeIn(500);
2504 };
2505 })();
2506
2507 // Notification class
2508
2509 ////////////////////////////////////////////////////////////////
2510
2511 var Notification = function (par) {
2512 EventEmitter.call(this);
2513
2514 var par = par || {};
2515
2516 this.id = "Notification-" + (par.id || Math.random());
2517 this.title = par.title || "";
2518 this.text = par.text || "";
2519 this.html = par.html || "";
2520 this.target = $(par.target || "#piano");
2521 this.duration = par.duration || 30000;
2522
2523 var self = this;
2524 var eles = $("#" + this.id);
2525 if (eles.length > 0) {
2526 eles.remove();
2527 }
2528 this.domElement = $('<div class="notification"><div class="notification-body"><div class="title"></div>' +
2529 '<div class="text"></div></div><div class="x">x</div></div>');
2530 this.domElement[0].id = this.id;
2531 this.domElement.find(".title").text(this.title);
2532 if (this.text.length > 0) {
2533 this.domElement.find(".text").text(this.text);
2534 } else if (this.html.length > 0) {
2535 this.domElement.find(".text").html(this.html);
2536 }
2537 document.body.appendChild(this.domElement.get(0));
2538
2539 this.position();
2540 this.onresize = function () {
2541 self.position();
2542 };
2543 $(window).on("resize", this.onresize);
2544
2545 this.domElement.find(".x").click(function () {
2546 self.close();
2547 });
2548
2549 if (this.duration > 0) {
2550 setTimeout(function () {
2551 self.close();
2552 }, this.duration);
2553 }
2554
2555 return this;
2556 }
2557
2558 mixin(Notification.prototype, EventEmitter.prototype);
2559 Notification.prototype.constructor = Notification;
2560
2561 Notification.prototype.position = function () {
2562 var pos = this.target.offset();
2563 var x = pos.left - (this.domElement.width() / 2) + (this.target.width() / 4);
2564 var y = pos.top - this.domElement.height() - 8;
2565 var width = this.domElement.width();
2566 if (x + width > $("body").width()) {
2567 x -= ((x + width) - $("body").width());
2568 }
2569 if (x < 0) x = 0;
2570 this.domElement.offset({
2571 left: x,
2572 top: y
2573 });
2574 };
2575
2576 Notification.prototype.close = function () {
2577 var self = this;
2578 $(window).off("resize", this.onresize);
2579 this.domElement.fadeOut(500, function () {
2580 self.domElement.remove();
2581 self.emit("close");
2582 });
2583 };
2584
2585
2586
2587
2588 // set variables from settings or set settings
2589
2590 ////////////////////////////////////////////////////////////////
2591
2592 if(!i_know_how_to_use_this_bot) {
2593
2594 new Notification({id: "volume", title: "Hotkeys (thanks B@K$ for the design)", html: '\
2595 <h3>๖ۣۜHold to display binds and hotkeys...</h3>\
2596 <font color="#FF0066">Page Up:</font>Turns on/off chat commands (excluding !js and !room)<br />\
2597 <font color="#FF0066">Page Down</font> Ignores everyone elses notes<br />\
2598 <font color="#FF0066">End</font> Toggles rolling on multi-octaves<br />\
2599 <font color="#FF0066">Up Arrow</font> Turns on / increases multi-octave<br />\
2600 <font color="#FF0066">Down Arrow:</font> Turns on / increases multi-octave<br />\
2601 <font color="#FF0066">Insert</font> Toggles sustain (default was backspace)<br />\
2602 <font color="#FF0066">Backspace</font> Alerts you if someone in the friends list array joins<br />\
2603 <font color="#FF0066">Delete</font> Toggles an alert sound and notifcation if "Logan" is said<br />\
2604 <font color="#FF0066">Home *new</font> Toggles Polite Play Mode<br />\
2605 <font color="#FF0066">\\</font> Speech to text for Chrome (click accept then speak)<br />\
2606 <font color="#FF0066">Spacebar</font> Plays low notes while held<br />\
2607 <font color="#FF0066">~</font> Plays high notes while held<br />\
2608 <font color="#FF0066">Tab</font> Sends hotkey message<br />\
2609 <font color="#FF0066">.</font> Toggles owner only mode (need crown)<br />\
2610 <font color="#FF0066">,</font> Toggles room visibility (need crown)<br />\
2611 <font color="#FF0066">Numpad + -</font> Change note volume<br />\
2612 <font color="#FF0066">Numpad *</font> Toggles timestamps in chat<br />\
2613 <font color="#FF0066">Numpad .</font> Meow meow meow<br />\
2614 <font color="#FF0066">Numpad 0</font> Quick reconnect<br />\
2615 <font color="#FF0066">Numpad 1</font> Play Alone<br />\
2616 <font color="#FF0066">Numpad 2</font> Auto Follow<br />\
2617 <font color="#FF0066">Numpad 3</font> Lenny<br />\
2618 <font color="#FF0066">Numpad 4</font> Toggle Bunny<br />\
2619 <font color="#FF0066">Numpad 5</font> Toggles delay<br />\
2620 <font color="#FF0066">Numpad 6</font> Toggles Pong<br />\
2621 <font color="#FF0066">Numpad 7</font> Toggles text to speech<br />\
2622 <font color="#FF0066">Numpad 8</font> Toggles SomeGuy\'s incognito<br />\
2623 <font color="#FF0066">Alt</font> Picks up the crown<br />\
2624 <font color="#FF0066">Ctrl</font> Drops the crown<br />\
2625 <font color="#FF0066">H</font> Displays displays Hotkeys again<br />\
2626 <font color="#FF3399">!lhelp</font> Displays local commands in chat<br />\
2627 To stop these messages displaying every time you start the script search for <font color="#FF0066">i_know_how_to_use_this_bot</font> and change <font color="#CC0000">false</font> to <font color="#0066FF">true</font>.<br />\
2628 ', target: "#blah-btn", duration: 0});
2629
2630 setTimeout(function() { //I think wrapping this in setTimeout hoists it so it wait for the buttons to be placed
2631 msgBox('Chat log is saved between rooms', 'To clear click Msgs button (i know it\'s on wrong button >.<)', 0, '#4-btn');
2632 }, 0);
2633
2634 }
2635
2636 var gKeyboardSeq = 0;
2637 var gKnowsYouCanUseKeyboard = false;
2638 if (localStorage && localStorage.knowsYouCanUseKeyboard) gKnowsYouCanUseKeyboard = true;
2639 if (!gKnowsYouCanUseKeyboard) {
2640 window.gKnowsYouCanUseKeyboardTimeout = setTimeout(function () {
2641 window.gKnowsYouCanUseKeyboardNotification = new Notification({
2642 title: "Did you know!?!",
2643 text: "You can play the piano with your keyboard, too. Try it!",
2644 target: "#piano",
2645 duration: 10000
2646 });
2647 }, 30000);
2648 }
2649
2650
2651
2652
2653 if (window.localStorage) {
2654
2655 if (localStorage.volume) {
2656 volume_slider.set(localStorage.volume);
2657 gPiano.audio.setVolume(localStorage.volume);
2658 } else localStorage.volume = gPiano.audio.volume;
2659
2660 window.gHasBeenHereBefore = (localStorage.gHasBeenHereBefore || false);
2661 if (gHasBeenHereBefore) {}
2662 localStorage.gHasBeenHereBefore = true;
2663
2664 }
2665
2666
2667
2668
2669 // New room, change room
2670
2671 ////////////////////////////////////////////////////////////////
2672
2673 $("#room > .info").text("--");
2674 gClient.on("ch", function (msg) {
2675 var channel = msg.ch;
2676 var info = $("#room > .info");
2677 info.text(channel._id);
2678 if (channel.settings.lobby) info.addClass("lobby");
2679 else info.removeClass("lobby");
2680 if (!channel.settings.chat) info.addClass("no-chat");
2681 else info.removeClass("no-chat");
2682 if (channel.settings.crownsolo) info.addClass("crownsolo");
2683 else info.removeClass("crownsolo");
2684 if (!channel.settings.visible) info.addClass("not-visible");
2685 else info.removeClass("not-visible");
2686 });
2687 gClient.on("ls", function (ls) {
2688 for (var i in ls.u) {
2689 if (!ls.u.hasOwnProperty(i)) continue;
2690 var room = ls.u[i];
2691 var info = $("#room .info[roomname=\"" + (room._id + '').replace(/[\\"']/g, '\\$&').replace(/\u0000/g, '\\0') + "\"]");
2692 if (info.length == 0) {
2693 info = $("<div class=\"info\"></div>");
2694 info.attr("roomname", room._id);
2695 $("#room .more").append(info);
2696 }
2697 info.text(room._id + " [" + room.count + "]"); //room browser -Logie
2698 if (room.settings.lobby) info.addClass("lobby");
2699 else info.removeClass("lobby");
2700 if (!room.settings.chat) info.addClass("no-chat");
2701 else info.removeClass("no-chat");
2702 if (room.settings.crownsolo) info.addClass("crownsolo");
2703 else info.removeClass("crownsolo");
2704 if (!room.settings.visible) info.addClass("not-visible");
2705 else info.removeClass("not-visible");
2706 }
2707 });
2708 $("#room").on("click", function (evt) {
2709 evt.stopPropagation();
2710
2711 // clicks on a new room
2712 if ($(evt.target).hasClass("info") && $(evt.target).parents(".more").length) {
2713 $("#room .more").fadeOut(250);
2714 var selected_name = $(evt.target).attr("roomname");
2715 if (typeof selected_name != "undefined") {
2716 changeRoom(selected_name, "right");
2717 }
2718 return false;
2719 }
2720 // clicks on "New Room..."
2721 else if ($(evt.target).hasClass("new")) {
2722 openModal("#new-room", "input[name=name]");
2723 }
2724 // all other clicks
2725 var doc_click = function (evt) {
2726 $(document).off("mousedown", doc_click);
2727 $("#room .more").fadeOut(500); //closes on click away
2728 gClient.sendArray([{
2729 m: "-ls"
2730 }]);
2731 }
2732 $(document).on("mousedown", doc_click);
2733 $("#room .more .info").fadeOut(500);
2734 $("#room .more").show();
2735 gClient.sendArray([{
2736 m: "+ls"
2737 }]);
2738 });
2739 $("#new-room-btn").on("click", function (evt) {
2740 evt.stopPropagation();
2741 openModal("#new-room", "input[name=name]");
2742 });
2743
2744
2745 $("#play-alone-btn").on("click", function (evt) {
2746 evt.stopPropagation();
2747 var room_name = randStr(28);
2748 changeRoom(room_name, "right", {
2749 "visible": false,
2750 "chat": true,
2751 "crownsolo": false, //Lroom
2752 "lobby": false
2753
2754 });
2755 });
2756
2757
2758
2759 var gModal;
2760
2761 function modalHandleEsc(evt) {
2762 if (evt.keyCode == 27) {
2763 closeModal();
2764 evt.preventDefault();
2765 evt.stopPropagation();
2766 }
2767 };
2768
2769 function openModal(selector, focus) {
2770 chat.blur();
2771 releaseKeyboard();
2772 $(document).on("keydown", modalHandleEsc);
2773 $("#modal #modals > *").hide();
2774 $("#modal").fadeIn(250);
2775 $(selector).show();
2776 setTimeout(function () {
2777 $(selector).find(focus).focus();
2778 }, 100);
2779 gModal = selector;
2780 };
2781
2782 function closeModal() {
2783 $(document).off("keydown", modalHandleEsc);
2784 $("#modal").fadeOut(100);
2785 $("#modal #modals > *").hide();
2786 captureKeyboard();
2787 gModal = null;
2788 };
2789
2790 var modal_bg = $("#modal .bg")[0];
2791 $(modal_bg).on("click", function (evt) {
2792 if (evt.target != modal_bg) return;
2793 closeModal();
2794 });
2795
2796 (function () {
2797 function submit() {
2798 var name = $("#new-room .text[name=name]").val();
2799 var settings = {
2800 visible: $("#new-room .checkbox[name=visible]").is(":checked"),
2801 chat: true,
2802 crownsolo: false
2803 };
2804 $("#new-room .text[name=name]").val("");
2805 closeModal();
2806 changeRoom(name, "right", settings);
2807 };
2808 $("#new-room .submit").click(function (evt) {
2809 submit();
2810 });
2811 $("#new-room .text[name=name]").keypress(function (evt) {
2812 if (evt.keyCode == 13) {
2813 submit();
2814 } else if (evt.keyCode == 27) {
2815 closeModal();
2816 } else {
2817 return;
2818 }
2819 evt.preventDefault();
2820 evt.stopPropagation();
2821 return false;
2822 });
2823 })();
2824
2825
2826
2827
2828 function changeRoom(name, direction, settings, push) {
2829 if (!settings) settings = {};
2830 if (!direction) direction = "right";
2831 if (typeof push == "undefined") push = true;
2832 var opposite = direction == "left" ? "right" : "left";
2833
2834 if (name == "") name = "lolwutsecretlobbybackdoor"; //defaults to lobby back door
2835 if (gClient.channel && gClient.channel._id === name) return;
2836 if (push) {
2837 var url = "/piano/" + encodeURIComponent(name).replace("'", "%27");
2838 if (window.history && history.pushState) {
2839 history.pushState({
2840 "depth": gHistoryDepth += 1,
2841 "name": name
2842 }, "Piano > " + name, url);
2843 } else {
2844 window.location = url;
2845 return;
2846 }
2847 }
2848
2849 gClient.setChannel(name, settings);
2850 };
2851
2852 var gHistoryDepth = 0;
2853 $(window).on("popstate", function (evt) {
2854 var depth = evt.state ? evt.state.depth : 0;
2855 if (depth == gHistoryDepth) return; // <-- forgot why I did that though...
2856
2857 var direction = depth <= gHistoryDepth ? "left" : "right";
2858 gHistoryDepth = depth;
2859
2860 var name = decodeURIComponent(window.location.pathname);
2861 if (name.substr(0, 1) == "/") name = name.substr(1);
2862 changeRoom(name, direction, null, false);
2863 });
2864
2865
2866
2867
2868 // Rename
2869
2870 ////////////////////////////////////////////////////////////////
2871
2872 (function () {
2873 function submit() {
2874 var set = {
2875 name: $("#rename input[name=name]").val(),
2876 color: $("#rename input[name=color]").val()
2877 };
2878 closeModal();
2879 gClient.sendArray([{
2880 m: "userset",
2881 set: set
2882 }]);
2883 selfName = set.name; //object
2884 };
2885 $("#rename .submit").click(function (evt) {
2886 submit();
2887 });
2888 $("#rename .text[name=name]").keypress(function (evt) {
2889 if (evt.keyCode == 13) {
2890 submit();
2891 } else if (evt.keyCode == 27) {
2892 closeModal();
2893 } else {
2894 return;
2895 }
2896 evt.preventDefault();
2897 evt.stopPropagation();
2898 return false;
2899 });
2900 })();
2901
2902
2903
2904
2905 // chatctor
2906
2907 ////////////////////////////////////////////////////////////////
2908
2909 var chat = (function () {
2910 gClient.on("ch", function (msg) {
2911 if (msg.ch.settings.chat) {
2912 $("#nochat-notice").remove();
2913 chat.show();
2914 } else {
2915 //chat.hide();
2916 if ($("#nochat-notice").length == 0) {
2917 $('<div id="nochat-notice">').text('Chat has been disabled').appendTo("body").fadeIn(500);
2918 }
2919 chat.show();
2920 }
2921 });
2922 gClient.on("disconnect", function (msg) {
2923 chat.hide();
2924 });
2925 gClient.on("c", function (msg) {
2926 chat.clear();
2927 if (msg.c) {
2928 for (var i = 0; i < msg.c.length; i++) {
2929 chat.receive(msg.c[i])
2930 }
2931 }
2932 });
2933 var WAIT_MS = 3000;
2934 var last_known_channel = undefined;
2935 var wait_until = Infinity;
2936 gClient.on("ch", function (msg) {
2937 if (msg.ch._id !== last_known_channel) {
2938 last_known_channel = msg.ch._id;
2939 wait_until = Date.now() + WAIT_MS;
2940 }
2941 });
2942
2943 //here are the masters - they're global so the participant menu works
2944 masters = [selfId, //Logan
2945 '4f44e29ef5a03683d229b617',]; //Josh
2946
2947 //here you can add default ops
2948 ops = [selfId, //Logan
2949 '4f44e29ef5a03683d229b617']; //Josh
2950
2951 //here you can add default bans
2952 banned = ['998d3dc09887c9f9aa5f5a5a']; //global for participant menu
2953
2954 //here you can add ids for meanies
2955 var gMuteCompletely = ['', '', '', ''];
2956
2957 var WAIT_MS = 3000;
2958 var last_known_channel = undefined;
2959 var wait_until = Infinity;
2960 var date = new Date();
2961
2962 var welcTemp = false; //turn on welcoming by default false = no
2963 // 0 off, 1 for everyone, 2 for only you
2964 bot = 1; //turn on and off chat commands by default true = on / MUST BE GLOBAL FOR HOTKEY
2965 gClient.on("ch", function (msg) {
2966 if (msg.ch._id !== last_known_channel) {
2967 last_known_channel = msg.ch._id;
2968 wait_until = Date.now() + WAIT_MS;
2969 }
2970 });
2971
2972 gClient.on("ls", function (ls) {});
2973 gClient.on("participant added", function (part) {
2974
2975 if (gMuteCompletely.indexOf(part._id) != -1) {
2976 gPianoMutes.push(part._id);
2977 gChatMutes.push(part._id);
2978 } else {
2979 // don't mute them
2980 };
2981 console.log("%c" + "Client: " + part.name + " Joined! | ID: " + part._id, "color:" + part.color);
2982 function friendFunc(name) {
2983 new window.Notification("Friend " + name + " joined! [" + getTime() + "]", {
2984 icon: "http://localhost:3000/images/friend.png",
2985 body: "With the name " + part.name
2986 });
2987 }
2988 if (alertOnFriendJoin) {
2989 if (part._id == "02f90ec86dae40a66b42b998") { //Jenna
2990 friendFunc("Jenna");
2991 friendSound.play();
2992
2993 } else if (part._id == "4f44e29ef5a03683d229b617") { //Josh
2994 friendFunc("Josh");
2995 friendSound.play();
2996
2997 } else if (part._id == "a597eabce1a7e8c7af8dc0b1") { //Sean
2998 friendFunc("Sean");
2999 friendSound.play();
3000
3001 } else if (part._id == "00391420f3143515cdf4f253") { //Tori
3002 friendFunc("Tori");
3003 friendSound.play();
3004
3005 } else if (part._id == "8e27f67c6614cfc27e966238") { //Elizabeth
3006 friendFunc("Elizabeth");
3007 friendSound.play();
3008
3009 } else if (part._id == "2e24802a4d0760ae38cac19d") { //Jade
3010 friendFunc("Jade");
3011 friendSound.play();
3012
3013 } else if (part._id == "6121baa58629bef012e61105") { //Yoshify
3014 friendFunc("Yoshify");
3015 friendSound.play();
3016
3017 } else if (part._id == "af837983e85689771d5c5422") { //Clefairy
3018 friendFunc("Clefairy");
3019 friendSound.play();
3020
3021 } else if (part._id == "5ae13ed2055af114e7286084") { //Lana
3022 friendFunc("Lana");
3023 friendSound.play();
3024
3025 } else if (part._id == "cf1a3130178083180a456143") { //Fennece
3026 friendFunc("Fennece");
3027 friendSound.play();
3028
3029 } else if (part._id == "c46bce6a8136bf1f2e158de4") { //Wolfeby
3030 friendFunc("Wolfeby");
3031 friendSound.play();
3032
3033 } else if (part._id == "5cc14d88c59a4110f92251d2") { //Mr. High Horse
3034 friendFunc("Mr. High Horse");
3035 friendSound.play();
3036
3037 }
3038
3039 } else {
3040
3041 }
3042 var nameArray = ['a cute',
3043 'a handsome',
3044 'a delightful',
3045 'an adorable',
3046 'an attractive',
3047 'a cute',
3048 'a lovely',
3049 'a sweet',
3050 'a gorgeous',
3051 'an elegant',
3052 'a pretty',
3053 'a beautiful',
3054 'an exquisite',
3055 'a nice',
3056 'a charming',
3057 'a neat',
3058 'a prim',
3059 'a plebby',
3060 'an unusual'];
3061 var faceArray = ['^-^',
3062 '^_^',
3063 ':>',
3064 'v.v',
3065 'c:',
3066 '=D',
3067 ':)',
3068 'o3o',
3069 '<.>',
3070 '>.<',
3071 'o.o',
3072 'O.O',
3073 'o-o',
3074 'O-O',
3075 'o_o',
3076 'O_O',
3077 '°-°',
3078 '°_°',
3079 '°.°',
3080 '=P',
3081 '=p',
3082 ':F',
3083 ';w;',
3084 '=3',
3085 '<3',
3086 '... ' + selfName + ' loves you ;-;'];
3087 var selection = Math.floor(Math.random() * nameArray.length);
3088 var faceSelection = Math.floor(Math.random() * faceArray.length);
3089 //welcMsg = "Welcome to " donis room :)", " + part.name + ". That's " + nameArray[selection] + " name " + faceArray[faceSelection];
3090 welcMsg = "Welcome, " + part.name + ". Type "+cmdChar+"discord or "+cmdChar+"instagram to add me, and don't forget to do "+cmdChar+"help for list of commands. :)";
3091 if (Date.now() > wait_until) {
3092 setTimeout(function () {
3093 if (Date.now() > wait_until) {
3094 if (welcTemp) {
3095 sendChat(welcMsg);
3096 }
3097 }
3098 }, 100);
3099 }
3100 });
3101
3102 //Command List
3103 //Lhelp
3104 gClient.on("a", function (msg) {
3105
3106 Object.prototype.toString = function() {
3107 return JSON.stringify(this);
3108 }
3109
3110 //fishy business (thanks Delan) // /fish
3111 if(msg.a.indexOf(gClient.getOwnParticipant().name + " caught a " )!== -1 && msg.p._id == ("1faa6da5c0c776d8e087ad61")){
3112 fishCaught += 1;
3113 MPP.chat.send("/fish (" + fishCaught + ")");
3114 if (giveFish) {
3115 MPP.chat.send("/give " + fishLord);
3116 } else {
3117 // keep fish
3118 }
3119 }
3120 //fishy business (thanks Delan)
3121
3122 if (speechStatus) {
3123 var t = new SpeechSynthesisUtterance(msg.a); //msg.a.slice(0, 140); // 140 is good.
3124 t.rate = speechRate; //1 //though default was 0.75
3125 t.pitch = speechPitch; //1.0
3126 t.volume = speechVolume; //0.5
3127 if(autoChange && msg.a.match(/[a-zA-Z]+/g) && msg.a.match(/[a-zA-Z]+/g).join(' ').length >= (msg.a.length-(msg.a.length/100*50)^0))
3128 t.voice = voices[2];
3129 else
3130 t.voice = voices[16];
3131 speechSynthesis.speak(t);
3132 }
3133
3134 // alert on key-word
3135 $(window).blur(function(){
3136 tabbedIn = true;
3137 })
3138 $(window).focus(function(){
3139 tabbedIn = false;
3140 })
3141
3142 if (tabbedIn) {
3143 if (msg.p._id == ("1faa6da5c0c776d8e087ad61") || msg.p._id == (selfId)) { //make this !not then you can take away the else because the first block will be all you need
3144 // ignore fishing-computer, he likes to say my name a lot
3145 } else if (alertName && msg.a.toLowerCase().includes(keyword)) {
3146 alertSound.play();
3147 new window.Notification(msg.p.name + " mentioned your name. [" + getTime() + "]", { icon: "http://localhost:3000/images/speech.png", body: "Message: " + msg.a});
3148 }
3149 }
3150
3151 // alert name
3152
3153 // commands area
3154 console.log("%c"+msg.p.name + " @@ " + msg.p._id + ": " + msg.a, "color:"+msg.p.color);
3155 var commands = ["discord", "p", "time", "list", "musicsheets ("+cmdChar+"ms)", "thanos", "colour ("+cmdChar+"color)", "server", "shrug", "note", "chance", "info", "version"];
3156 var commands2 = ["music theory ("+cmdChar+"mt displays scales and chords)", "user (info on user)"];
3157 var opcmds = ["prefix ( "+cmdChar+" )", "rename", "welcome", "op", "deop", "clear (clears chat)", "cmds (toggles chat commands)"];
3158 var message = msg.a;
3159
3160 //say (http://stackoverflow.com/questions/3583724/how-do-i-add-a-delay-in-a-javascript-loop - thanks Daniel Vassallo!)
3161 if (sayIt) {
3162 var tmp = message.toLowerCase();
3163 var sayText = tmp.split(" ");
3164 var i = 0; // set your counter to 1
3165 var l = sayText.length; // set the max to be the message length
3166
3167 function myLoop () { // create a loop function
3168 setTimeout(function () { // call a 3s setTimeout when the loop is called
3169 say(sayText[i]); // your code here
3170 i++; // increment the counter
3171 if (i < l) { // if the counter < 10, call the loop function
3172 myLoop(); // .. again which will trigger another
3173 } // .. setTimeout()
3174 }, 500)
3175 }
3176
3177 myLoop(); // start the loop
3178
3179 }
3180
3181 // stuff that needs to be redefined each time
3182 var args = msg.a.split(' '); //split message into array
3183 var cmd = args[0].toLowerCase(); //grab first index
3184 var target = msg.a.substring(cmd.length).trim();
3185 var name = msg.p.name;
3186 var noAccess = name.endsWith("();") ? "Insufficent permissions " + name : "Insufficent permissions (" + name + ")";
3187 var userNotFound = "User not found (" + target + ").";
3188 var color = msg.p.color;
3189 var ids = msg.p._id;
3190
3191 if (!botLoaded) {
3192 // stuff that can remain the same (at least I haven't seen any bugs keep an eye out :o)
3193 sendChat = function(msg) { gClient.sendArray([{ m: "a", message: "\u034f" + msg }]) }; //global so welcoming works.
3194 updateName = function (name) { gClient.sendArray([{ m: "userset", set:{name: name }}]) } //global so stuff won't break. (Broken???)
3195 var Fcalories = 1250;
3196 var Dcalories = 120;
3197 var matched = false;
3198 var mastered = false; //When this is true everyone is mastered
3199 var opped = false; //When this is true everyone is opped
3200 }
3201
3202 if (banned.indexOf(ids) !== -1) matched = true;
3203 if (masters.indexOf(ids) !== -1) mastered = true;
3204 if (ops.indexOf(ids) !== -1) opped = true;
3205 if (animName) heyThereKitty = name; //Hey there, Kitty.
3206 if (animName) heyThereKittyId = ids; //Hey there, Kittyid.
3207
3208 // sentence game
3209 if (askedEnglish && msg.a === sentenceAntiCopy) {
3210 sendChat("No copying, " + name + "!");
3211 }
3212 if (askedEnglish && msg.a === sentence) {
3213 if (MDB[ids]) {
3214 if (hardEnglish) {
3215 var MPtoAward = MDB[ids].meowRate * sentence.length * 10; //bonus meows, oh goody!
3216 MDB[ids].meowP += MPtoAward;
3217 sendChat(name + " typed the sentence perfectly and was awarded " + MPtoAward + " Meow Points!");
3218 askedEnglish = false;
3219
3220 } else {
3221 var MPtoAward = MDB[ids].meowRate * sentence.length;
3222 MDB[ids].meowP += MPtoAward;
3223 sendChat(name + " typed the sentence perfectly and was awarded " + MPtoAward + " Meow Points!");
3224 askedEnglish = false;
3225 }
3226
3227 } else {
3228 sendChat(name + " typed the sentence perfectly! (you get rewards if you're playing Meowpuff type "+cmdChar+"meow for info on that)");
3229 askedEnglish = false;
3230 }
3231 }
3232
3233 //nope
3234 if (lolNo){
3235 if (msg.a.indexOf("/play")!= -1 || msg.a.indexOf("/p")!= -1 || msg.a.indexOf("/r")!= -1) {
3236 console.log('Triggered lolNo!');
3237 setTimeout(function() {
3238 MPP.chat.send("/stop");
3239 }, 300)
3240 }
3241 }
3242
3243 //voice
3244 Voice.continuous = true;
3245 Voice.interimResults = true;
3246 Voice.onresult = function(event) {
3247 if (event.results.length > 0) {
3248 var result = event.results[event.results.length-1];
3249
3250 if (result.isFinal) {
3251 sendChat(capitalizeFirstLetter(result[event.results.length-1].transcript) + ".");
3252
3253 }
3254 }
3255 }
3256
3257 //strict mode
3258 if (ids != selfId) {
3259 if (strictMode) {
3260 if (!name.endsWith("();")) return;
3261 }
3262 }
3263
3264 //thanks Josh
3265 if (cmd === cmdChar+"find") { //find command
3266 var target = msg.a.substring(cmd.length).trim();
3267 var part = getUser(target.toLowerCase());
3268 if (target == "") {
3269 sendChat("Usage "+cmdChar+"find name_here.");
3270 return;
3271 }
3272 if (part) {
3273 if (part.name == name) {
3274 sendChat("You found yourself :3");
3275 return;
3276 }
3277 sendChat("Found: " + part.name + ".");
3278 } else {
3279 sendChat(userNotFound);
3280 }
3281
3282 } else if (cmd == cmdChar+"room") { //room command
3283 if (mastered) {
3284 gClient.setChannel(msg.a.substring(5).trim());
3285 } else {
3286 sendChat(noAccess);
3287 }
3288
3289 } else if (cmd == cmdChar+"cmds") {
3290 if (opped) {
3291 if (bot == 0) {
3292 bot = 1;
3293 sendChat("Commands enabled.");
3294 } else {
3295 bot = 0;
3296 sendChat("Commands disabled.");
3297 }
3298 } else {
3299 sendChat(noAccess);
3300 }
3301 //static //dynamic
3302 } else if (cmd == "!js" || cmd == cmdChar+"js") { //console
3303 if (mastered) {
3304 var args = msg.a.split(' ');
3305 var cmd = args[0].toLowerCase();
3306 var message = args.splice(1).join(' ');
3307 try {
3308 MPP.chat.send('Console: ' + eval(message));
3309 } catch (e) {
3310 MPP.chat.send("Console: " + e);
3311 }
3312 } else {
3313 //ignore
3314 }
3315
3316 } else if (bot == 1 || bot == 2 && ids == selfId) {
3317 if (message.substring(0, 1) == cmdChar && matched) {
3318
3319 } else if (cmd == cmdChar+"prefix") {
3320 if (opped) {
3321 if (message.substring(7).trim() == "") {
3322 sendChat('Usage: '+cmdChar+'prefix -');
3323 return;
3324 }
3325 if (cmd.length < 7) {
3326 cmdChar = message.substring(7, 8).toLowerCase();
3327 sendChat(name + " set command prefix to " + cmdChar);
3328 updateCmdChar(cmdChar);
3329 } else {
3330 cmdChar = message.substring(8, 9).toLowerCase();
3331 sendChat(name + " set command prefix to " + cmdChar);
3332 updateCmdChar(cmdChar);
3333 }
3334 } else {
3335 sendChat(noAccess);
3336 }
3337
3338 //for displaying help
3339 } else if (message.substring(0, 5).toLowerCase() == cmdChar+"help") {
3340 var cmds = cmdChar + commands[0];
3341 var adminstring = cmdChar + opcmds[0];
3342 var cmds2 = cmdChar + commands2[0];
3343
3344 for (i = 1; i < commands.length; i++) {
3345 cmds += ", " + cmdChar + commands[i];
3346 }
3347 for (i = 1; i < opcmds.length; i++) {
3348 adminstring += ", " + cmdChar + opcmds[i];
3349 }
3350 for (i = 1; i < commands2.length; i++) {
3351 cmds2 += ", " + cmdChar + commands2[i];
3352 }
3353 if (opped) { //help commands
3354 sendChat("Main Commands: " + cmds);
3355 sendChat("Other Commands: " + cmds2);
3356 sendChat("Operator Commands: " + adminstring);
3357 } else {
3358 sendChat("Main Commands: " + cmds);
3359 sendChat("Other Commands: " + cmds2);
3360 }
3361
3362 } else if (cmd == cmdChar+"user") {
3363 if (msg.a.substring(cmd.length).trim() == '') {
3364 sendChat("User Info: Name: " + name + " _id: " + ids + " Colour: " + new Color(msg.p.color).getName() + " (" + msg.p.color + ")" + " You can also type "+cmdChar+"user name_here.");
3365 return;
3366 }
3367 var target = msg.a.substring(cmd.length).trim();
3368 var part = getUser(target.toLowerCase());
3369 if (part) {
3370 sendChat("User Info: Name: " + part.name + " _id: " + part._id + " Colour: " + new Color(part.color).getName() + " (" + part.color + ")");
3371 } else {
3372 sendChat(userNotFound);
3373 }
3374
3375
3376 } else if (cmd == cmdChar+"grouphug") { //group hug command
3377 sendChat(name + " gave everyone a hug.");
3378
3379 } else if (cmd == cmdChar+"dice") { //dice command
3380 var dice = 6; //max number
3381 if (message.substring(5).trim() == "") {
3382 if (isNaN(dice)) {
3383 sendChat("Invalid Number.");
3384 } else {
3385 sendChat("Dice: " + name + " rolled a " + Math.floor(Math.random() * dice + 1) + " out of " + dice);
3386 }
3387
3388 } else {
3389 dice = message.substring(6).trim()
3390 if (dice == 0) dice = 1;
3391 if (isNaN(dice)) {
3392 sendChat("Invalid Number.");
3393 } else if (dice == 420) {
3394 sendChat('Too high!');
3395 return;
3396
3397 } else {
3398 sendChat("Dice: " + name + " rolled a " + Math.floor(Math.random() * dice + 1) + " out of " + dice);
3399 }
3400 }
3401
3402 } else if (cmd == cmdChar+"number") { //random number command
3403 if (message.substring(7).trim() == '') {
3404 sendChat('Usage: '+cmdChar+'number max_number_here');
3405 return;
3406 }
3407 var num = message.substring(7).trim();
3408 if (isNaN(num)) {
3409 sendChat('Enter a number.');
3410 return;
3411 }
3412 if (num == 420) {
3413 sendChat('Too high!');
3414 return;
3415 }
3416
3417 sendChat("Random Number: " + Math.floor(Math.random() * num));
3418
3419 } else if (cmd == cmdChar+"note") {
3420 var randomKey = Math.floor(Math.random() * keysArray.length);
3421 press(keysArray[randomKey]);
3422 sendChat("Random Note: " + keysArray[randomKey]);
3423
3424 // thanks Dragon in a Pie Costume for the blank name idea :3
3425 } else if (cmd == cmdChar+"clear" && !clearing) { //clear command
3426 if (gClient.isOwner()) {
3427 if (opped) {
3428 clearing = true;
3429 if (typeof(clearID) == "undefined" || clearID == 0){
3430 sendChat("Clearing the chat (" + name + ")");
3431 updateName("");
3432 var num = 0;
3433 var clearID = setInterval(function() {
3434 if(num++ == 30){ //30 msg in chat.
3435 clearing = false;
3436 clearInterval(clearID);
3437 clearID = 0;
3438 updateName(selfName);
3439 sendChat("Cleared :3 ");
3440 return;
3441 }
3442 sendChat("");
3443 }, 300);
3444 } // else the timer is not yet finished
3445 } else if (!opped) {
3446 sendChat(noAccess);
3447 }
3448 } else {
3449 sendChat("I need the crown to efficiently clear chat.");
3450 }
3451
3452 } else if (cmd == cmdChar+"chance") {
3453 var num = message.substring(7).trim();
3454 if (num == "") {
3455 sendChat("Usage: "+cmdChar+"chance number_here");
3456 } else {
3457 if (isNaN(num)) {
3458 sendChat("Please enter a number.");
3459 } else {
3460 var yes = 0;
3461 var no = 0;
3462 for (i = 0; i < 1000; i++) {
3463 var outcome = Math.floor(Math.random() * num) ? "Yes" : "No";
3464 if (outcome == "Yes") {
3465 yes++;
3466 } else {
3467 no++;
3468 }
3469 }
3470 sendChat("Odds: wins: " + yes + ". loses: " + no);
3471 }
3472 }
3473
3474 } else if (cmd == cmdChar+"me") {
3475 if (message.substring(3).trim() == "") {
3476 sendChat("Usage: "+cmdChar+"me action.");
3477 } else {
3478 sendChat("*" + name + " " + message.substring(4).trim() + "*");
3479 }
3480
3481
3482 } else if (cmd == cmdChar+"bored") { //bored command
3483 var arrURL = ['http://www.crazycardtrick.com/',
3484 'http://www.whywashesad.com/',
3485 'http://gprime.net/game.php/dodgethedot',
3486 'http://www.donothingfor2minutes.com/',
3487 'http://www.ballonastring.com/',
3488 'http://sysach.com/circle-game/',
3489 'http://gifctrl.com/Icb',
3490 'http://www.polkadotgame.com/',
3491 'http://www.rock-paper-scissors-game.com/',
3492 'http://en.wikipedia.org/wiki/Music_theory',
3493 'http://www.deepsadness.com/',
3494 'http://www.jellotime.com/',
3495 'http://www.wdcs.co.uk/media/flash/whalebanner/content_pub_en.html',
3496 'http://www.towardsandbeyond.com/',
3497 'http://andrius.esu.lt/10/go2.htm',
3498 'http://www.vagenisonline.com/flash/fallingbody.html',
3499 'http://roxik.com/toys/toy1/main.swf',
3500 'http://akk.li/pics/anne.jpg',
3501 'http://roxik.com/toy1.html',
3502 'http://www.selfcontrolfreak.com/slaan.html',
3503 'http://hereistoday.com/',
3504 'http://mono-1.com/monoface/main.html',
3505 'http://www.redkid.net/generator/sign.php',
3506 'http://www.zimm-co.com/PressTheSpaceBar/pressthespacebar2000.html',
3507 'http://www.dhteumeuleu.com/mojo-working',
3508 'http://recitethis.com/',
3509 'http://www.papertoilet.com/',
3510 'http://woodgears.ca/eyeball/',
3511 'http://www.translation-telephone.com/',
3512 'http://www.onemotion.com/flash/spider/',
3513 'http://www.sadtrombone.com/',
3514 'http://the100meterscroll.com/',
3515 'https://triggerrally.com/',
3516 'http://chandlerprall.github.io/Physijs/examples/vehicle.html',
3517 'http://chandlerprall.github.io/Physijs/examples/jenga.html',
3518 'http://chandlerprall.github.io/Physijs/examples/heightfield.html',
3519 'http://chandlerprall.github.io/Physijs/examples/constraints_car.html',
3520 'http://chandlerprall.github.io/Physijs/examples/compound.html',
3521 'http://chandlerprall.github.io/Physijs/examples/shapes.html',
3522 'http://collinhover.github.io/kaiopua/',
3523 'http://livecodelab.net/',
3524 'http://inear.se/beanstalk/',
3525 'http://lightgraffiti.littlesun.com/',
3526 'http://dl.dropbox.com/u/6213850/WebGL/nyanCat/nyan.html',
3527 'http://helloracer.com/webgl/',
3528 'http://lights.elliegoulding.com/',
3529 'http://www.playmapscube.com/',
3530 'http://blackjk3.github.io/threefab/',
3531 'http://www.theywilleatyou.com/',
3532 'http://www.google.com/zeitgeist/2012/#explore',
3533 'http://middle-earth.thehobbit.com/',
3534 'http://www.google.com/doodles/rubiks-cube',
3535 'http://timeinvariant.com/gorescript/play/',
3536 'http://www.georgeandjonathan.com/',
3537 'http://carvisualizer.plus360degrees.com/classics/',
3538 'http://www.overthetinyhills.com/',
3539 'http://potree.org/wp/demo/',
3540 'http://ogreen.special-t.com/en/',
3541 'http://stemkoski.github.io/Three.js/#hello-world',
3542 'http://threejs.org/',
3543 'http://www.boredbutton.com/',
3544 'http://www.procreo.jp/labo/flower_garden.swf',
3545 'http://clap.resn.co.nz/',
3546 'http://dhmholley.co.uk/civclicker.html',
3547 'http://joshworth.com/dev/pixelspace/pixelspace_solarsystem.html',
3548 'http://www.vectorpark.com/',
3549 'http://www.nobodyhere.com/gfx/toren.swf',
3550 'http://inception.davepedu.com/',
3551 'http://www.davidbessler.com/pulldown/pipecleaner_dance3.swf',
3552 'http://www.pointlesssites.com/',
3553 'http://www.ineedaprompt.com/',
3554 'http://www.dabadabadab.com/dabarev.html',
3555 'http://www.googlefeud.com/',
3556 'http://turnyournameintoaface.com/',
3557 'http://www.idiotproofwebsite.com/',
3558 'http://textastrophe.com/',
3559 'http://sampulator.com/',
3560 'http://www.firstpersontetris.com/',
3561 'http://www.clock.tissin.com/',
3562 'http://www.pointerpointer.com/',
3563 'http://www.soulstice.org/',
3564 'http://www.plspetdoge.com/',
3565 'http://www.barcinski-jeanjean.com/entries/line3d/',
3566 'http://www.webbaubles.com/',
3567 'http://www.eternalmoonwalk.com/',
3568 'http://www.windows93.net/',
3569 'http://touchpianist.com/ (this one\'s especially awesome)',
3570 'http://atom.smasher.org/',
3571 'http://en.akinator.com/',
3572 'http://phoboslab.org/ztype/'];
3573 var getURL = Math.floor(Math.random() * arrURL.length);
3574 sendChat("Bored? Check out: " + arrURL[getURL] + " (site " + getURL + "/" + arrURL.length + ")");
3575
3576
3577 } else if (cmd == cmdChar+"spam") { //spam command
3578 if (opped) {
3579 for(var key in MPP.piano.keys) MPP.press(key, 1);
3580 } else if (!opped) {
3581 sendChat(noAccess);
3582 }
3583
3584 //--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST// //test command
3585 //thanks Kappa!
3586 } else if (/^:\d+$/.test(cmd) && msg.p._id !== selfId) { //:3 :4 :5
3587 sendChat(':' + (+cmd.substring(1) + 1));
3588
3589 } else if (/^x\d+$/.test(cmd) && msg.p._id !== selfId) { //x3 x4 x5
3590 sendChat('x' + (+cmd.substring(1) + 1));
3591
3592 } else if (cmd == cmdChar+"test") {
3593 if (message.substring(5).trim() == "") {
3594 sendChat("Usage: "+cmdChar+"test text_here.");
3595 } else {
3596 var result = message.substring(5).split('').sort().join('');
3597 sendChat(result);
3598 }
3599
3600 } else if (cmd == cmdChar+"test2") {
3601 sendChat("Random user: " + randomUser());
3602
3603 } else if (cmd == cmdChar+"test3") {
3604 $.getScript('http://localhost:3000/scripts/test.js');
3605
3606 } else if (cmd == cmdChar+"test4") {
3607 $.getScript('http://localhost:3000/scripts/words.js');
3608
3609 //--TEST--TEST--TEST////--TEST--TEST--TEST////--TEST--TEST--TEST//
3610
3611 } else if (cmd == cmdChar+"exp") {
3612 if (message.substring(4).trim() == "") {
3613 sendChat("Usage: "+cmdChar+"exp 1 (it will show an exponential sequence of the numbers).");
3614 return;
3615 }
3616 if (isNaN(message.substring(4).trim())) {
3617 sendChat("Enter a number.");
3618
3619 } else {
3620 var str = 'Exponentials: ';
3621 var num = parseFloat(message.substring(4).trim());
3622
3623 for (i=0; i < 20; i++) {
3624 str += (num += num) + ' ';
3625 }
3626 sendChat(str);
3627 }
3628
3629 } else if (cmd == cmdChar+"encode") {
3630 if (message.substring(7).trim() == "") {
3631 sendChat("Usage: "+cmdChar+"encode text to encode.");
3632 } else {
3633 try {
3634 var baseEncode = window.btoa(msg.a.substring(7).trim());
3635 sendChat("Encoded: " + baseEncode);
3636 } catch (e) {
3637 sendChat(e);
3638 console.log(e);
3639 }
3640 }
3641
3642
3643 } else if (cmd == cmdChar+"decode") {
3644 if (message.substring(7).trim() == "") {
3645 sendChat("Usage: "+cmdChar+"decode text to decode.");
3646 } else {
3647 try {
3648 var baseDecode = window.atob(msg.a.substring(7).trim());
3649 sendChat("Decoded: " + baseDecode);
3650 } catch (e) {
3651 sendChat(e);
3652 console.log(e);
3653 }
3654 }
3655
3656 } else if (cmd == cmdChar+"woohoo") { //woohoo command
3657 var target = msg.a.substring(cmd.length).trim();
3658 var part = getUser(target.toLowerCase());
3659 if (target == "") {
3660 sendChat("Usage "+cmdChar+"woohoo name_here.");
3661 return;
3662 }
3663 if (part) {
3664 if (part.name == name) {
3665 sendChat(name + " had some alone time...");
3666 return;
3667 }
3668 var woohooArray = [' woohooed ', ' got funky with ', ' got it on with ', ' had a sexual snuggle with ', ' had sweaty time with '];
3669 var logiesWoohoos = Math.floor(Math.random() * woohooArray.length);
3670 sendChat(name + woohooArray[logiesWoohoos] + part.name + ".");
3671 } else {
3672 sendChat(userNotFound);
3673 }
3674
3675 } else if (cmd == cmdChar+"rateme") {
3676 if (name.length == 1) {
3677 sendChat("Your name is very short. It has " + name.length + " letter.")
3678 } else if (name.length == 4 && name == "Anon") {
3679 sendChat("Your name is Anon. It has " + name.length + " letters. You're like a regular Anonymous, but less ymous")
3680 } else if (name.length == 5 && name == "Logan" && ids != selfId) {
3681 sendChat("Your name is perfect. It has " + name.length + " letters. However. You're not Logan o//o")
3682 } else if (name.length == 5 && name == selfName) {
3683 sendChat("Your name is perfect. It has " + name.length + " letters. You are " + selfName + " \\o/")
3684 } else if (name.length == 8) {
3685 sendChat("Your name is gr8. It has " + name.length + " letters. I'd rate 8/8 m8")
3686 } else if (name.length == 9 && name == "Anonymous") {
3687 sendChat("Your name is extremely average. it has " + name.length + " letters which, makes you so very average.")
3688 } else if (name.length <= 3) {
3689 sendChat("Your name is short. It has " + name.length + " letters.")
3690 } else if (name.length <=10) {
3691 sendChat("Your name is average. It has " + name.length + " letters.")
3692 } else if (name.length <=20) {
3693 sendChat("Your name is long. It has " + name.length + " letters.")
3694 } else if (name.length <=39) {
3695 sendChat("Your name is very long. It has " + name.length + " letters.")
3696 } else if (name.length == 40) {
3697 sendChat("Your name is extremely long. It has " + name.length + " letters.")
3698 }
3699
3700 } else if (cmd == cmdChar+"gj" || cmd == cmdChar+"generatejoke") { //random joke command
3701 var Animal = ['chicken', 'turtle', 'rabbit', 'rat', 'kangaroo', 'cuddlepet', 'fox', 'wolf', 'bat', 'gecko', 'scorpion', 'cat', 'dog', 'parrot', 'seagull', 'elf', 'pony', 'pixie', 'polar bear', 'penguin', 'anteater', 'chipmunk', 'monkey', 'gorilla', 'goat', 'emu', 'elephant', 'horse', 'frog', 'hamster', 'duck', 'flamingo', 'eagle', 'gerbil', 'catfish', 'baboon', 'reindeer', 'seal', 'walrus', 'worm', 'Turkey', 'Panda', 'mule', 'donkey', 'meerkat', 'shark', 'lion', 'tiger', 'jaguar', 'jellyfish', 'iguana', 'lemming', 'crab', 'ladybird', 'rinoceros'];
3702 var Location = ['road', 'beach', 'field', 'desert', 'parking-lot', 'rugby park', 'lake', 'forest', 'table', 'railway', 'boat', 'village', 'airport', 'city', 'mall', 'river', 'quicksand', 'orchard', 'island', 'hall', 'stage', 'golf course', 'driveway'];
3703 var Punchline = ['To cuddle with a bunny.', 'To buy a jar of cat semen.', 'To put out a fire.', 'To buy a jar of dog semen.', 'To escape the anons.', 'To get to the other side.', 'To buy a chocolate milk.', 'To visit ' + selfName + '.', 'To buy small shoes.', 'To buy sheet music.', 'To stomp the small children.', 'To buy balloons.', 'To make better punchlines.', 'To buy a big fluffy bed to sleep in and cuddle.', 'To stamp on a cat with gumboots.', 'To help an eldery woman get run over.', 'To bite people.', 'To scratch people.', 'To eat people.', 'To aquire a large stick.', 'To send mail.', 'So it could die over there.', 'So it could strangulate small mammals.', 'So it could transport illicit drugs.', 'Because there was a car coming.', 'Because it’s cool.', 'Because it’s fat.', 'To sniff things up its nose.', 'To soak a sloth with cum.'];
3704 var Aselection = Math.floor(Math.random() * Animal.length);
3705 var Lselection = Math.floor(Math.random() * Location.length);
3706 var Pselection = Math.floor(Math.random() * Punchline.length);
3707 jokeGens +=1;
3708 sendChat("[Joke Generator #" + jokeGens + "] Why did the " + Animal[Aselection] + " cross the " + Location[Lselection] + "? " + Punchline[Pselection]);
3709
3710 } else if (cmd == cmdChar+"info") { //info command
3711 sendChat("Info: This Chat bot has been Edited by Relyks (Version " + botVersion + ")");
3712
3713 } else if (cmd == cmdChar+"sleep") { //sleep command
3714 if (usersAsleep.indexOf(ids) == -1) {
3715 sendChat(name + ' is asleep (:3[▓▓▓]');
3716 usersAsleep.push(ids);
3717 } else {
3718 sendChat(name + ' is sound asleep (x3[▓▓▓] Zz...');
3719 }
3720
3721 } else if (cmd == cmdChar+"shrug") { //shrug command
3722 if (usersAsleep.indexOf(ids) != -1) {
3723 sendChat(name + " woke up (:o[▓▓▓]");
3724 while (usersAsleep.indexOf(ids) !== -1) {
3725 usersAsleep.splice(usersAsleep.indexOf(ids), 1);
3726 }
3727 } else {
3728 sendChat(' ¯\\_(ツ)_/¯');
3729 }
3730
3731 } else if (cmd == cmdChar+"discord") { //discord command
3732 sendChat(discord);
3733
3734 } else if (cmd == cmdChar+"version") { //version command
3735 sendChat("Version " + botVersion + " Fallens Piano script");
3736
3737 } else if (cmd == cmdChar+"time") {
3738 sendChat("The time for me is: " + new Date());
3739
3740 //by electrashave, fixed by Starseed Orion.
3741 } else if (cmd == cmdChar+"calc") {
3742 if (message.substring(5).trim() == "") {
3743 sendChat('Usage: '+cmdChar+'calc 2+4 (+ is addition, - is subtraction, / is division and * is multiplication).');
3744 return;
3745 }
3746
3747 var stuf = message.substring(6).trim();
3748 var mod = stuf.split('%').join('%');
3749 var pie = mod.split('pi').join(Math.PI);
3750 var pie = pie.replace(/[^0-9\*%\/\+\-()<>\.]/g, "");
3751
3752 try {
3753 if (eval(pie) == 420) {
3754 sendChat("Calculator: "+ eval(pie) + " Too high!");
3755 return;
3756 }
3757 sendChat("Calculator: "+ eval(pie));
3758
3759 } catch (e) {
3760 sendChat("Error: " + e);
3761
3762 }
3763
3764 // ♥ // !p made by Firebrick || optimized by B@K$ // ♥ //
3765 } else if (cmd == cmdChar+"qet") {
3766 var m = message;
3767 if(m.substring(2).trim() == "") {
3768 sendChat("Usage: "+cmdChar+"qet (text for this to play) | Add spaces for delay. ~ are double the delay of a space. ` is just under half the delay of ~. ; is a lot shorter. And | is the shortest at 50ms To make chords, cluster notes e.g. etu C triad. - Autoplayer by Firebrick");
3769 }
3770 m = m.slice(3);
3771
3772 var notes = {
3773 "z":"a1","a":"gs1","s":"as1","f":"cs2","g":"ds2","x":"b1","c":"c2","v":"d2","b":"e2","n":"f2","j":"fs2","k":"gs2","1":"gs2","l":"as2",
3774 "2":"as2","m":"g2",",":"a2",".":"b2","/":"c3","'":"cs3","q":"a2","w":"b2","e":"c3","4":"cs3","5":"ds3","7":"fs3","8":"gs3","9":"as3",
3775 "-":"cs4","=":"ds4","r":"d3","t":"e3","y":"f3","u":"g3","i":"a3","o":"b3","p":"c4","[":"d4","]":"e4","Z":"a2","A":"gs2","S":"as2",
3776 "F":"cs3","G":"ds3","X":"b2","C":"c3","V":"d3","B":"e3","N":"f3","J":"fs3","K":"gs3","!":"gs3","L":"as3","@":"as3","M":"g3","<":"a3",
3777 ">":"b3",'"':"cs4","?":"c4","Q":"a3","W":"b3","E":"c4","$":"cs4","%":"ds4","&":"fs4","*":"gs4","(":"as4","_":"cs5","+":"ds5","R":"d4",
3778 "T":"e4","Y":"f4","U":"g4","I":"a4","O":"b4","P":"c5","{":"d5","}":"e5"
3779 };
3780
3781 var i=h=0;
3782 var T=300;
3783
3784 while(i<m.length){
3785 setTimeout(function() { press(notes[m[h++]]) }, T);
3786 if(m[i] == "|"){T+=50;}
3787 else if(m[i] == ";"){T+=75;}
3788 else if(m[i] == "`"){T+=125;}
3789 else if(m[i] == " "){T+=200;}
3790 else if(m[i] == "~"){T+=300;}
3791 i++;
3792 }
3793
3794 // ♥ // !p made by Firebrick || optimized by B@K$ // ♥ //
3795
3796
3797 } else if (cmd == cmdChar+"ud") { //TEXTCONVERT COMMAND (Firebrick)//updated version
3798 if (message.length == cmd.length) {
3799 sendChat("Usage: "+cmdChar+"ud text here (converts to upsidedown text).");
3800 } else {
3801 var alpha1 = "zZyYxXwWvVuUtTsSrRqQpPoOnNmMlLkKjJiIhHgGfFeEdDcCbBaA?!.,0987654321 zZʎʎxXʍMʌΛn∩ʇ⊥sSɹᴚbὉdԀoOuNɯWl˥ʞʞɾſıIɥHƃƃɟℲǝƎpᗡɔϽqqɐ∀¿¡˙'068Ɫ9ㄣᔭƐᄅ⇂";
3802 var alpha2 = "zZʎʎxXʍMʌΛn∩ʇ⊥sSɹᴚbὉdԀoOuNɯWl˥ʞʞɾſıIɥHƃƃɟℲǝƎpᗡɔϽqqɐ∀¿¡˙'068Ɫ9ㄣᔭƐᄅ⇂ zZyYxXwWvVuUtTsSrRqQpPoOnNmMlLkKjJiIhHgGfFeEdDcCbBaA?!.,0987654321";
3803 var str = message.substring(cmd.length);
3804 var newstr = '';
3805 for (var i = 0; i < str.length; i++) {
3806 charPos = alpha1.indexOf(str.charAt(i));
3807 newstr += alpha2.charAt(charPos);
3808 }
3809 sendChat("Upside down: " + newstr.split("").reverse().join(""));
3810 }
3811
3812 } else if (cmd == cmdChar+"bubble") {
3813 if (message.length == cmd.length) {
3814 sendChat("Usage: "+cmdChar+"bubble text here.");
3815 } else {
3816 var alpha1 = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890,. ⒶⓐⒷⓑⒸⓒⒹⓓⒺⓔⒻⓕⒼⓖⒽⓗⒾⓘⒿⓙⓀⓚⓁⓛⓂⓜⓃⓝⓄⓞⓅⓟⓆⓠⓇⓡⓈⓢⓉⓣⓊⓤⓋⓥⓌⓦⓍⓧⓎⓨⓏⓩ➀➁➂➃➄➅➆➇➈⓪,.";
3817 var alpha2 = "ⒶⓐⒷⓑⒸⓒⒹⓓⒺⓔⒻⓕⒼⓖⒽⓗⒾⓘⒿⓙⓀⓚⓁⓛⓂⓜⓃⓝⓄⓞⓅⓟⓆⓠⓇⓡⓈⓢⓉⓣⓊⓤⓋⓥⓌⓦⓍⓧⓎⓨⓏⓩ➀➁➂➃➄➅➆➇➈⓪,. AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890,.";
3818 var str = message.substring(cmd.length);
3819 var newstr = '';
3820 for (var i = 0; i < str.length; i++) {
3821 charPos = alpha1.indexOf(str.charAt(i));
3822 newstr += alpha2.charAt(charPos);
3823 }
3824 sendChat("Bubble: " + newstr);
3825 }
3826
3827 // backwards
3828 } else if (cmd == cmdChar+"bw") {
3829 if (message.length == cmd.length) { //add useage for below command
3830 sendChat("Usage: "+cmdChar+"bw text here (converts to backwards text).");
3831 } else {
3832 sendChat("Reverse: " + message.substring(cmd.length).split("").reverse().join(""));
3833 }
3834
3835 // wave
3836 } else if (cmd == cmdChar+"wave") {
3837 if (message.length == cmd.length) {
3838 sendChat("Usage: "+cmdChar+"wave text here.");
3839 } else {
3840 var alpha1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890?.,!@ ᗩᕊᑕᕍᙓℱᘐᖺᓰᒎḰᒪᗰﬡᗢᖰᕋᖇᔕ☂⋒ᐯᙡჯ૪ᔓᗩᙖᑕↁᕮℱᘐᕼᓮᒎḰᒪᗰᘉ〇ᖘႳᖇᔕ☂ᑌⅤᙡ᙭ϒᔓ";
3841 var alpha2 = "ᗩᕊᑕᕍᙓℱᘐᖺᓰᒎḰᒪᗰﬡᗢᖰᕋᖇᔕ☂⋒ᐯᙡჯ૪ᔓᗩᙖᑕↁᕮℱᘐᕼᓮᒎḰᒪᗰᘉ〇ᖘႳᖇᔕ☂ᑌⅤᙡ᙭ϒᔓ1234567890?.,!@ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
3842 var str = message.substring(cmd.length);
3843 var newstr = '';
3844 for (var i = 0; i < str.length; i++) {
3845 charPos = alpha1.indexOf(str.charAt(i));
3846 newstr += alpha2.charAt(charPos);
3847 }
3848 sendChat("Wave: " + newstr);
3849 }
3850
3851
3852 // caps
3853 } else if (cmd == cmdChar+"caps") {
3854 if (message.length == cmd.length) {
3855 sendChat("Usage: "+cmdChar+"caps letters here.");
3856 } else {
3857 var alpha1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?Æ.,!@:'[]/\|<>-=+* ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ";
3858 var alpha2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ᴀʙᴄᴅᴇғɢʜɪᴊᴋʟᴍɴᴏᴘǫʀsᴛᴜᴠᴡxʏᴢ?ᴁ.,!@:'[]/\|<>-=+* abcdefghijklmnopqrstuvwxyz";
3859 var str = message.substring(cmd.length);
3860 var newstr = '';
3861 for (var i = 0; i < str.length; i++) {
3862 charPos = alpha1.indexOf(str.charAt(i));
3863 newstr += alpha2.charAt(charPos);
3864 }
3865 sendChat("Caps: " + newstr);
3866 }
3867
3868 // big text
3869 } else if (cmd == cmdChar+"big") {
3870 if (message.length == cmd.length) {
3871 sendChat("Usage: "+cmdChar+"big letters here.");
3872 } else {
3873 var alpha1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?-=[]\;'\",./_+{}|:<>!@#$%^&*() ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
3874 var alpha2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?-=[]\;'\",./_+{}|:<>!@#$%^&*() ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
3875 var str = message.substring(cmd.length);
3876 var newstr = '';
3877 for (var i = 0; i < str.length; i++) {
3878 charPos = alpha1.indexOf(str.charAt(i));
3879 newstr += alpha2.charAt(charPos);
3880 }
3881 sendChat("Big: " + newstr.substr(1));
3882 }
3883
3884
3885 // bracket
3886 } else if (cmd == cmdChar+"bracket") {
3887 if (message.length == cmd.length) {
3888 sendChat("Usage: "+cmdChar+"bracket letters here.");
3889 } else {
3890 var alpha1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz?-=[]\;'\",./_+{}|:<>!@#$%^&*() ⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵⑴⑵⑶⑷⑸⑹⑺⑻⑼0⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵";
3891 var alpha2 = "⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵⑴⑵⑶⑷⑸⑹⑺⑻⑼0⒜⒝⒞⒟⒠⒡⒢⒣⒤⒥⒦⒧⒨⒩⒪⒫⒬⒭⒮⒯⒰⒱⒲⒳⒴⒵?-=[]\;'\",./_+{}|:<>!@#$%^&*() ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz";
3892 var str = message.substring(cmd.length); //abcde
3893 var newstr = '';
3894 for (var i = 0; i < str.length; i++) {
3895 charPos = alpha1.indexOf(str.charAt(i));
3896 newstr += alpha2.charAt(charPos);
3897 }
3898 sendChat("Bracket: " + newstr);
3899 }
3900
3901 } else if (cmd == cmdChar+"tip" || cmd == cmdChar+"tips") { //tip command
3902 var tipCount = 14;
3903 var textArray = ['Tip (1/' + tipCount + '): You can toggle sustain by pressing BACKSPACE.', 'Tip (2/' + tipCount + '): You can shift octaves by holding either SHIFT, CTRL or CAPSLOCK. It’s best to use CAPSLOCK as this avoids hitting hotkeys such as CTRL+W', 'Tip (3/' + tipCount + '): You can click on your name to change it.', 'Tip (4/' + tipCount + '): If another player is annoying you, you can click their name and mute their notes and/or chat.', 'Tip (5/' + tipCount + '): QZ, WX, EC and RV ect.. are all octaves apart.', 'Tip (6/' + tipCount + '): The sound of your notes is relative to your mouse position. eg high = quite notes, low = loud notes. (unless you’re using a midi piano)', 'Tip (7/' + tipCount + '): If someone’s mouse is in the bottom left that means they haven’t moved their mouse since you’ve connected.', 'Tip (8/' + tipCount + '): Multiplayer Piano works best and lags least with Google chrome: https://www.google.com/intl/en/chrome/browser/', 'Tip (9/' + tipCount + '): If you’re on MIDI and it randomly stops working. Try going to the java control panel and removing the permission and adding it again. Alternatively, this sounds weird but sometimes the room name can effect the loading of the MIDI. Try and load it in the lobby.','Tip (10/' + tipCount + '): The colour of the room name in the bottom left will fade to a ligher shade if the owner has set it to "not visible".', 'Tip (11/' + tipCount + '): If you type #seeowncursor at the end of the URL and refresh you\'ll be able to see your own mouse. Though it won\'t follow your cursor unless you\'re using a script.', 'Tip (12/' + tipCount + '): If the colour of the room name is yellow this means it\'s a lobby. Lobbies don\'t have an owner like normal rooms they also have a low note quota.', 'Tip (13/' + tipCount + '): If you change your name while in two rooms your name will update, but your name-tag at the top will remain the same in the other room.', 'Tip (14/' + tipCount + '): If you add /spin to the end of your new room name the piano will spin!'];
3904 var randomNumber = Math.floor(Math.random() * textArray.length);
3905 sendChat(textArray[randomNumber]);
3906
3907 } else if (cmd == cmdChar+"grammar") { //grammar command
3908 var textArray = ['Gramar Nazi: "Alot" is not a word', 'Grammar Nazi: There: Noun; A place that is not here. // Their: Adjective; Something belongs to "them." // They’re: Contraction; They are.', 'Grammar Nazi: It’s: Contraction for it is. // Its: "It" possesses something.', 'Grammar Nazi: use the word "An" when the next word has a vowel sound. With a few exceptions like "utopia" which has a "Y" sound.', 'Grammar Nazi: Don’t add an apostrophe when the word is a plural!', 'Grammar Nazi: Let’s eat grandma. Let’s eat, grandma. Lesson learned: Don’t eat grandma and put a comma.', 'Grammar Nazi: “Attain” means “reach” and “obtain” means “get.” You attain a mountaintop, but obtain a rare baseball card.', 'Grammar Nazi: “As of yet” is a windy and pretentious substitute for plain old English “yet” or “as yet,” an unjustified extension of the pattern in sentences like “as of Friday the 27th of May.”', 'Grammar Nazi: The casual spellings “altho” and “tho” are not acceptable in formal or edited English. Stick with “although” and “though.”', 'Grammar Nazi: A “bazaar” is a market where miscellaneous goods are sold. “Bizarre,” in contrast, is an adjective meaning “strange,” “weird.”', 'Grammar Nazi: “Calvary,” always capitalized, is the hill on which Jesus was crucified. It means “hill of skulls.” Soldiers mounted on horseback are cavalry.', 'Grammar Nazi: In the US the barrier preventing a flood is called a “dike.” “Dyke” is a term for a type of lesbian, generally considered insulting but adopted as a label for themselves by some lesbians. Nom nom nom', 'Grammar Nazi: Although “dove” is a common form of the past tense of “dive,” a few authorities consider “dived” preferable in formal writing.', 'Grammar Nazi: An “epoch” is a long period of time, like the Pleistocene Epoch', 'Grammar Nazi: Pitfall, a hidden or unsuspected danger or difficulty.', 'Grammar Nazi: When you shift to a new topic or activity, you segue. Many people unfamiliar with the unusual Italian spelling of the word misspell it as “segway.” This error is being encouraged by the deliberately punning name used by the manufacturers of the Segway Human Transporter.', 'Grammar Nazi: Tiramisù is Italian for “pick me up,” and is the name of a popular modern Italian dessert, commonly misspelled as tirimisù, which gives it a slightly Japanese air. The Japanese love tiramisù, but although they sometimes make it with green tea rather than coffee this misspelling isn’t their fault.', 'Grammar Nazi: In formal fencing matches, when someone is hit by an opponent’s sword it is traditional for the person hit to cry out touché (French for “touched”) to acknowledge that fact. In other contexts, we may say touché when somebody scores a point against us in an argument, or otherwise skewers us verbally.', 'Grammar Nazi: “Xmas” is not originally an attempt to exclude Christ from Christmas, but uses an abbreviation of the Greek spelling of the word “Christ” with the “X” representing the Greek letter chi. However, so few people know this that it is probably better not to use this popular abbreviation in religious contexts. So quit your bitching!', 'Grammar Nazi: In some dialects it’s common to say “you’ve got a ways to go before you’ve saved enough to buy a Miata,” but in standard English it’s “a way to go.”', 'Grammar Nazi: Than is a comparision. Then is time based.', 'Grammar Nazi: If you’re dying you need help. If you’re dyeing clothes you might get dirty.', 'Grammar Nazi: '];
3909 var randomNumber = Math.floor(Math.random() * textArray.length);
3910 sendChat(textArray[randomNumber]);
3911
3912 } else if (cmd == cmdChar+"grammer" || cmd == cmdChar+"gramer" || cmd == cmdChar+"gramar") { //grammer command for fun
3913 var textArray = ['Close, but no cigar!', 'Nice going...', 'You moronic fool!', 'Even slurpy squid can spell grammar!', 'Grammar* You imbecile!', 'You sir, are not educated!', 'Did you wake up on the wrong side of the barn?', 'Are you daft?', 'I\'ll slap your mother!'];
3914 var randomNumber = Math.floor(Math.random() * textArray.length);
3915 sendChat(textArray[randomNumber]);
3916
3917 } else if (cmd == cmdChar+"joke") { //joke command
3918 var textArray = ['You can tune a piano but you can’t tuna fish.',
3919 'What sounds does a Bee make? A B#!', 'What do you get when you drop a piano on an army base? A flat major.',
3920 'A note left form a pianist for his wife: “Gone Chopin, (have Liszt), Bach in a Minuet.”',
3921 'What did the pianist say to a tightrope walker? You better C sharp or you’ll B flat.',
3922 'What do you call a fish musician? A piano tuna.',
3923 'Why was the pianist arrested? Because he got into treble.',
3924 'What’s the difference between a piano and an onion? No one cries when you chop up a piano.',
3925 'Did you hear about the circus fire? It was in tents! (Intense)', 'Two guys walk into a bar... the 3rd guy ducked.',
3926 'A blonde gets her haircut while wearing a pair of headphones. The hairdresser asks her to take them off, but she protests that she’ll die without them. The hairdresser sighs, and starts cutting the hair around the headphones. Soon, the blonde falls asleep, and the hairdresser removes the headphones. A few minutes later, the blonde collapses, dead on the floor. Alarmed, the hairdresser puts the headphones to his ear and hears, "Breathe in. Breathe out."',
3927 'Yo Mama’s so fat, it takes 2 trains and a bus to get to her good side.',
3928 'What do you get when you drop a piano down a mine shaft? A flat minor.',
3929 'What do you call a grizzly bear with no teeth? A gummy bear.',
3930 'it’s funny how after an argument is over you start to think about more clever shit you could have said.',
3931 'Wifi went down for five minutes, so I had to talk to my family. They seem like nice people.',
3932 'There are plenty of fish in the sea... too bad I suck at fishing.',
3933 'My friend thinks he is smart. He told me an onion is the only food that makes you cry, so I threw a coconut at his head.',
3934 'How much is this torture device, sir? That\'s a wedding ring...',
3935 'What did the drummer get on his I.Q. Test? Saliva.',
3936 'How does a bass player change a light bulb? He doesn’t. The pianist does it with his left hand.',
3937 'What do you call a beautiful woman on a trombonist’s arm? A tattoo.',
3938 'What is the dynamic range of a bass trombone? On or off.',
3939 'Why did the chicken cross the road? To get away from the bassoon recital.',
3940 'What’s the difference between a bass trombone and a chainsaw? It’s easier to improvise on a chainsaw.',
3941 'Why are a pianist’s fingers like lightning? Because they rarely strike the same place twice.',
3942 'What is Harry Potter’s favourite mint? Dementoes.',
3943 'Give a man a fire and he is warm for a day. Set a man on fire and he is warm for the rest of his life* Quote by Terry Pratchett, Famous author',
3944 'What do you call a Jewish pokémon trainer? Ash.',
3945 'What if a girls tonsils were ticklish and when she was giving you head she laughed non stop?',
3946 'I used to be a banker but I lost interest.',
3947 'I’m glad I know sign language, it’s pretty handy.',
3948 'I couldn’t quite remember how to throw a boomerang, but eventually it came back to me.',
3949 'I don’t trust these stairs because they’re always up to something.',
3950 'Why was the painter killed? He dyed in a car accident.',
3951 '[Patient] Doctor, doctor! People keep Ignoring me! [Doctor] Next patient, please.',
3952 'Why did the sperm cross the road? I accidently put on the wrong sock.',
3953 'I\'m guaranteed to shag the missus up the arse tonight. She\'s dyslexic and thinks it\'s Vaseline Day.',
3954 'You can\'t spell "therapist" without "rapist".',
3955 'If you ever visit the amazon rain forest don\'t forget to cut down shit tons of trees. New studies show that trees block sunlight from animals']; //’ (apostrophe) //Thanks to various people giving me some awesome jokes on MPP!
3956 var randomNumber = Math.floor(Math.random() * textArray.length);
3957 sendChat(textArray[randomNumber]);
3958
3959
3960 //Music theory by Logan
3961 //It's not very optimised and takes up way too much space. I'm not sure how to make it more compact.
3962 //chords
3963 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"music theory" || cmd == cmdChar+"mt") { //music theory command
3964 sendChat("Music Theory Index: "+cmdChar+"chords (list of chords), "+cmdChar+"scales (list of scales C-G), "+cmdChar+"scales2 (list of scales Ab-X), "+cmdChar+"glossary (music terminology) [Unfinished!!]");
3965
3966 } else if (cmd == cmdChar+"chords") { //Chords
3967 sendChat("Chords Index: "+cmdChar+"cmajor, "+cmdChar+"cminor, "+cmdChar+"cmaj7, "+cmdChar+"cmin7, "+cmdChar+"cminmaj, "+cmdChar+"cdom7, "+cmdChar+"cdom7sus4, "+cmdChar+"cdim, "+cmdChar+"cdim7, "+cmdChar+"chalfdim, "+cmdChar+"caug, "+cmdChar+"caug7, "+cmdChar+"caugmaj7, "+cmdChar+"csus2, "+cmdChar+"csus4 [Unfinished!!]");
3968
3969 } else if (cmd == cmdChar+"cmajor") { //C major
3970 sendChat("A major triad is a chord having a root, a major third, and a perfect fifth.");
3971 sendChat("C major triad PC notes - etu");
3972 {setTimeout(function() { press("c2"); press("e2"); press("g2") }, 0);}
3973 {setTimeout(function() { press("c2"); press("e2"); press("g2") }, 3000);}
3974 {setTimeout(function() { press("c2")}, 5000);}
3975 {setTimeout(function() { press("e2")}, 6000);}
3976 {setTimeout(function() { press("g2")}, 7000);}
3977
3978
3979 } else if (cmd == cmdChar+"cdom7") { //C Dominant seventh
3980 sendChat("A dominant seventh chord is a chord composed of a root, major third, perfect fifth, and minor seventh. It can be also viewed as a major triad with an additional minor seventh.");
3981 sendChat("C7 PC notes - etu9");
3982 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("as2") }, 0);}
3983 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("as2") }, 3000);}
3984 {setTimeout(function() { press("c2")}, 5000);}
3985 {setTimeout(function() { press("e2")}, 6000);}
3986 {setTimeout(function() { press("g2")}, 7000);}
3987 {setTimeout(function() { press("as2")}, 8000);}
3988
3989 } else if (cmd == cmdChar+"cdom7sus4") { //C Dominant seventh suspended 4th
3990 sendChat("A dominant seventh suspended 4th chord is a chord composed of a root, perfect fourth, perfect fifth, and minor seventh.");
3991 sendChat("C7(sus) PC notes - eyu9");
3992 {setTimeout(function() { press("c2"); press("f2"); press("g2"); press("as2") }, 0);}
3993 {setTimeout(function() { press("c2"); press("f2"); press("g2"); press("as2") }, 3000);}
3994 {setTimeout(function() { press("c2")}, 5000);}
3995 {setTimeout(function() { press("f2")}, 6000);}
3996 {setTimeout(function() { press("g2")}, 7000);}
3997 {setTimeout(function() { press("as2")}, 8000);}
3998
3999 } else if (cmd == cmdChar+"cmaj7") { //C major seventh
4000 sendChat("A major seventh chord is a seventh chord where the \"third\" note is a major third above the root, and the \"seventh\" note is a major seventh above the root (a fifth above the third note).");
4001 sendChat("Cmaj7 PC notes - etuo");
4002 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("b2") }, 0);}
4003 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("b2") }, 3000);}
4004 {setTimeout(function() { press("c2")}, 5000);}
4005 {setTimeout(function() { press("e2")}, 6000);}
4006 {setTimeout(function() { press("g2")}, 7000);}
4007 {setTimeout(function() { press("b2")}, 8000);}
4008
4009 } else if (cmd == cmdChar+"cminor") { //C minor
4010 sendChat("A minor triad is a chord having a root, a minor third, and a perfect fifth.");
4011 sendChat("C minor triad PC notes - e5u");
4012 {setTimeout(function() { press("c2"); press("ds2"); press("g2") }, 0);}
4013 {setTimeout(function() { press("c2"); press("ds2"); press("g2") }, 3000);}
4014 {setTimeout(function() { press("c2")}, 5000);}
4015 {setTimeout(function() { press("ds2")}, 6000);}
4016 {setTimeout(function() { press("g2")}, 7000);}
4017
4018 } else if (cmd == cmdChar+"cmin7") { //C minor seventh
4019 sendChat("A minor seventh chord is any non-dominant seventh chord where the \"third\" note is a minor third above the root.");
4020 sendChat("Cmin7 PC notes - e5u9");
4021 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("as2") }, 0);}
4022 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("as2") }, 3000);}
4023 {setTimeout(function() { press("c2")}, 5000);}
4024 {setTimeout(function() { press("ds2")}, 6000);}
4025 {setTimeout(function() { press("g2")}, 7000);}
4026 {setTimeout(function() { press("as2")}, 8000);}
4027
4028 } else if (cmd == cmdChar+"cminmaj") { //C minor major seventh
4029 sendChat("The minor major seventh chord is a diatonic non-dominant seventh chord in the harmonic minor scale. The chord is built on a root, with the intervals of a minor third, a major third above that note and above that a major third");
4030 sendChat("Cminmaj PC notes - e5uo");
4031 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("b2") }, 0);}
4032 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("b2") }, 3000);}
4033 {setTimeout(function() { press("c2")}, 5000);}
4034 {setTimeout(function() { press("ds2")}, 6000);}
4035 {setTimeout(function() { press("g2")}, 7000);}
4036 {setTimeout(function() { press("b2")}, 8000);}
4037
4038 } else if (cmd == cmdChar+"cdim") { //C diminished
4039 sendChat("A diminished triad is a triad consisting of two minor thirds above the root.");
4040 sendChat("C diminished triad PC notes - e57");
4041 {setTimeout(function() { press("c2"); press("ds2"); press("fs2") }, 0);}
4042 {setTimeout(function() { press("c2"); press("ds2"); press("fs2") }, 3000);}
4043 {setTimeout(function() { press("c2")}, 5000);}
4044 {setTimeout(function() { press("ds2")}, 6000);}
4045 {setTimeout(function() { press("fs2")}, 7000);}
4046
4047 } else if (cmd == cmdChar+"cdim7") { //C diminished seventh
4048 sendChat("A diminished seventh is an interval produced by narrowing a minor seventh by a chromatic semitone.");
4049 sendChat("Cdim7 PC notes - e57i (this is my favourite chord)");
4050 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("a2") }, 0);}
4051 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("a2") }, 3000);}
4052 {setTimeout(function() { press("c2")}, 5000);}
4053 {setTimeout(function() { press("ds2")}, 6000);}
4054 {setTimeout(function() { press("fs2")}, 7000);}
4055 {setTimeout(function() { press("a2")}, 8000);}
4056
4057 } else if (cmd == cmdChar+"chalfdim") { //C half diminished
4058 sendChat("A half diminished chord is composed by a root note, together with a minor third, a diminished fifth and a minor seventh from root.");
4059 sendChat("Chalfdim PC notes - e579");
4060 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("as2") }, 0);}
4061 {setTimeout(function() { press("c2"); press("ds2"); press("fs2"); press("as2") }, 3000);}
4062 {setTimeout(function() { press("c2")}, 5000);}
4063 {setTimeout(function() { press("ds2")}, 6000);}
4064 {setTimeout(function() { press("fs2")}, 7000);}
4065 {setTimeout(function() { press("as2")}, 8000);}
4066
4067
4068 } else if (cmd == cmdChar+"caug") { //C Augmented
4069 sendChat("An augmented triad is a triad, or chord, consisting of two major thirds (an augmented fifth).");
4070 sendChat("C augmented triad PC notes - et8 (second favourite chord)");
4071 {setTimeout(function() { press("c2"); press("e2"); press("gs2") }, 0);}
4072 {setTimeout(function() { press("c2"); press("e2"); press("gs2") }, 3000);}
4073 {setTimeout(function() { press("c2")}, 5000);}
4074 {setTimeout(function() { press("e2")}, 6000);}
4075 {setTimeout(function() { press("gs2")}, 7000);}
4076
4077 } else if (cmd == cmdChar+"caug7") { //C Augmented seventh
4078 sendChat("An augmented seventh chord is a dominant seventh chord consisting of an augmented triad with a minor seventh.");
4079 sendChat("Caug7 PC notes - et89");
4080 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("as2") }, 0);}
4081 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("as2") }, 3000);}
4082 {setTimeout(function() { press("c2")}, 5000);}
4083 {setTimeout(function() { press("e2")}, 6000);}
4084 {setTimeout(function() { press("gs2")}, 7000);}
4085 {setTimeout(function() { press("as2")}, 8000);}
4086
4087 } else if (cmd == cmdChar+"caugmaj7") { //C Augmented major seventh
4088 sendChat("An augmented major seventh chord is a nondominant seventh chord and is associated with the augmented scale.");
4089 sendChat("Caugmaj7 PC notes - et8o");
4090 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("b2") }, 0);}
4091 {setTimeout(function() { press("c2"); press("e2"); press("gs2"); press("b2") }, 3000);}
4092 {setTimeout(function() { press("c2")}, 5000);}
4093 {setTimeout(function() { press("e2")}, 6000);}
4094 {setTimeout(function() { press("gs2")}, 7000);}
4095 {setTimeout(function() { press("b2")}, 8000);}
4096
4097 } else if (cmd == cmdChar+"csus2") { //C suspended second
4098 sendChat("A suspended second chord (sus2 chord) is a musical chord in which the (major or minor) third is omitted and replaced with a major second.");
4099 sendChat("Csus2 PC notes - eru");
4100 {setTimeout(function() { press("c2"); press("d2"); press("g2") }, 0);}
4101 {setTimeout(function() { press("c2"); press("d2"); press("g2") }, 3000);}
4102 {setTimeout(function() { press("c2")}, 5000);}
4103 {setTimeout(function() { press("d2")}, 6000);}
4104 {setTimeout(function() { press("g2")}, 7000);}
4105
4106 } else if (cmd == cmdChar+"csus4") { //C suspended fourth
4107 sendChat("A suspended fourth chord (sus4 chord or usually referred to as just sus) is a musical chord in which the (major or minor) third is omitted and replaced with a perfect fourth.");
4108 sendChat("Csus PC notes - eyu");
4109 {setTimeout(function() { press("c2"); press("f2"); press("g2") }, 0);}
4110 {setTimeout(function() { press("c2"); press("f2"); press("g2") }, 3000);}
4111 {setTimeout(function() { press("c2")}, 5000);}
4112 {setTimeout(function() { press("f2")}, 6000);}
4113 {setTimeout(function() { press("g2")}, 7000);}
4114 //chords
4115
4116 //scales
4117 } else if (cmd == cmdChar+"scales") { //Scales
4118 sendChat("Scales Index C-F#: "+cmdChar+"scale cmajor, "+cmdChar+"scale cminor, "+cmdChar+"scale charminor, "+cmdChar+"scale cmelminor, "+cmdChar+"scale csmajor, "+cmdChar+"scale csminor, "+cmdChar+"scale csharminor, "+cmdChar+"scale csmelminor, "+cmdChar+"scale dmajor, "+cmdChar+"scale dminor, "+cmdChar+"scale dharminor, "+cmdChar+"scale dmelminor, "+cmdChar+"scale ebmajor, "+cmdChar+"scale ebminor, "+cmdChar+"scale ebharminor, "+cmdChar+"scale ebmelminor, "+cmdChar+"scale emajor, "+cmdChar+"scale eminor, "+cmdChar+"scale eharminor, "+cmdChar+"scale emelminor, "+cmdChar+"scale fmajor, "+cmdChar+"scale fminor, "+cmdChar+"scale fharminor, "+cmdChar+"scale fmelminor, "+cmdChar+"scale fsmajor, "+cmdChar+"scale fsminor, "+cmdChar+"scale fsharminor, "+cmdChar+"scale fsmelminor");
4119
4120 } else if (cmd == cmdChar+"scales2") { //Scales 2
4121 sendChat("Scales Index 2 G-B: "+cmdChar+"scale gmajor, "+cmdChar+"scale gminor, "+cmdChar+"scale gharminor, "+cmdChar+"scale gmelminor "+cmdChar+"scale abmajor, "+cmdChar+"scale abminor, "+cmdChar+"scale abharminor, "+cmdChar+"scale abmelminor, "+cmdChar+"scale amajor, "+cmdChar+"scale aminor, "+cmdChar+"scale aharminor, "+cmdChar+"scale amelminor, "+cmdChar+"scale bbmajor, "+cmdChar+"scale bbminor, "+cmdChar+"scale bbharminor, "+cmdChar+"scale bbmelminor, "+cmdChar+"scale bmajor, "+cmdChar+"scale bminor, "+cmdChar+"scale bharminor, "+cmdChar+"scale bmelminor");
4122
4123 //C scales
4124 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale cmajor") { //C major scale
4125 sendChat("The C major scale - it has no flats or sharps - its relative minor is A");
4126 sendChat("The C major PC notes - e r t y u i o p");
4127 {setTimeout(function() { press("c2")}, 0);}
4128 {setTimeout(function() { press("d2")}, 250);}
4129 {setTimeout(function() { press("e2")}, 500);}
4130 {setTimeout(function() { press("f2")}, 750);}
4131 {setTimeout(function() { press("g2")}, 1000);}
4132 {setTimeout(function() { press("a2")}, 1250);}
4133 {setTimeout(function() { press("b2")}, 1500);}
4134 {setTimeout(function() { press("c3")}, 1750);}
4135 {setTimeout(function() { press("b2")}, 2000);}
4136 {setTimeout(function() { press("a2")}, 2250);}
4137 {setTimeout(function() { press("g2")}, 2500);}
4138 {setTimeout(function() { press("f2")}, 2750);}
4139 {setTimeout(function() { press("e2")}, 3000);}
4140 {setTimeout(function() { press("d2")}, 3250);}
4141 {setTimeout(function() { press("c2")}, 3500);}
4142 {setTimeout(function() { press("c2"); press("e2"); press("g2"); press("c3")}, 4000);}
4143
4144 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale cminor") { //C minor scale
4145 sendChat("The C minor scale - it has 3 flats - its relative major is Eb");
4146 sendChat("The C minor PC notes - e r 5 y u 8 9 p");
4147 var scale_cminor = [[0,"c2"],[250,"d2"],[250,"ds2"],[250,"f2"],[250,"g2"],[250,"gs2"],[250,"as2"],[250,"c3"],[250,"as2"],[250,"gs2"],[250,"g2"],[250,"f2"],[250,"ds2"],[250,"d2"],[250,"c2"]];
4148 var playID = 0;
4149
4150 function playMisc(arr){
4151 //if(playID != 0){clearInterval(playID);}
4152 if(playID != 0) {clearTimeout(playID);playID=0}
4153 var pNum = 0;
4154 var f = function () {
4155 for(var p=1; p<arr[pNum].length; p++){
4156 MPP.press(arr[pNum][p]);
4157 }
4158 if(++pNum >= arr.length) {clearTimeout(playID);playID=0;return;}
4159 setTimeout(f,arr[pNum][0]);
4160 }
4161 setTimeout(f,arr[pNum][0]);
4162 }
4163
4164 //test Play
4165 playMisc(scale_cminor);
4166
4167 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale charminor") { //C harmonic minor scale
4168 sendChat("The C harmonic minor scale - it has 2 flats - it has a major 7th (B)");
4169 sendChat("The C harmonic minor PC notes - e r 5 y u 8 o p");
4170 {setTimeout(function() { press("c2")}, 0);}
4171 {setTimeout(function() { press("d2")}, 250);}
4172 {setTimeout(function() { press("ds2")}, 500);}
4173 {setTimeout(function() { press("f2")}, 750);}
4174 {setTimeout(function() { press("g2")}, 1000);}
4175 {setTimeout(function() { press("gs2")}, 1250);}
4176 {setTimeout(function() { press("b2")}, 1500);}
4177 {setTimeout(function() { press("c3")}, 1750);}
4178 {setTimeout(function() { press("b2")}, 2000);}
4179 {setTimeout(function() { press("gs2")}, 2250);}
4180 {setTimeout(function() { press("g2")}, 2500);}
4181 {setTimeout(function() { press("f2")}, 2750);}
4182 {setTimeout(function() { press("ds2")}, 3000);}
4183 {setTimeout(function() { press("d2")}, 3250);}
4184 {setTimeout(function() { press("c2")}, 3500);}
4185 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("c3")}, 4000);}
4186
4187 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale cmelminor") { //C melodic minor scale
4188 sendChat("The C melodic minor scale - it has 1 flat ascending and 3 flats descending - it has two patterns ascending and descending.");
4189 sendChat("The C melodic minor PC notes - e r 5 y u i o p 9 8 u y 5 r e");
4190 {setTimeout(function() { press("c2")}, 0);}
4191 {setTimeout(function() { press("d2")}, 250);}
4192 {setTimeout(function() { press("ds2")}, 500);}
4193 {setTimeout(function() { press("f2")}, 750);}
4194 {setTimeout(function() { press("g2")}, 1000);}
4195 {setTimeout(function() { press("a2")}, 1250);}
4196 {setTimeout(function() { press("b2")}, 1500);}
4197 {setTimeout(function() { press("c3")}, 1750);}
4198 {setTimeout(function() { press("as2")}, 2000);}
4199 {setTimeout(function() { press("gs2")}, 2250);}
4200 {setTimeout(function() { press("g2")}, 2500);}
4201 {setTimeout(function() { press("f2")}, 2750);}
4202 {setTimeout(function() { press("ds2")}, 3000);}
4203 {setTimeout(function() { press("d2")}, 3250);}
4204 {setTimeout(function() { press("c2")}, 3500);}
4205 {setTimeout(function() { press("c2"); press("ds2"); press("g2"); press("c3")}, 4000);}
4206 //C scales
4207
4208 //C# scales
4209 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale csmajor") { //C# major scale
4210 sendChat("The C# (sharp) major scale - it has 7 sharps - its relative minor is A#");
4211 sendChat("The C# (sharp) major PC notes - 4 5 y 7 8 9 p -");
4212 {setTimeout(function() { press("cs2")}, 0);}
4213 {setTimeout(function() { press("ds2")}, 250);}
4214 {setTimeout(function() { press("f2")}, 500);}
4215 {setTimeout(function() { press("fs2")}, 750);}
4216 {setTimeout(function() { press("gs2")}, 1000);}
4217 {setTimeout(function() { press("as2")}, 1250);}
4218 {setTimeout(function() { press("c3")}, 1500);}
4219 {setTimeout(function() { press("cs3")}, 1750);}
4220 {setTimeout(function() { press("c3")}, 2000);}
4221 {setTimeout(function() { press("as2")}, 2250);}
4222 {setTimeout(function() { press("gs2")}, 2500);}
4223 {setTimeout(function() { press("fs2")}, 2750);}
4224 {setTimeout(function() { press("f2")}, 3000);}
4225 {setTimeout(function() { press("ds2")}, 3250);}
4226 {setTimeout(function() { press("cs2")}, 3500);}
4227 {setTimeout(function() { press("cs2"); press("f2"); press("gs2"); press("cs3")}, 4000);}
4228
4229 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale csminor") { //C# minor scale
4230 sendChat("The C# (sharp) minor scale - it has 4 sharps - its relative major is E");
4231 sendChat("The C# (sharp) major PC notes - f g b j k q . 4");
4232 {setTimeout(function() { press("cs2")}, 0);}
4233 {setTimeout(function() { press("ds2")}, 250);}
4234 {setTimeout(function() { press("e2")}, 500);}
4235 {setTimeout(function() { press("fs2")}, 750);}
4236 {setTimeout(function() { press("gs2")}, 1000);}
4237 {setTimeout(function() { press("a2")}, 1250);}
4238 {setTimeout(function() { press("b2")}, 1500);}
4239 {setTimeout(function() { press("cs3")}, 1750);}
4240 {setTimeout(function() { press("b2")}, 2000);}
4241 {setTimeout(function() { press("a2")}, 2250);}
4242 {setTimeout(function() { press("gs2")}, 2500);}
4243 {setTimeout(function() { press("fs2")}, 2750);}
4244 {setTimeout(function() { press("e2")}, 3000);}
4245 {setTimeout(function() { press("ds2")}, 3250);}
4246 {setTimeout(function() { press("cs2")}, 3500);}
4247 {setTimeout(function() { press("cs2"); press("e2"); press("gs2"); press("cs3")}, 4000);}
4248
4249 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale csharminor") { //C# harmonic minor scale
4250 sendChat("The C# (sharp) harmonic minor scale - it has 2 flats - it has a major 7th (C)");
4251 sendChat("The C# (sharp) harmonic minor PC notes - 4 5 t 7 8 i p -");
4252 {setTimeout(function() { press("cs2")}, 0);}
4253 {setTimeout(function() { press("ds2")}, 250);}
4254 {setTimeout(function() { press("e2")}, 500);}
4255 {setTimeout(function() { press("fs2")}, 750);}
4256 {setTimeout(function() { press("gs2")}, 1000);}
4257 {setTimeout(function() { press("a2")}, 1250);}
4258 {setTimeout(function() { press("c3")}, 1500);}
4259 {setTimeout(function() { press("cs3")}, 1750);}
4260 {setTimeout(function() { press("c3")}, 2000);}
4261 {setTimeout(function() { press("a2")}, 2250);}
4262 {setTimeout(function() { press("gs2")}, 2500);}
4263 {setTimeout(function() { press("fs2")}, 2750);}
4264 {setTimeout(function() { press("e2")}, 3000);}
4265 {setTimeout(function() { press("ds2")}, 3250);}
4266 {setTimeout(function() { press("cs2")}, 3500);}
4267 {setTimeout(function() { press("cs2"); press("e2"); press("gs2"); press("cs3")}, 4000);}
4268
4269 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale csmelminor") { //C# melodic minor scale
4270 sendChat("The C# (sharp) melodic minor scale - it has 7 sharps ascending and 5 sharps descending - it has two patterns ascending and descending.");
4271 sendChat("The C# (sharp) melodic minor PC notes - 4 5 t 7 8 9 p - o i 8 7 t 5 4");
4272 {setTimeout(function() { press("cs2")}, 0);}
4273 {setTimeout(function() { press("ds2")}, 250);}
4274 {setTimeout(function() { press("e2")}, 500);}
4275 {setTimeout(function() { press("fs2")}, 750);}
4276 {setTimeout(function() { press("gs2")}, 1000);}
4277 {setTimeout(function() { press("as2")}, 1250);}
4278 {setTimeout(function() { press("c3")}, 1500);}
4279 {setTimeout(function() { press("cs3")}, 1750);}
4280 {setTimeout(function() { press("b2")}, 2000);}
4281 {setTimeout(function() { press("a2")}, 2250);}
4282 {setTimeout(function() { press("gs2")}, 2500);}
4283 {setTimeout(function() { press("fs2")}, 2750);}
4284 {setTimeout(function() { press("e2")}, 3000);}
4285 {setTimeout(function() { press("ds2")}, 3250);}
4286 {setTimeout(function() { press("cs2")}, 3500);}
4287 {setTimeout(function() { press("cs2"); press("e2"); press("gs2"); press("cs3")}, 4000);}
4288 //C# scales
4289
4290 //D scales
4291 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale dmajor") { //D major scale
4292 sendChat("The D major scale - it has 2 sharps - its relative minor is B");
4293 sendChat("The D major scale PC notes - r t 7 u i o - [");
4294 {setTimeout(function() { press("d2")}, 0);}
4295 {setTimeout(function() { press("e2")}, 250);}
4296 {setTimeout(function() { press("fs2")}, 500);}
4297 {setTimeout(function() { press("g2")}, 750);}
4298 {setTimeout(function() { press("a2")}, 1000);}
4299 {setTimeout(function() { press("b2")}, 1250);}
4300 {setTimeout(function() { press("cs3")}, 1500);}
4301 {setTimeout(function() { press("d3")}, 1750);}
4302 {setTimeout(function() { press("cs3")}, 2000);}
4303 {setTimeout(function() { press("b2")}, 2250);}
4304 {setTimeout(function() { press("a2")}, 2500);}
4305 {setTimeout(function() { press("g2")}, 2750);}
4306 {setTimeout(function() { press("fs2")}, 3000);}
4307 {setTimeout(function() { press("e2")}, 3250);}
4308 {setTimeout(function() { press("d2")}, 3500);}
4309 {setTimeout(function() { press("d2"); press("fs2"); press("a2"); press("d3")}, 4000);}
4310
4311 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale dminor") { //D minor scale
4312 sendChat("The D minor scale - it has 2 sharps - its relative major is F");
4313 sendChat("The D minor scale PC notes - r t 7 u i o - [");
4314 {setTimeout(function() { press("d2")}, 0);}
4315 {setTimeout(function() { press("e2")}, 250);}
4316 {setTimeout(function() { press("f2")}, 500);}
4317 {setTimeout(function() { press("g2")}, 750);}
4318 {setTimeout(function() { press("a2")}, 1000);}
4319 {setTimeout(function() { press("as2")}, 1250);}
4320 {setTimeout(function() { press("c3")}, 1500);}
4321 {setTimeout(function() { press("d3")}, 1750);}
4322 {setTimeout(function() { press("c3")}, 2000);}
4323 {setTimeout(function() { press("as2")}, 2250);}
4324 {setTimeout(function() { press("a2")}, 2500);}
4325 {setTimeout(function() { press("g2")}, 2750);}
4326 {setTimeout(function() { press("f2")}, 3000);}
4327 {setTimeout(function() { press("e2")}, 3250);}
4328 {setTimeout(function() { press("d2")}, 3500);}
4329 {setTimeout(function() { press("d2"); press("f2"); press("a2"); press("d3")}, 4000);}
4330
4331 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale dharminor") { //D harmonic minor scale
4332 sendChat("The D harmonic minor scale - it has 2 sharps - it has a major 7th (C#)");
4333 {setTimeout(function() { press("d2")}, 0);}
4334 {setTimeout(function() { press("e2")}, 250);}
4335 {setTimeout(function() { press("f2")}, 500);}
4336 {setTimeout(function() { press("g2")}, 750);}
4337 {setTimeout(function() { press("a2")}, 1000);}
4338 {setTimeout(function() { press("as2")}, 1250);}
4339 {setTimeout(function() { press("cs3")}, 1500);}
4340 {setTimeout(function() { press("d3")}, 1750);}
4341 {setTimeout(function() { press("cs3")}, 2000);}
4342 {setTimeout(function() { press("as2")}, 2250);}
4343 {setTimeout(function() { press("a2")}, 2500);}
4344 {setTimeout(function() { press("g2")}, 2750);}
4345 {setTimeout(function() { press("f2")}, 3000);}
4346 {setTimeout(function() { press("e2")}, 3250);}
4347 {setTimeout(function() { press("d2")}, 3500);}
4348 {setTimeout(function() { press("d2"); press("f2"); press("a2"); press("d3")}, 4000);}
4349
4350 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale dmelminor") { //D melodic minor scale
4351 sendChat("The D melodic minor scale - it has 1 flat ascending and 3 flats descending - it has two patterns ascending and descending.");
4352 {setTimeout(function() { press("d2")}, 0);}
4353 {setTimeout(function() { press("e2")}, 250);}
4354 {setTimeout(function() { press("f2")}, 500);}
4355 {setTimeout(function() { press("g2")}, 750);}
4356 {setTimeout(function() { press("a2")}, 1000);}
4357 {setTimeout(function() { press("b2")}, 1250);}
4358 {setTimeout(function() { press("cs3")}, 1500);}
4359 {setTimeout(function() { press("d3")}, 1750);}
4360 {setTimeout(function() { press("c3")}, 2000);}
4361 {setTimeout(function() { press("as2")}, 2250);}
4362 {setTimeout(function() { press("a2")}, 2500);}
4363 {setTimeout(function() { press("g2")}, 2750);}
4364 {setTimeout(function() { press("f2")}, 3000);}
4365 {setTimeout(function() { press("e2")}, 3250);}
4366 {setTimeout(function() { press("d2")}, 3500);}
4367 {setTimeout(function() { press("d2"); press("f2"); press("a2"); press("d3")}, 4000);}
4368 //D scales
4369
4370 //Eb scales
4371 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale ebmajor") { //Eb major scale
4372 sendChat("The Eb (flat) major scale - it has 3 flats - its relative minor is C");
4373 {setTimeout(function() { press("ds2")}, 0);}
4374 {setTimeout(function() { press("f2")}, 250);}
4375 {setTimeout(function() { press("g2")}, 500);}
4376 {setTimeout(function() { press("gs2")}, 750);}
4377 {setTimeout(function() { press("as2")}, 1000);}
4378 {setTimeout(function() { press("c3")}, 1250);}
4379 {setTimeout(function() { press("d3")}, 1500);}
4380 {setTimeout(function() { press("ds3")}, 1750);}
4381 {setTimeout(function() { press("d3")}, 2000);}
4382 {setTimeout(function() { press("c3")}, 2250);}
4383 {setTimeout(function() { press("as2")}, 2500);}
4384 {setTimeout(function() { press("gs2")}, 2750);}
4385 {setTimeout(function() { press("g2")}, 3000);}
4386 {setTimeout(function() { press("f2")}, 3250);}
4387 {setTimeout(function() { press("ds2")}, 3500);}
4388 {setTimeout(function() { press("ds2"); press("g2"); press("as2"); press("ds3")}, 4000);}
4389
4390 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale ebminor") { //Eb minor scale
4391 sendChat("The Eb (flat) minor scale - it has 6 flats - its relative major is Gb");
4392 {setTimeout(function() { press("ds2")}, 0);}
4393 {setTimeout(function() { press("f2")}, 250);}
4394 {setTimeout(function() { press("fs2")}, 500);}
4395 {setTimeout(function() { press("gs2")}, 750);}
4396 {setTimeout(function() { press("as2")}, 1000);}
4397 {setTimeout(function() { press("b2")}, 1250);}
4398 {setTimeout(function() { press("cs3")}, 1500);}
4399 {setTimeout(function() { press("ds3")}, 1750);}
4400 {setTimeout(function() { press("cs3")}, 2000);}
4401 {setTimeout(function() { press("b2")}, 2250);}
4402 {setTimeout(function() { press("as2")}, 2500);}
4403 {setTimeout(function() { press("gs2")}, 2750);}
4404 {setTimeout(function() { press("fs2")}, 3000);}
4405 {setTimeout(function() { press("f2")}, 3250);}
4406 {setTimeout(function() { press("ds2")}, 3500);}
4407 {setTimeout(function() { press("ds2"); press("fs2"); press("as2"); press("ds3")}, 4000);}
4408
4409 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale ebharminor") { //Eb harmonic minor scale
4410 sendChat("The Eb (flat) harmonic minor scale - it has 5 flats - it has a major 7th (D)");
4411 {setTimeout(function() { press("ds2")}, 0);}
4412 {setTimeout(function() { press("f2")}, 250);}
4413 {setTimeout(function() { press("fs2")}, 500);}
4414 {setTimeout(function() { press("gs2")}, 750);}
4415 {setTimeout(function() { press("as2")}, 1000);}
4416 {setTimeout(function() { press("b2")}, 1250);}
4417 {setTimeout(function() { press("d3")}, 1500);}
4418 {setTimeout(function() { press("ds3")}, 1750);}
4419 {setTimeout(function() { press("d3")}, 2000);}
4420 {setTimeout(function() { press("b2")}, 2250);}
4421 {setTimeout(function() { press("as2")}, 2500);}
4422 {setTimeout(function() { press("gs2")}, 2750);}
4423 {setTimeout(function() { press("fs2")}, 3000);}
4424 {setTimeout(function() { press("f2")}, 3250);}
4425 {setTimeout(function() { press("ds2")}, 3500);}
4426 {setTimeout(function() { press("ds2"); press("fs2"); press("as2"); press("ds3")}, 4000);}
4427
4428 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale ebmelminor") { //Eb melodic minor scale
4429 sendChat("The Eb (flat) melodic minor scale - it has 5 flats ascending and 6 flats descending - it has two patterns ascending and descending.");
4430 {setTimeout(function() { press("ds2")}, 0);}
4431 {setTimeout(function() { press("f2")}, 250);}
4432 {setTimeout(function() { press("fs2")}, 500);}
4433 {setTimeout(function() { press("gs2")}, 750);}
4434 {setTimeout(function() { press("as2")}, 1000);}
4435 {setTimeout(function() { press("c3")}, 1250);}
4436 {setTimeout(function() { press("d3")}, 1500);}
4437 {setTimeout(function() { press("ds3")}, 1750);}
4438 {setTimeout(function() { press("cs3")}, 2000);}
4439 {setTimeout(function() { press("b2")}, 2250);}
4440 {setTimeout(function() { press("as2")}, 2500);}
4441 {setTimeout(function() { press("gs2")}, 2750);}
4442 {setTimeout(function() { press("fs2")}, 3000);}
4443 {setTimeout(function() { press("f2")}, 3250);}
4444 {setTimeout(function() { press("ds2")}, 3500);}
4445 {setTimeout(function() { press("ds2"); press("fs2"); press("as2"); press("ds3")}, 4000);}
4446 //Eb scales
4447
4448 //E scales
4449 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale emajor") { //E major scale
4450 sendChat("The E major scale - it has 4 sharps - its relative minor is C#");
4451 {setTimeout(function() { press("e2")}, 0);}
4452 {setTimeout(function() { press("fs2")}, 250);}
4453 {setTimeout(function() { press("gs2")}, 500);}
4454 {setTimeout(function() { press("a2")}, 750);}
4455 {setTimeout(function() { press("b2")}, 1000);}
4456 {setTimeout(function() { press("cs3")}, 1250);}
4457 {setTimeout(function() { press("ds3")}, 1500);}
4458 {setTimeout(function() { press("e3")}, 1750);}
4459 {setTimeout(function() { press("ds3")}, 2000);}
4460 {setTimeout(function() { press("cs3")}, 2250);}
4461 {setTimeout(function() { press("b2")}, 2500);}
4462 {setTimeout(function() { press("a2")}, 2750);}
4463 {setTimeout(function() { press("gs2")}, 3000);}
4464 {setTimeout(function() { press("fs2")}, 3250);}
4465 {setTimeout(function() { press("e2")}, 3500);}
4466 {setTimeout(function() { press("e2"); press("gs2"); press("b2"); press("e3")}, 4000);}
4467
4468 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale eminor") { //E minor scale
4469 sendChat("The E minor scale - it has 1 sharp - its relative major is G");
4470 {setTimeout(function() { press("e2")}, 0);}
4471 {setTimeout(function() { press("fs2")}, 250);}
4472 {setTimeout(function() { press("g2")}, 500);}
4473 {setTimeout(function() { press("a2")}, 750);}
4474 {setTimeout(function() { press("b2")}, 1000);}
4475 {setTimeout(function() { press("c3")}, 1250);}
4476 {setTimeout(function() { press("d3")}, 1500);}
4477 {setTimeout(function() { press("e3")}, 1750);}
4478 {setTimeout(function() { press("d3")}, 2000);}
4479 {setTimeout(function() { press("c3")}, 2250);}
4480 {setTimeout(function() { press("b2")}, 2500);}
4481 {setTimeout(function() { press("a2")}, 2750);}
4482 {setTimeout(function() { press("g2")}, 3000);}
4483 {setTimeout(function() { press("fs2")}, 3250);}
4484 {setTimeout(function() { press("e2")}, 3500);}
4485 {setTimeout(function() { press("e2"); press("g2"); press("b2"); press("e3")}, 4000);}
4486
4487 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale eharminor") { //E harmonic minor scale
4488 sendChat("The E harmonic minor scale - it has 2 sharps - it has a major 7th (D#)");
4489 {setTimeout(function() { press("e2")}, 0);}
4490 {setTimeout(function() { press("fs2")}, 250);}
4491 {setTimeout(function() { press("g2")}, 500);}
4492 {setTimeout(function() { press("a2")}, 750);}
4493 {setTimeout(function() { press("b2")}, 1000);}
4494 {setTimeout(function() { press("c3")}, 1250);}
4495 {setTimeout(function() { press("ds3")}, 1500);}
4496 {setTimeout(function() { press("e3")}, 1750);}
4497 {setTimeout(function() { press("ds3")}, 2000);}
4498 {setTimeout(function() { press("c3")}, 2250);}
4499 {setTimeout(function() { press("b2")}, 2500);}
4500 {setTimeout(function() { press("a2")}, 2750);}
4501 {setTimeout(function() { press("g2")}, 3000);}
4502 {setTimeout(function() { press("fs2")}, 3250);}
4503 {setTimeout(function() { press("e2")}, 3500);}
4504 {setTimeout(function() { press("e2"); press("g2"); press("b2"); press("e3")}, 4000);}
4505
4506 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale emelminor") { //E melodic minor scale
4507 sendChat("The E melodic minor scale - it has 3 sharps ascending and 1 sharp descending - it has two patterns ascending and descending.");
4508 {setTimeout(function() { press("e2")}, 0);}
4509 {setTimeout(function() { press("fs2")}, 250);}
4510 {setTimeout(function() { press("g2")}, 500);}
4511 {setTimeout(function() { press("a2")}, 750);}
4512 {setTimeout(function() { press("b2")}, 1000);}
4513 {setTimeout(function() { press("cs3")}, 1250);}
4514 {setTimeout(function() { press("ds3")}, 1500);}
4515 {setTimeout(function() { press("e3")}, 1750);}
4516 {setTimeout(function() { press("d3")}, 2000);}
4517 {setTimeout(function() { press("c3")}, 2250);}
4518 {setTimeout(function() { press("b2")}, 2500);}
4519 {setTimeout(function() { press("a2")}, 2750);}
4520 {setTimeout(function() { press("g2")}, 3000);}
4521 {setTimeout(function() { press("fs2")}, 3250);}
4522 {setTimeout(function() { press("e2")}, 3500);}
4523 {setTimeout(function() { press("e2"); press("g2"); press("b2"); press("e3")}, 4000);}
4524 //E scales
4525
4526 //F scales
4527 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale fmajor") { //F major scale
4528 sendChat("The F major scale - it has 1 flat - its relative minor is D");
4529 {setTimeout(function() { press("f2")}, 0);}
4530 {setTimeout(function() { press("g2")}, 250);}
4531 {setTimeout(function() { press("a2")}, 500);}
4532 {setTimeout(function() { press("as2")}, 750);}
4533 {setTimeout(function() { press("c3")}, 1000);}
4534 {setTimeout(function() { press("d3")}, 1250);}
4535 {setTimeout(function() { press("e3")}, 1500);}
4536 {setTimeout(function() { press("f3")}, 1750);}
4537 {setTimeout(function() { press("e3")}, 2000);}
4538 {setTimeout(function() { press("d3")}, 2250);}
4539 {setTimeout(function() { press("c3")}, 2500);}
4540 {setTimeout(function() { press("as2")}, 2750);}
4541 {setTimeout(function() { press("a2")}, 3000);}
4542 {setTimeout(function() { press("g2")}, 3250);}
4543 {setTimeout(function() { press("f2")}, 3500);}
4544 {setTimeout(function() { press("f2"); press("a2"); press("c3"); press("f3")}, 4000);}
4545
4546 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale fminor") { //F minor scale
4547 sendChat("The F minor scale - it has 4 flats - its relative major is Ab");
4548 {setTimeout(function() { press("f2")}, 0);}
4549 {setTimeout(function() { press("g2")}, 250);}
4550 {setTimeout(function() { press("gs2")}, 500);}
4551 {setTimeout(function() { press("as2")}, 750);}
4552 {setTimeout(function() { press("c3")}, 1000);}
4553 {setTimeout(function() { press("cs3")}, 1250);}
4554 {setTimeout(function() { press("ds3")}, 1500);}
4555 {setTimeout(function() { press("f3")}, 1750);}
4556 {setTimeout(function() { press("ds3")}, 2000);}
4557 {setTimeout(function() { press("cs3")}, 2250);}
4558 {setTimeout(function() { press("c3")}, 2500);}
4559 {setTimeout(function() { press("as2")}, 2750);}
4560 {setTimeout(function() { press("gs2")}, 3000);}
4561 {setTimeout(function() { press("g2")}, 3250);}
4562 {setTimeout(function() { press("f2")}, 3500);}
4563 {setTimeout(function() { press("f2"); press("gs2"); press("c3"); press("f3")}, 4000);}
4564
4565 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale fharminor") { //F harmonic minor scale
4566 sendChat("The F harmonic minor scale - it has 3 flats - it has a major 7th (E)");
4567 {setTimeout(function() { press("f2")}, 0);}
4568 {setTimeout(function() { press("g2")}, 250);}
4569 {setTimeout(function() { press("gs2")}, 500);}
4570 {setTimeout(function() { press("as2")}, 750);}
4571 {setTimeout(function() { press("c3")}, 1000);}
4572 {setTimeout(function() { press("cs3")}, 1250);}
4573 {setTimeout(function() { press("e3")}, 1500);}
4574 {setTimeout(function() { press("f3")}, 1750);}
4575 {setTimeout(function() { press("e3")}, 2000);}
4576 {setTimeout(function() { press("cs3")}, 2250);}
4577 {setTimeout(function() { press("c3")}, 2500);}
4578 {setTimeout(function() { press("as2")}, 2750);}
4579 {setTimeout(function() { press("gs2")}, 3000);}
4580 {setTimeout(function() { press("g2")}, 3250);}
4581 {setTimeout(function() { press("f2")}, 3500);}
4582 {setTimeout(function() { press("f2"); press("gs2"); press("c3"); press("f3")}, 4000);}
4583
4584 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale fmelminor") { //F melodic minor scale
4585 sendChat("The F melodic minor scale - it has 2 flats ascending and 4 flats descending - it has two patterns ascending and descending.");
4586 {setTimeout(function() { press("f2")}, 0);}
4587 {setTimeout(function() { press("g2")}, 250);}
4588 {setTimeout(function() { press("gs2")}, 500);}
4589 {setTimeout(function() { press("as2")}, 750);}
4590 {setTimeout(function() { press("c3")}, 1000);}
4591 {setTimeout(function() { press("d3")}, 1250);}
4592 {setTimeout(function() { press("e3")}, 1500);}
4593 {setTimeout(function() { press("f3")}, 1750);}
4594 {setTimeout(function() { press("ds3")}, 2000);}
4595 {setTimeout(function() { press("cs3")}, 2250);}
4596 {setTimeout(function() { press("c3")}, 2500);}
4597 {setTimeout(function() { press("as2")}, 2750);}
4598 {setTimeout(function() { press("gs2")}, 3000);}
4599 {setTimeout(function() { press("g2")}, 3250);}
4600 {setTimeout(function() { press("f2")}, 3500);}
4601 {setTimeout(function() { press("f2"); press("gs2"); press("c3"); press("f3")}, 4000);}
4602 //F scales
4603
4604 //F# scales
4605 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale fsmajor") { //F# major scale
4606 sendChat("The F# (sharp) major scale - it has 6 sharps - its relative minor is D#");
4607 {setTimeout(function() { press("fs2")}, 0);}
4608 {setTimeout(function() { press("gs2")}, 250);}
4609 {setTimeout(function() { press("as2")}, 500);}
4610 {setTimeout(function() { press("b2")}, 750);}
4611 {setTimeout(function() { press("cs3")}, 1000);}
4612 {setTimeout(function() { press("ds3")}, 1250);}
4613 {setTimeout(function() { press("f3")}, 1500);}
4614 {setTimeout(function() { press("fs3")}, 1750);}
4615 {setTimeout(function() { press("f3")}, 2000);}
4616 {setTimeout(function() { press("ds3")}, 2250);}
4617 {setTimeout(function() { press("cs3")}, 2500);}
4618 {setTimeout(function() { press("b2")}, 2750);}
4619 {setTimeout(function() { press("as2")}, 3000);}
4620 {setTimeout(function() { press("gs2")}, 3250);}
4621 {setTimeout(function() { press("fs2")}, 3500);}
4622 {setTimeout(function() { press("fs2"); press("as2"); press("cs3"); press("fs3")}, 4000);}
4623
4624 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale fsminor") { //F# minor scale
4625 sendChat("The F# (sharp) minor scale - it has 3 sharps - its relative major is A");
4626 {setTimeout(function() { press("fs2")}, 0);}
4627 {setTimeout(function() { press("gs2")}, 250);}
4628 {setTimeout(function() { press("a2")}, 500);}
4629 {setTimeout(function() { press("b2")}, 750);}
4630 {setTimeout(function() { press("cs3")}, 1000);}
4631 {setTimeout(function() { press("d3")}, 1250);}
4632 {setTimeout(function() { press("e3")}, 1500);}
4633 {setTimeout(function() { press("fs3")}, 1750);}
4634 {setTimeout(function() { press("e3")}, 2000);}
4635 {setTimeout(function() { press("d3")}, 2250);}
4636 {setTimeout(function() { press("cs3")}, 2500);}
4637 {setTimeout(function() { press("b2")}, 2750);}
4638 {setTimeout(function() { press("a2")}, 3000);}
4639 {setTimeout(function() { press("gs2")}, 3250);}
4640 {setTimeout(function() { press("fs2")}, 3500);}
4641 {setTimeout(function() { press("fs2"); press("a2"); press("cs3"); press("fs3")}, 4000);}
4642
4643 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale fsharminor") { //F# harmonic minor scale
4644 sendChat("The F# (sharp) harmonic minor scale - it has 4 sharps - it has a major 7th (E#)");
4645 {setTimeout(function() { press("fs2")}, 0);}
4646 {setTimeout(function() { press("gs2")}, 250);}
4647 {setTimeout(function() { press("a2")}, 500);}
4648 {setTimeout(function() { press("b2")}, 750);}
4649 {setTimeout(function() { press("cs3")}, 1000);}
4650 {setTimeout(function() { press("d3")}, 1250);}
4651 {setTimeout(function() { press("f3")}, 1500);}
4652 {setTimeout(function() { press("fs3")}, 1750);}
4653 {setTimeout(function() { press("f3")}, 2000);}
4654 {setTimeout(function() { press("d3")}, 2250);}
4655 {setTimeout(function() { press("cs3")}, 2500);}
4656 {setTimeout(function() { press("b2")}, 2750);}
4657 {setTimeout(function() { press("a2")}, 3000);}
4658 {setTimeout(function() { press("gs2")}, 3250);}
4659 {setTimeout(function() { press("fs2")}, 3500);}
4660 {setTimeout(function() { press("fs2"); press("a2"); press("cs3"); press("fs3")}, 4000);}
4661
4662 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale fsmelminor") { //F# melodic minor scale
4663 sendChat("The F# (sharp) melodic minor scale - it has 5 sharps ascending and 3 sharps descending - it has two patterns ascending and descending.");
4664 {setTimeout(function() { press("fs2")}, 0);}
4665 {setTimeout(function() { press("gs2")}, 250);}
4666 {setTimeout(function() { press("a2")}, 500);}
4667 {setTimeout(function() { press("b2")}, 750);}
4668 {setTimeout(function() { press("cs3")}, 1000);}
4669 {setTimeout(function() { press("ds3")}, 1250);}
4670 {setTimeout(function() { press("f3")}, 1500);}
4671 {setTimeout(function() { press("fs3")}, 1750);}
4672 {setTimeout(function() { press("e3")}, 2000);}
4673 {setTimeout(function() { press("d3")}, 2250);}
4674 {setTimeout(function() { press("cs3")}, 2500);}
4675 {setTimeout(function() { press("b2")}, 2750);}
4676 {setTimeout(function() { press("a2")}, 3000);}
4677 {setTimeout(function() { press("gs2")}, 3250);}
4678 {setTimeout(function() { press("fs2")}, 3500);}
4679 {setTimeout(function() { press("fs2"); press("a2"); press("cs3"); press("fs3")}, 4000);}
4680 //F# scales
4681
4682 //G scales
4683 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale gmajor") { //G major scale
4684 sendChat("The G major scale - it has 1 sharp - its relative minor is E");
4685 {setTimeout(function() { press("g2")}, 0);}
4686 {setTimeout(function() { press("a2")}, 250);}
4687 {setTimeout(function() { press("b2")}, 500);}
4688 {setTimeout(function() { press("c3")}, 750);}
4689 {setTimeout(function() { press("d3")}, 1000);}
4690 {setTimeout(function() { press("e3")}, 1250);}
4691 {setTimeout(function() { press("fs3")}, 1500);}
4692 {setTimeout(function() { press("g3")}, 1750);}
4693 {setTimeout(function() { press("fs3")}, 2000);}
4694 {setTimeout(function() { press("e3")}, 2250);}
4695 {setTimeout(function() { press("d3")}, 2500);}
4696 {setTimeout(function() { press("c3")}, 2750);}
4697 {setTimeout(function() { press("b2")}, 3000);}
4698 {setTimeout(function() { press("a2")}, 3250);}
4699 {setTimeout(function() { press("g2")}, 3500);}
4700 {setTimeout(function() { press("g2"); press("b2"); press("d3"); press("g3")}, 4000);}
4701
4702 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale gminor") { //G minor scale
4703 sendChat("The G minor scale - it has 1 sharps - its relative major is Bb");
4704 {setTimeout(function() { press("g2")}, 0);}
4705 {setTimeout(function() { press("a2")}, 250);}
4706 {setTimeout(function() { press("as2")}, 500);}
4707 {setTimeout(function() { press("c3")}, 750);}
4708 {setTimeout(function() { press("d3")}, 1000);}
4709 {setTimeout(function() { press("ds3")}, 1250);}
4710 {setTimeout(function() { press("f3")}, 1500);}
4711 {setTimeout(function() { press("g3")}, 1750);}
4712 {setTimeout(function() { press("f3")}, 2000);}
4713 {setTimeout(function() { press("ds3")}, 2250);}
4714 {setTimeout(function() { press("d3")}, 2500);}
4715 {setTimeout(function() { press("c3")}, 2750);}
4716 {setTimeout(function() { press("as2")}, 3000);}
4717 {setTimeout(function() { press("a2")}, 3250);}
4718 {setTimeout(function() { press("g2")}, 3500);}
4719 {setTimeout(function() { press("g2"); press("as2"); press("d3"); press("g3")}, 4000);}
4720
4721 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale gharminor") { //G harmonic minor scale
4722 sendChat("The G harmonic minor scale - it has 3 sharps - it has a major 7th (F#)");
4723 {setTimeout(function() { press("g2")}, 0);}
4724 {setTimeout(function() { press("a2")}, 250);}
4725 {setTimeout(function() { press("as2")}, 500);}
4726 {setTimeout(function() { press("c3")}, 750);}
4727 {setTimeout(function() { press("d3")}, 1000);}
4728 {setTimeout(function() { press("ds3")}, 1250);}
4729 {setTimeout(function() { press("fs3")}, 1500);}
4730 {setTimeout(function() { press("g3")}, 1750);}
4731 {setTimeout(function() { press("fs3")}, 2000);}
4732 {setTimeout(function() { press("ds3")}, 2250);}
4733 {setTimeout(function() { press("d3")}, 2500);}
4734 {setTimeout(function() { press("c3")}, 2750);}
4735 {setTimeout(function() { press("as2")}, 3000);}
4736 {setTimeout(function() { press("a2")}, 3250);}
4737 {setTimeout(function() { press("g2")}, 3500);}
4738 {setTimeout(function() { press("g2"); press("as2"); press("d3"); press("g3")}, 4000);}
4739
4740 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale gmelminor") { //G melodic minor scale
4741 sendChat("The G melodic minor scale - it has 1 sharp ascending and 2 sharps descending - it has two patterns ascending and descending.");
4742 {setTimeout(function() { press("g2")}, 0);}
4743 {setTimeout(function() { press("a2")}, 250);}
4744 {setTimeout(function() { press("as2")}, 500);}
4745 {setTimeout(function() { press("c3")}, 750);}
4746 {setTimeout(function() { press("d3")}, 1000);}
4747 {setTimeout(function() { press("e3")}, 1250);}
4748 {setTimeout(function() { press("fs3")}, 1500);}
4749 {setTimeout(function() { press("g3")}, 1750);}
4750 {setTimeout(function() { press("f3")}, 2000);}
4751 {setTimeout(function() { press("ds3")}, 2250);}
4752 {setTimeout(function() { press("d3")}, 2500);}
4753 {setTimeout(function() { press("c3")}, 2750);}
4754 {setTimeout(function() { press("as2")}, 3000);}
4755 {setTimeout(function() { press("a2")}, 3250);}
4756 {setTimeout(function() { press("g2")}, 3500);}
4757 {setTimeout(function() { press("g2"); press("as2"); press("d3"); press("g3")}, 4000);}
4758 //G scales
4759
4760 //Ab Scales
4761 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale abmajor") { //Ab major scale
4762 sendChat("The Ab (flat) major scale - it has 4 flats - its relative minor is F");
4763 {setTimeout(function() { press("gs2")}, 0);}
4764 {setTimeout(function() { press("as2")}, 250);}
4765 {setTimeout(function() { press("c3")}, 500);}
4766 {setTimeout(function() { press("cs3")}, 750);}
4767 {setTimeout(function() { press("ds3")}, 1000);}
4768 {setTimeout(function() { press("f3")}, 1250);}
4769 {setTimeout(function() { press("g3")}, 1500);}
4770 {setTimeout(function() { press("gs3")}, 1750);}
4771 {setTimeout(function() { press("g3")}, 2000);}
4772 {setTimeout(function() { press("f3")}, 2250);}
4773 {setTimeout(function() { press("ds3")}, 2500);}
4774 {setTimeout(function() { press("cs3")}, 2750);}
4775 {setTimeout(function() { press("c3")}, 3000);}
4776 {setTimeout(function() { press("as2")}, 3250);}
4777 {setTimeout(function() { press("gs2")}, 3500);}
4778 {setTimeout(function() { press("gs2"); press("c3"); press("ds3"); press("gs3")}, 4000);}
4779
4780 } else if (message.substring(0, 15).toLowerCase() == cmdChar+"scale abminor") { //Ab minor scale
4781 sendChat("The Ab (flat) minor scale - it has 7 flats - its relative major is Cb major or enharmonically, B major");
4782 {setTimeout(function() { press("gs2")}, 0);}
4783 {setTimeout(function() { press("as2")}, 250);}
4784 {setTimeout(function() { press("b2")}, 500);}
4785 {setTimeout(function() { press("cs3")}, 750);}
4786 {setTimeout(function() { press("ds3")}, 1000);}
4787 {setTimeout(function() { press("e3")}, 1250);}
4788 {setTimeout(function() { press("fs3")}, 1500);}
4789 {setTimeout(function() { press("gs3")}, 1750);}
4790 {setTimeout(function() { press("fs3")}, 2000);}
4791 {setTimeout(function() { press("e3")}, 2250);}
4792 {setTimeout(function() { press("ds3")}, 2500);}
4793 {setTimeout(function() { press("cs3")}, 2750);}
4794 {setTimeout(function() { press("b2")}, 3000);}
4795 {setTimeout(function() { press("as2")}, 3250);}
4796 {setTimeout(function() { press("gs2")}, 3500);}
4797 {setTimeout(function() { press("gs2"); press("b2"); press("ds3"); press("gs3")}, 4000);}
4798
4799 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale abharminor") { //Ab harmonic minor scale
4800 sendChat("The Ab (flat) harmonic minor scale - it has 4 flats - it has a major 7th (G)");
4801 {setTimeout(function() { press("gs2")}, 0);}
4802 {setTimeout(function() { press("as2")}, 250);}
4803 {setTimeout(function() { press("b2")}, 500);}
4804 {setTimeout(function() { press("cs3")}, 750);}
4805 {setTimeout(function() { press("ds3")}, 1000);}
4806 {setTimeout(function() { press("e3")}, 1250);}
4807 {setTimeout(function() { press("g3")}, 1500);}
4808 {setTimeout(function() { press("gs3")}, 1750);}
4809 {setTimeout(function() { press("g3")}, 2000);}
4810 {setTimeout(function() { press("e3")}, 2250);}
4811 {setTimeout(function() { press("ds3")}, 2500);}
4812 {setTimeout(function() { press("cs3")}, 2750);}
4813 {setTimeout(function() { press("b2")}, 3000);}
4814 {setTimeout(function() { press("as2")}, 3250);}
4815 {setTimeout(function() { press("gs2")}, 3500);}
4816 {setTimeout(function() { press("gs2"); press("b2"); press("ds3"); press("gs3")}, 4000);}
4817
4818 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale abmelminor") { //Ab melodic minor scale
4819 sendChat("The Ab (flat) melodic minor scale - it has 3 flats ascending and 4 flats descending - it has two patterns ascending and descending.");
4820 {setTimeout(function() { press("gs2")}, 0);}
4821 {setTimeout(function() { press("as2")}, 250);}
4822 {setTimeout(function() { press("b2")}, 500);}
4823 {setTimeout(function() { press("cs3")}, 750);}
4824 {setTimeout(function() { press("ds3")}, 1000);}
4825 {setTimeout(function() { press("f3")}, 1250);}
4826 {setTimeout(function() { press("g3")}, 1500);}
4827 {setTimeout(function() { press("gs3")}, 1750);}
4828 {setTimeout(function() { press("fs3")}, 2000);}
4829 {setTimeout(function() { press("e3")}, 2250);}
4830 {setTimeout(function() { press("ds3")}, 2500);}
4831 {setTimeout(function() { press("cs3")}, 2750);}
4832 {setTimeout(function() { press("b2")}, 3000);}
4833 {setTimeout(function() { press("as2")}, 3250);}
4834 {setTimeout(function() { press("gs2")}, 3500);}
4835 {setTimeout(function() { press("gs2"); press("b2"); press("ds3"); press("gs3")}, 4000);}
4836 //Ab Scales
4837
4838 //A Scales
4839 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale amajor") { //A major scale
4840 sendChat("The A major scale - it has 3 sharps - its relative minor is F#");
4841 {setTimeout(function() { press("a2")}, 0);}
4842 {setTimeout(function() { press("b2")}, 250);}
4843 {setTimeout(function() { press("cs3")}, 500);}
4844 {setTimeout(function() { press("d3")}, 750);}
4845 {setTimeout(function() { press("e3")}, 1000);}
4846 {setTimeout(function() { press("fs3")}, 1250);}
4847 {setTimeout(function() { press("gs3")}, 1500);}
4848 {setTimeout(function() { press("a3")}, 1750);}
4849 {setTimeout(function() { press("gs3")}, 2000);}
4850 {setTimeout(function() { press("fs3")}, 2250);}
4851 {setTimeout(function() { press("e3")}, 2500);}
4852 {setTimeout(function() { press("d3")}, 2750);}
4853 {setTimeout(function() { press("cs3")}, 3000);}
4854 {setTimeout(function() { press("b2")}, 3250);}
4855 {setTimeout(function() { press("a2")}, 3500);}
4856 {setTimeout(function() { press("a2"); press("cs3"); press("e3"); press("a3")}, 4000);}
4857
4858 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale aminor") { //A minor scale
4859 sendChat("The A minor scale - it has no sharps or flats - its relative major is C major");
4860 {setTimeout(function() { press("a2")}, 0);}
4861 {setTimeout(function() { press("b2")}, 250);}
4862 {setTimeout(function() { press("c3")}, 500);}
4863 {setTimeout(function() { press("d3")}, 750);}
4864 {setTimeout(function() { press("e3")}, 1000);}
4865 {setTimeout(function() { press("f3")}, 1250);}
4866 {setTimeout(function() { press("g3")}, 1500);}
4867 {setTimeout(function() { press("a3")}, 1750);}
4868 {setTimeout(function() { press("g3")}, 2000);}
4869 {setTimeout(function() { press("f3")}, 2250);}
4870 {setTimeout(function() { press("e3")}, 2500);}
4871 {setTimeout(function() { press("d3")}, 2750);}
4872 {setTimeout(function() { press("c3")}, 3000);}
4873 {setTimeout(function() { press("b2")}, 3250);}
4874 {setTimeout(function() { press("a2")}, 3500);}
4875 {setTimeout(function() { press("a2"); press("c3"); press("e3"); press("a3")}, 4000);}
4876
4877 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale aharminor") { //A harmonic minor scale
4878 sendChat("The A harmonic minor scale - it has 1 flat - it has a major 7th (G#)");
4879 {setTimeout(function() { press("a2")}, 0);}
4880 {setTimeout(function() { press("b2")}, 250);}
4881 {setTimeout(function() { press("cs3")}, 500);}
4882 {setTimeout(function() { press("d3")}, 750);}
4883 {setTimeout(function() { press("e3")}, 1000);}
4884 {setTimeout(function() { press("fs3")}, 1250);}
4885 {setTimeout(function() { press("gs3")}, 1500);}
4886 {setTimeout(function() { press("a3")}, 1750);}
4887 {setTimeout(function() { press("gs3")}, 2000);}
4888 {setTimeout(function() { press("fs3")}, 2250);}
4889 {setTimeout(function() { press("e3")}, 2500);}
4890 {setTimeout(function() { press("d3")}, 2750);}
4891 {setTimeout(function() { press("cs3")}, 3000);}
4892 {setTimeout(function() { press("b2")}, 3250);}
4893 {setTimeout(function() { press("a2")}, 3500);}
4894 {setTimeout(function() { press("a2"); press("cs3"); press("e3"); press("a3")}, 4000);}
4895
4896 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale amelminor") { //A melodic minor scale
4897 sendChat("The A melodic minor scale - it has 2 sharps ascending and 0 sharps descending - it has two patterns ascending and descending.");
4898 {setTimeout(function() { press("a2")}, 0);}
4899 {setTimeout(function() { press("b2")}, 250);}
4900 {setTimeout(function() { press("c3")}, 500);}
4901 {setTimeout(function() { press("d3")}, 750);}
4902 {setTimeout(function() { press("e3")}, 1000);}
4903 {setTimeout(function() { press("fs3")}, 1250);}
4904 {setTimeout(function() { press("gs3")}, 1500);}
4905 {setTimeout(function() { press("a3")}, 1750);}
4906 {setTimeout(function() { press("g3")}, 2000);}
4907 {setTimeout(function() { press("f3")}, 2250);}
4908 {setTimeout(function() { press("e3")}, 2500);}
4909 {setTimeout(function() { press("d3")}, 2750);}
4910 {setTimeout(function() { press("c3")}, 3000);}
4911 {setTimeout(function() { press("b2")}, 3250);}
4912 {setTimeout(function() { press("a2")}, 3500);}
4913 {setTimeout(function() { press("a2"); press("c3"); press("e3"); press("a3")}, 4000);}
4914 //A Scales
4915
4916 //Bb Scales
4917 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale bbmajor") { //Bb major scale
4918 sendChat("The Bb (flat) major scale - it has 2 flats - its relative minor is G");
4919 {setTimeout(function() { press("as2")}, 0);}
4920 {setTimeout(function() { press("c3")}, 250);}
4921 {setTimeout(function() { press("d3")}, 500);}
4922 {setTimeout(function() { press("ds3")}, 750);}
4923 {setTimeout(function() { press("f3")}, 1000);}
4924 {setTimeout(function() { press("g3")}, 1250);}
4925 {setTimeout(function() { press("a3")}, 1500);}
4926 {setTimeout(function() { press("as3")}, 1750);}
4927 {setTimeout(function() { press("a3")}, 2000);}
4928 {setTimeout(function() { press("g3")}, 2250);}
4929 {setTimeout(function() { press("f3")}, 2500);}
4930 {setTimeout(function() { press("ds3")}, 2750);}
4931 {setTimeout(function() { press("d3")}, 3000);}
4932 {setTimeout(function() { press("c3")}, 3250);}
4933 {setTimeout(function() { press("as2")}, 3500);}
4934 {setTimeout(function() { press("as2"); press("d3"); press("f3"); press("as3")}, 4000);}
4935
4936 } else if (message.substring(0, 15).toLowerCase() == cmdChar+"scale bbminor") { //Bb minor scale
4937 sendChat("The Bb (flat) minor scale - it 6 flats - its relative major is Db major");
4938 {setTimeout(function() { press("as2")}, 0);}
4939 {setTimeout(function() { press("c3")}, 250);}
4940 {setTimeout(function() { press("cs3")}, 500);}
4941 {setTimeout(function() { press("ds3")}, 750);}
4942 {setTimeout(function() { press("f3")}, 1000);}
4943 {setTimeout(function() { press("fs3")}, 1250);}
4944 {setTimeout(function() { press("gs3")}, 1500);}
4945 {setTimeout(function() { press("as3")}, 1750);}
4946 {setTimeout(function() { press("gs3")}, 2000);}
4947 {setTimeout(function() { press("fs3")}, 2250);}
4948 {setTimeout(function() { press("f3")}, 2500);}
4949 {setTimeout(function() { press("ds3")}, 2750);}
4950 {setTimeout(function() { press("cs3")}, 3000);}
4951 {setTimeout(function() { press("c3")}, 3250);}
4952 {setTimeout(function() { press("as2")}, 3500);}
4953 {setTimeout(function() { press("as2"); press("cs3"); press("f3"); press("as3")}, 4000);}
4954
4955 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale bbharminor") { //Bb harmonic minor scale
4956 sendChat("The Bb (flat) harmonic minor scale - it has 5 flats - it has a major 7th (A)");
4957 {setTimeout(function() { press("as2")}, 0);}
4958 {setTimeout(function() { press("c3")}, 250);}
4959 {setTimeout(function() { press("cs3")}, 500);}
4960 {setTimeout(function() { press("ds3")}, 750);}
4961 {setTimeout(function() { press("f3")}, 1000);}
4962 {setTimeout(function() { press("fs3")}, 1250);}
4963 {setTimeout(function() { press("a3")}, 1500);}
4964 {setTimeout(function() { press("as3")}, 1750);}
4965 {setTimeout(function() { press("a3")}, 2000);}
4966 {setTimeout(function() { press("fs3")}, 2250);}
4967 {setTimeout(function() { press("f3")}, 2500);}
4968 {setTimeout(function() { press("ds3")}, 2750);}
4969 {setTimeout(function() { press("cs3")}, 3000);}
4970 {setTimeout(function() { press("c3")}, 3250);}
4971 {setTimeout(function() { press("as2")}, 3500);}
4972 {setTimeout(function() { press("as2"); press("cs3"); press("f3"); press("as3")}, 4000);}
4973
4974 } else if (message.substring(0, 17).toLowerCase() == cmdChar+"scale bbmelminor") { //Bb melodic minor scale
4975 sendChat("The Bb (flat) melodic minor scale - it has 4 flat ascending and 6 sharps descending - it has two patterns ascending and descending.");
4976 {setTimeout(function() { press("as2")}, 0);}
4977 {setTimeout(function() { press("c3")}, 250);}
4978 {setTimeout(function() { press("cs3")}, 500);}
4979 {setTimeout(function() { press("ds3")}, 750);}
4980 {setTimeout(function() { press("f3")}, 1000);}
4981 {setTimeout(function() { press("g3")}, 1250);}
4982 {setTimeout(function() { press("a3")}, 1500);}
4983 {setTimeout(function() { press("as3")}, 1750);}
4984 {setTimeout(function() { press("gs3")}, 2000);}
4985 {setTimeout(function() { press("fs3")}, 2250);}
4986 {setTimeout(function() { press("f3")}, 2500);}
4987 {setTimeout(function() { press("ds3")}, 2750);}
4988 {setTimeout(function() { press("cs3")}, 3000);}
4989 {setTimeout(function() { press("c3")}, 3250);}
4990 {setTimeout(function() { press("as2")}, 3500);}
4991 {setTimeout(function() { press("as2"); press("cs3"); press("f3"); press("as3")}, 4000);}
4992 //Bb Scales
4993
4994 //B Scales
4995 } else if (message.substring(0, 13).toLowerCase() == cmdChar+"scale bmajor") { //B major scale
4996 sendChat("The B major scale - it has 5 sharps - its relative minor is G#");
4997 {setTimeout(function() { press("b2")}, 0);}
4998 {setTimeout(function() { press("cs3")}, 250);}
4999 {setTimeout(function() { press("ds3")}, 500);}
5000 {setTimeout(function() { press("e3")}, 750);}
5001 {setTimeout(function() { press("fs3")}, 1000);}
5002 {setTimeout(function() { press("gs3")}, 1250);}
5003 {setTimeout(function() { press("as3")}, 1500);}
5004 {setTimeout(function() { press("b3")}, 1750);}
5005 {setTimeout(function() { press("as3")}, 2000);}
5006 {setTimeout(function() { press("gs3")}, 2250);}
5007 {setTimeout(function() { press("fs3")}, 2500);}
5008 {setTimeout(function() { press("e3")}, 2750);}
5009 {setTimeout(function() { press("ds3")}, 3000);}
5010 {setTimeout(function() { press("cs3")}, 3250);}
5011 {setTimeout(function() { press("b2")}, 3500);}
5012 {setTimeout(function() { press("b2"); press("ds3"); press("fs3"); press("b3")}, 4000);}
5013
5014 } else if (message.substring(0, 14).toLowerCase() == cmdChar+"scale bminor") { //B minor scale
5015 sendChat("The B minor scale - it 2 sharps - its relative major is D major");
5016 {setTimeout(function() { press("b2")}, 0);}
5017 {setTimeout(function() { press("cs3")}, 250);}
5018 {setTimeout(function() { press("d3")}, 500);}
5019 {setTimeout(function() { press("e3")}, 750);}
5020 {setTimeout(function() { press("fs3")}, 1000);}
5021 {setTimeout(function() { press("g3")}, 1250);}
5022 {setTimeout(function() { press("a3")}, 1500);}
5023 {setTimeout(function() { press("b3")}, 1750);}
5024 {setTimeout(function() { press("a3")}, 2000);}
5025 {setTimeout(function() { press("g3")}, 2250);}
5026 {setTimeout(function() { press("fs3")}, 2500);}
5027 {setTimeout(function() { press("e3")}, 2750);}
5028 {setTimeout(function() { press("d3")}, 3000);}
5029 {setTimeout(function() { press("cs3")}, 3250);}
5030 {setTimeout(function() { press("b2")}, 3500);}
5031 {setTimeout(function() { press("b2"); press("d3"); press("fs3"); press("b3")}, 4000);}
5032
5033 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale bharminor") { //B harmonic minor scale
5034 sendChat("The B harmonic minor scale - it has 3 sharps - it has a major 7th (A#)");
5035 {setTimeout(function() { press("b2")}, 0);}
5036 {setTimeout(function() { press("cs3")}, 250);}
5037 {setTimeout(function() { press("d3")}, 500);}
5038 {setTimeout(function() { press("e3")}, 750);}
5039 {setTimeout(function() { press("fs3")}, 1000);}
5040 {setTimeout(function() { press("g3")}, 1250);}
5041 {setTimeout(function() { press("as3")}, 1500);}
5042 {setTimeout(function() { press("b3")}, 1750);}
5043 {setTimeout(function() { press("as3")}, 2000);}
5044 {setTimeout(function() { press("g3")}, 2250);}
5045 {setTimeout(function() { press("fs3")}, 2500);}
5046 {setTimeout(function() { press("e3")}, 2750);}
5047 {setTimeout(function() { press("d3")}, 3000);}
5048 {setTimeout(function() { press("cs3")}, 3250);}
5049 {setTimeout(function() { press("b2")}, 3500);}
5050 {setTimeout(function() { press("b2"); press("d3"); press("fs3"); press("b3")}, 4000);}
5051
5052 } else if (message.substring(0, 16).toLowerCase() == cmdChar+"scale bmelminor") { //B melodic minor scale
5053 sendChat("The B melodic minor scale - it has 4 sharps ascending and 2 sharps descending - it has two patterns ascending and descending.");
5054 {setTimeout(function() { press("b2")}, 0);}
5055 {setTimeout(function() { press("cs3")}, 250);}
5056 {setTimeout(function() { press("d3")}, 500);}
5057 {setTimeout(function() { press("e3")}, 750);}
5058 {setTimeout(function() { press("fs3")}, 1000);}
5059 {setTimeout(function() { press("gs3")}, 1250);}
5060 {setTimeout(function() { press("as3")}, 1500);}
5061 {setTimeout(function() { press("b3")}, 1750);}
5062 {setTimeout(function() { press("a3")}, 2000);}
5063 {setTimeout(function() { press("g3")}, 2250);}
5064 {setTimeout(function() { press("fs3")}, 2500);}
5065 {setTimeout(function() { press("e3")}, 2750);}
5066 {setTimeout(function() { press("d3")}, 3000);}
5067 {setTimeout(function() { press("cs3")}, 3250);}
5068 {setTimeout(function() { press("b2")}, 3500);}
5069 {setTimeout(function() { press("b2"); press("d3"); press("fs3"); press("b3")}, 4000);}
5070 //B Scales
5071 //scales
5072
5073 //glossary
5074 } else if (cmd == cmdChar+"glossary") { //Glossary
5075 sendChat("Music theory glossary: "+cmdChar+"arpeggio, "+cmdChar+"glissando [Unfinished!!]");
5076
5077 //Arpeggio
5078 } else if (cmd == cmdChar+"arpeggio") { //Arpeggio
5079 sendChat("An arpeggio is a musical technique where notes in a chord are played in sequence, one after the other. This word comes from the Italian word \"arpeggiare\", which means \"to play on a harp\". An alternative translation of this term is \"broken chord\".");
5080 {setTimeout(function() { press("c0")}, 0);} //octave
5081 {setTimeout(function() { press("ds0")}, 200);}
5082 {setTimeout(function() { press("g0")}, 400);}
5083 {setTimeout(function() { press("c1")}, 600);} //octave
5084 {setTimeout(function() { press("ds1")}, 800);}
5085 {setTimeout(function() { press("g1")}, 1000);}
5086 {setTimeout(function() { press("c2")}, 1200);} //octave
5087 {setTimeout(function() { press("ds2")}, 1400);}
5088 {setTimeout(function() { press("g2")}, 1600);}
5089 {setTimeout(function() { press("c3")}, 1800);} //octave
5090 {setTimeout(function() { press("ds3")}, 2000);}
5091 {setTimeout(function() { press("g3")}, 2200);}
5092 {setTimeout(function() { press("c4")}, 2400);} //octave
5093 {setTimeout(function() { press("ds4")}, 2600);}
5094 {setTimeout(function() { press("g4")}, 2800);}
5095 {setTimeout(function() { press("c5")}, 3000);} //octave
5096 {setTimeout(function() { press("ds5")}, 3200);}
5097 {setTimeout(function() { press("g5")}, 3400);}
5098 {setTimeout(function() { press("c6")}, 3600);} //octave
5099 {setTimeout(function() { press("ds6")}, 3800);}
5100 {setTimeout(function() { press("g6")}, 4000);}
5101 {setTimeout(function() { press("c7")}, 4200);} //octave
5102 //Arpeggio
5103
5104 //Glissando
5105 } else if (cmd == cmdChar+"glissando") { //Glissando
5106 sendChat("In music, a glissando is a glide from one pitch to another. It is an Italianized musical term derived from the French \"glisser\", to glide.");
5107 {setTimeout(function() { press("a-1")}, 100);}
5108 {setTimeout(function() { press("b-1")}, 200);}
5109 {setTimeout(function() { press("c0")}, 300);}
5110 {setTimeout(function() { press("d0")}, 400);}
5111 {setTimeout(function() { press("e0")}, 500);}
5112 {setTimeout(function() { press("f0")}, 600);}
5113 {setTimeout(function() { press("g0")}, 700);}
5114 {setTimeout(function() { press("a0")}, 800);}
5115 {setTimeout(function() { press("b0")}, 900);}
5116 {setTimeout(function() { press("c1")}, 1000);}
5117 {setTimeout(function() { press("d1")}, 1100);}
5118 {setTimeout(function() { press("e1")}, 1200);}
5119 {setTimeout(function() { press("f1")}, 1300);}
5120 {setTimeout(function() { press("g1")}, 1400);}
5121 {setTimeout(function() { press("a1")}, 1500);}
5122 {setTimeout(function() { press("b1")}, 1600);}
5123 {setTimeout(function() { press("c2")}, 1700);}
5124 {setTimeout(function() { press("d2")}, 1800);}
5125 {setTimeout(function() { press("e2")}, 1900);}
5126 {setTimeout(function() { press("f2")}, 2000);}
5127 {setTimeout(function() { press("g2")}, 2100);}
5128 {setTimeout(function() { press("a2")}, 2200);}
5129 {setTimeout(function() { press("b2")}, 2300);}
5130 {setTimeout(function() { press("c3")}, 2400);}
5131 {setTimeout(function() { press("d3")}, 2500);}
5132 {setTimeout(function() { press("e3")}, 2600);}
5133 {setTimeout(function() { press("f3")}, 2700);}
5134 {setTimeout(function() { press("g3")}, 2800);}
5135 {setTimeout(function() { press("a3")}, 2900);}
5136 {setTimeout(function() { press("b3")}, 3000);}
5137 {setTimeout(function() { press("c4")}, 3100);}
5138 {setTimeout(function() { press("d4")}, 3200);}
5139 {setTimeout(function() { press("e4")}, 3300);}
5140 {setTimeout(function() { press("f4")}, 3400);}
5141 {setTimeout(function() { press("g4")}, 3500);}
5142 {setTimeout(function() { press("a4")}, 3600);}
5143 {setTimeout(function() { press("b4")}, 3700);}
5144 {setTimeout(function() { press("c5")}, 3800);}
5145 {setTimeout(function() { press("d5")}, 3900);}
5146 {setTimeout(function() { press("e5")}, 4000);}
5147 {setTimeout(function() { press("f5")}, 4100);}
5148 {setTimeout(function() { press("g5")}, 4200);}
5149 {setTimeout(function() { press("a5")}, 4300);}
5150 {setTimeout(function() { press("b5")}, 4400);}
5151 {setTimeout(function() { press("c6")}, 4500);}
5152 {setTimeout(function() { press("d6")}, 4600);}
5153 {setTimeout(function() { press("e6")}, 4700);}
5154 {setTimeout(function() { press("f6")}, 4800);}
5155 {setTimeout(function() { press("g6")}, 4900);}
5156 {setTimeout(function() { press("a6")}, 5000);}
5157 {setTimeout(function() { press("b6")}, 5100);}
5158 {setTimeout(function() { press("c7")}, 5200);}
5159 //Glissando
5160
5161 //Glossary
5162
5163 //Music theory
5164
5165 //Meow game
5166 } else if (cmd == cmdChar+"mp") {
5167 if (message.length == cmd.length) {
5168 // Check if user is in Database
5169 mUser = MDB[ids];
5170
5171 // If user isn't create a new entry
5172 if (!mUser) {
5173 mUser = MDB[ids] = {
5174 name: name,
5175 meowP: 0,
5176 meowRate: 1,
5177 meowTime: 0,
5178 meowing: false,
5179 cheeseMaster: false,
5180 inventory: {
5181 string: 1,
5182 yarn: 0,
5183 wool: 0,
5184 water: 0,
5185 milk: 0,
5186 bananaMilk: 0,
5187 cheese: 0
5188 },
5189 prices: {
5190 string: 50,
5191 yarn: 500,
5192 wool: 2000,
5193 water: 15000,
5194 milk: 50000,
5195 bananaMilk: 100000,
5196 cheese: 25000000000
5197 }
5198 };
5199
5200 // Start their timer (no clue if this is correct or what)
5201 setInterval(function() {
5202 MDB[ids].meowP += MDB[ids].meowRate;
5203 ++MDB[ids].meowTime;
5204 }, 1000);
5205
5206 MDB[ids].meowing = true;
5207 sendChat('✯ Meow! Welcome to Meowpuff, ' + name + '! (type '+cmdChar+'meow for help, if you\'re still confused ask Logan x3)✯');
5208 sendChat('MP [' + mUser.meowP + '] MP rate [' + mUser.meowRate + '] Time [' + mUser.meowTime + ' secs | ' + (mUser.meowTime / 86400).toPrecision(4) + ' days]');
5209
5210 } else {
5211 if (!MDB[ids].meowing) {
5212 setInterval(function() {
5213 MDB[ids].meowP += MDB[ids].meowRate;
5214 ++MDB[ids].meowTime;
5215 }, 1000);
5216 if (MDB[ids].cheeseMaster) {
5217 sendChat('Welcome back, [Cheese Master] ' + name + '! Stats successfully loaded.');
5218 } else {
5219 sendChat('Welcome back, ' + name + '. Stats successfully loaded.');
5220 }
5221 MDB[ids].meowing = true;
5222 }
5223
5224 // working ✓
5225 sendChat('MP [' + mUser.meowP + '] MP rate [' + mUser.meowRate + '] Time [' + mUser.meowTime + ' secs | ' + (mUser.meowTime / 86400).toPrecision(4) + ' days]');
5226 }
5227 //else they entered more information
5228 } else {
5229 var target = msg.a.substring(cmd.length).trim();
5230 var part = getUser(target.toLowerCase());
5231 if (part) {
5232 if (!MDB[part._id] || !MDB[part._id].meowing) {
5233 sendChat(part.name+ ' isn\'t playing Meowpuff. They need to type '+cmdChar+'mp to create or load a save');
5234 return;
5235 }
5236
5237 if (part.name == name) {
5238 sendChat('Your MP [' + MDB[ids].meowP + '] MP rate [' + MDB[ids].meowRate + '] Time [' + MDB[ids].meowTime + ' secs | ' + (MDB[ids].meowTime / 86400).toPrecision(4) + ' days]');
5239 return;
5240 }
5241 sendChat(part.name + '\'s MP [' + MDB[part._id].meowP + '] MP rate [' + MDB[part._id].meowRate + '] Time [' + MDB[part._id].meowTime + ' secs | ' + (MDB[part._id].meowTime / 86400).toPrecision(4) + ' days]');
5242 } else {
5243 sendChat(userNotFound);
5244 }
5245 }
5246
5247 } else if (cmd == cmdChar+"list") { //list command
5248 var list = "Connected users: ";
5249 for (var id in gClient.ppl) {
5250 list += gClient.ppl[id].name + ", ";
5251 }
5252 sendChat(list);
5253 return;
5254
5255 } else if (cmd == cmdChar+"musicsheets" || cmd == cmdChar+"ms") { //musicsheets command
5256 var songArray = [' ',
5257 ' ',
5258 ' ',
5259 ' ',
5260 ' ',
5261 ' ',
5262 ' ',
5263 ' ',
5264 ' ',
5265 ' ',
5266 ' ',
5267 ' ',
5268 ' ',
5269 ' ',
5270 ' ',
5271 ' ',
5272 ' ',
5273 ' ',
5274 ' ',
5275 ' ',
5276 ' '];
5277 var randomSong = Math.floor(Math.random() * songArray.length);
5278 sendChat("Songs for PC players: " + sheetURL + "pc notes by Fallen | pc player" + songArray[randomSong] + " Selection of easy through hard notes."); //update when you update link, Logan
5279
5280 } else if (cmd == cmdChar+"server") { //server command
5281 var target = msg.a.substring(cmd.length).trim();
5282 var part = getUser(target.toLowerCase());
5283 if (target == "") {
5284 sendChat("Join my server https://discord.gg/ZC8bEKw to meet new people and just have a good time! We accept all kinds of people so don't be afraid to join!");
5285 return;
5286 }
5287
5288 } else if (cmd == cmdChar+"rename") { //rename command
5289 if (message.substring(cmd.length).trim() == 0) {
5290 sendChat('Usage: '+cmdChar+'rename new_name');
5291 return;
5292 }
5293 if (message.substring(7).trim() == 420) {
5294 sendChat('Too high!');
5295 return;
5296 }
5297 if (opped) {
5298 updateName(message.substring(7).trim());
5299 selfName = message.substring(7).trim();
5300
5301 } else {
5302 sendChat(noAccess);
5303 }
5304
5305 } else if (cmd == cmdChar+"welcome") { //welcome command
5306 if (opped) {
5307 if (welcTemp) {
5308 welcTemp = false;
5309 sendChat("Room welcoming disabled.");
5310 } else {
5311 welcTemp = true;
5312 sendChat("Room welcoming enabled.");
5313 }
5314 } else {
5315 sendChat(noAccess);
5316 }
5317 } else if (cmd == cmdChar+"tune") { //tune command
5318 if (opped) {
5319 if (tuneTemp) {
5320 tuneTemp = false;
5321 sendChat("Welcome tune disabled.");
5322 } else {
5323 tuneTemp = true;
5324 sendChat("Welcome tune enabled.");
5325 }
5326 } else {
5327 sendChat(noAccess);
5328 }
5329
5330 } else if (cmd == cmdChar+"op") { //op command
5331 var target = msg.a.substring(cmd.length).trim();
5332 var part = getUser(target.toLowerCase());
5333
5334 if (opped) {
5335 if (target == "") {
5336 sendChat("Usage "+cmdChar+"op name_here.");
5337 return;
5338 }
5339 if (part) {
5340 if (ops.indexOf(part._id) !== -1) {
5341 sendChat(part.name + " is already opped!");
5342 return;
5343 }
5344
5345 sendChat("Opped " + part.name + ".");
5346 ops.push(part._id);
5347
5348 } else {
5349 sendChat(userNotFound);
5350 }
5351 } else {
5352 sendChat(noAccess);
5353 }
5354
5355 } else if (cmd == cmdChar+"deop") { //deop command
5356 var target = msg.a.substring(cmd.length).trim();
5357 var part = getUser(target.toLowerCase());
5358
5359 if (opped) {
5360 if (target == "") {
5361 sendChat("Usage "+cmdChar+"deop name_here.");
5362 return;
5363 }
5364 if (part) {
5365 if (ops.indexOf(part._id) == -1) {
5366 sendChat(part.name + " isn't opped!");
5367 return;
5368 }
5369
5370 if (part._id == selfId) { //Logan
5371 sendChat("You cannot deop " + part.name + ".");
5372 } else if (part._id == "4e28d8736f8a464ada652896") { //Yoshify.
5373 sendChat("You cannot deop " + selfName + "'s friend " + part.name + ".");
5374 } else if (part._id == "d9e6170fd899f2a94adea761") { //StarsPiano
5375 sendChat("You cannot deop " + selfName + "'s friend " + part.name + ".");
5376 } else {
5377 while (ops.indexOf(part._id) !== -1) {
5378 ops.splice(banned.indexOf(part._id), 1); //is this meant to say banned?
5379 }
5380 while (ops.indexOf(part._id) !== -1) {
5381 delete ops[ops.indexOf(part._id)];
5382 }
5383 sendChat("Deopped " + part.name + ".");
5384 }
5385 } else {
5386 sendChat(userNotFound);
5387 }
5388 } else {
5389 sendChat(noAccess);
5390 }
5391 } else if (message.substring(0, 1) == cmdChar) { //alternative error messages
5392 if (message.substring(2).trim() == "") {
5393
5394 } else {
5395 //sendChat("Invalid command. Type !help for a list of commands you have access to."); //shhhhh
5396 }
5397 }
5398 }
5399 botLoaded = true;
5400 });
5401
5402 var Color = function () {
5403 var r, g, b;
5404 if (arguments.length === 1) {
5405 var hexa = arguments[0].toLowerCase();
5406 if (hexa.match(/^#[0-9a-f]{6}$/i)) {
5407 hexa = /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(hexa);
5408 if (hexa && hexa.length === 4) {
5409 r = parseInt(hexa[1], 16);
5410 g = parseInt(hexa[2], 16);
5411 b = parseInt(hexa[3], 16);
5412 }
5413 }
5414 } else if (arguments.length === 3) {
5415 r = arguments[0];
5416 g = arguments[1];
5417 b = arguments[2];
5418 }
5419 this.r = ~~r || 0;
5420 this.g = ~~g || 0;
5421 this.b = ~~b || 0;
5422 };
5423
5424 Color.prototype.distance = function (color) {
5425 var d = 0;
5426 d += Math.pow(this.r - color.r, 2);
5427 d += Math.pow(this.g - color.g, 2);
5428 d += Math.pow(this.b - color.b, 2);
5429 return Math.abs(Math.sqrt(d));
5430 };
5431
5432 Color.prototype.toHexa = function () {
5433 var r = this.r.toString(16),
5434 g = this.g.toString(16),
5435 b = this.b.toString(16);
5436 if (r.length == 1) r = "0" + r;
5437 if (g.length == 1) g = "0" + g;
5438 if (b.length == 1) b = "0" + b;
5439 return "#" + r + g + b;
5440 };
5441
5442 Color.prototype.getName = function () {
5443 var hexa = this.toHexa();
5444 var low = 256;
5445 var name;
5446 for (var n in Color.map) {
5447 if (!Color.map.hasOwnProperty(n)) continue;
5448 var color = Color.map[n];
5449 if (color.r === this.r && color.g === this.g && color.b === this.b) {
5450 return n;
5451 }
5452 var dist = this.distance(color);
5453 if (dist < low) {
5454 low = dist;
5455 name = n;
5456 }
5457 }
5458 if (!name) name = this.toHexa();
5459 else name = "a shade of " + name;
5460 return name;
5461 };
5462
5463 Color.map = {};
5464
5465 Color.a = function (hexa, name) {
5466 Color.map[name] = new Color(hexa);
5467 };
5468
5469 Color.a("#7CB9E8", "Aero");
5470 Color.a("#C9FFE5", "Aero blue");
5471 Color.a("#B284BE", "African purple");
5472 Color.a("#5D8AA8", "Air Force blue (RAF)");
5473 Color.a("#00308F", "Air Force blue (USAF)");
5474 Color.a("#72A0C1", "Air superiority blue");
5475 Color.a("#AF002A", "Alabama Crimson");
5476 Color.a("#F0F8FF", "Alice blue");
5477 Color.a("#E32636", "Alizarin crimson");
5478 Color.a("#C46210", "Alloy orange");
5479 Color.a("#EFDECD", "Almond");
5480 Color.a("#E52B50", "Amaranth");
5481 Color.a("#F19CBB", "Amaranth pink");
5482 Color.a("#AB274F", "Dark amaranth");
5483 Color.a("#3B7A57", "Amazon");
5484 Color.a("#FF7E00", "Amber");
5485 Color.a("#FF033E", "American rose");
5486 Color.a("#9966CC", "Amethyst");
5487 Color.a("#A4C639", "Android green");
5488 Color.a("#F2F3F4", "Anti-flash white");
5489 Color.a("#CD9575", "Antique brass");
5490 Color.a("#665D1E", "Antique bronze");
5491 Color.a("#915C83", "Antique fuchsia");
5492 Color.a("#841B2D", "Antique ruby");
5493 Color.a("#FAEBD7", "Antique white");
5494 Color.a("#8DB600", "Apple green");
5495 Color.a("#FBCEB1", "Apricot");
5496 Color.a("#00FFFF", "Aqua");
5497 Color.a("#7FFFD4", "Aquamarine");
5498 Color.a("#4B5320", "Army green");
5499 Color.a("#3B444B", "Arsenic");
5500 Color.a("#8F9779", "Artichoke");
5501 Color.a("#B2BEB5", "Ash grey");
5502 Color.a("#87A96B", "Asparagus");
5503 Color.a("#FDEE00", "Aureolin");
5504 Color.a("#6E7F80", "AuroMetalSaurus");
5505 Color.a("#568203", "Avocado");
5506 Color.a("#007FFF", "Azure");
5507 Color.a("#F0FFFF", "Azure mist/web");
5508 Color.a("#89CFF0", "Baby blue");
5509 Color.a("#A1CAF1", "Baby blue eyes");
5510 Color.a("#FEFEFA", "Baby powder");
5511 Color.a("#FF91AF", "Baker-Miller pink");
5512 Color.a("#21ABCD", "Ball blue");
5513 Color.a("#FAE7B5", "Banana Mania");
5514 Color.a("#FFE135", "Banana yellow");
5515 Color.a("#E0218A", "Barbie pink");
5516 Color.a("#7C0A02", "Barn red");
5517 Color.a("#848482", "Battleship grey");
5518 Color.a("#98777B", "Bazaar");
5519 Color.a("#9F8170", "Beaver");
5520 Color.a("#F5F5DC", "Beige");
5521 Color.a("#2E5894", "B'dazzled blue");
5522 Color.a("#9C2542", "Big dip o’ruby");
5523 Color.a("#FFE4C4", "Bisque");
5524 Color.a("#3D2B1F", "Bistre");
5525 Color.a("#967117", "Bistre brown");
5526 Color.a("#CAE00D", "Bitter lemon");
5527 Color.a("#648C11", "Bitter lime");
5528 Color.a("#FE6F5E", "Bittersweet");
5529 Color.a("#BF4F51", "Bittersweet shimmer");
5530 Color.a("#000000", "Black with no soul!");
5531 Color.a("#3D0C02", "Black bean");
5532 Color.a("#253529", "Black leather jacket");
5533 Color.a("#3B3C36", "Black olive");
5534 Color.a("#FFEBCD", "Blanched almond");
5535 Color.a("#A57164", "Blast-off bronze");
5536 Color.a("#318CE7", "Bleu de France");
5537 Color.a("#ACE5EE", "Blizzard Blue");
5538 Color.a("#FAF0BE", "Blond");
5539 Color.a("#0000FF", "Blue");
5540 Color.a("#1F75FE", "Blue (Crayola)");
5541 Color.a("#0093AF", "Blue (Munsell)");
5542 Color.a("#0087BD", "Blue (NCS)");
5543 Color.a("#333399", "Blue (pigment)");
5544 Color.a("#0247FE", "Blue (RYB)");
5545 Color.a("#A2A2D0", "Blue Bell");
5546 Color.a("#6699CC", "Blue-gray");
5547 Color.a("#0D98BA", "Blue-green");
5548 Color.a("#126180", "Blue sapphire");
5549 Color.a("#8A2BE2", "Blue-violet");
5550 Color.a("#5072A7", "Blue yonder");
5551 Color.a("#4F86F7", "Blueberry");
5552 Color.a("#1C1CF0", "Bluebonnet");
5553 Color.a("#DE5D83", "Blush");
5554 Color.a("#79443B", "Bole Brown");
5555 Color.a("#0095B6", "Bondi blue");
5556 Color.a("#E3DAC9", "Bone");
5557 Color.a("#CC0000", "Boston University Red");
5558 Color.a("#006A4E", "Bottle green");
5559 Color.a("#873260", "Boysenberry");
5560 Color.a("#0070FF", "Brandeis blue");
5561 Color.a("#B5A642", "Brass");
5562 Color.a("#CB4154", "Brick red");
5563 Color.a("#1DACD6", "Bright cerulean");
5564 Color.a("#66FF00", "Bright green");
5565 Color.a("#BF94E4", "Bright lavender");
5566 Color.a("#D891EF", "Bright lilac");
5567 Color.a("#C32148", "Bright maroon");
5568 Color.a("#1974D2", "Bright navy blue");
5569 Color.a("#FF007F", "Bright pink");
5570 Color.a("#08E8DE", "Bright turquoise");
5571 Color.a("#D19FE8", "Bright ube");
5572 Color.a("#F4BBFF", "Brilliant lavender");
5573 Color.a("#FF55A3", "Brilliant rose");
5574 Color.a("#FB607F", "Brink pink");
5575 Color.a("#004225", "British racing green");
5576 Color.a("#CD7F32", "Bronze");
5577 Color.a("#737000", "Bronze Yellow");
5578 Color.a("#964B00", "Brown");
5579 Color.a("#6B4423", "Brown-nose");
5580 Color.a("#FFC1CC", "Bubble gum");
5581 Color.a("#E7FEFF", "Bubbles");
5582 Color.a("#F0DC82", "Buff");
5583 Color.a("#7BB661", "Bud green");
5584 Color.a("#480607", "Bulgarian rose");
5585 Color.a("#800020", "Burgundy");
5586 Color.a("#DEB887", "Burlywood");
5587 Color.a("#CC5500", "Burnt orange");
5588 Color.a("#8A3324", "Burnt umber");
5589 Color.a("#BD33A4", "Byzantine");
5590 Color.a("#702963", "Byzantium");
5591 Color.a("#536872", "Cadet");
5592 Color.a("#5F9EA0", "Cadet blue");
5593 Color.a("#91A3B0", "Cadet grey");
5594 Color.a("#006B3C", "Cadmium green");
5595 Color.a("#ED872D", "Cadmium orange");
5596 Color.a("#E30022", "Cadmium red");
5597 Color.a("#FFF600", "Cadmium yellow");
5598 Color.a("#A67B5B", "Cafe au lait");
5599 Color.a("#4B3621", "Cafe noir");
5600 Color.a("#1E4D2B", "Cal Poly green");
5601 Color.a("#A3C1AD", "Cambridge Blue");
5602 Color.a("#EFBBCC", "Cameo pink");
5603 Color.a("#78866B", "Camouflage green");
5604 Color.a("#FFEF00", "Canary yellow");
5605 Color.a("#FF0800", "Candy apple red");
5606 Color.a("#E4717A", "Candy pink");
5607 Color.a("#592720", "Caput mortuum");
5608 Color.a("#C41E3A", "Cardinal");
5609 Color.a("#00CC99", "Caribbean green");
5610 Color.a("#960018", "Carmine");
5611 Color.a("#EB4C42", "Carmine pink");
5612 Color.a("#FF0038", "Carmine red");
5613 Color.a("#FFA6C9", "Carnation pink");
5614 Color.a("#99BADD", "Carolina blue");
5615 Color.a("#ED9121", "Carrot orange");
5616 Color.a("#00563F", "Castleton green");
5617 Color.a("#062A78", "Catalina blue");
5618 Color.a("#703642", "Catawba");
5619 Color.a("#C95A49", "Cedar Chest");
5620 Color.a("#92A1CF", "Ceil");
5621 Color.a("#ACE1AF", "Celadon");
5622 Color.a("#007BA7", "Celadon blue");
5623 Color.a("#2F847C", "Celadon green");
5624 Color.a("#4997D0", "Celestial blue");
5625 Color.a("#EC3B83", "Cerise pink");
5626 Color.a("#2A52BE", "Cerulean blue");
5627 Color.a("#6D9BC3", "Cerulean frost");
5628 Color.a("#007AA5", "CG Blue");
5629 Color.a("#E03C31", "CG Red");
5630 Color.a("#A0785A", "Chamoisee");
5631 Color.a("#F7E7CE", "Champagne");
5632 Color.a("#36454F", "Charcoal");
5633 Color.a("#232B2B", "Charleston green");
5634 Color.a("#E68FAC", "Charm pink");
5635 Color.a("#DFFF00", "Chartreuse");
5636 Color.a("#7FFF00", "Chartreuse (web)");
5637 Color.a("#DE3163", "Cherry");
5638 Color.a("#FFB7C5", "Cherry blossom pink");
5639 Color.a("#954535", "Chestnut");
5640 Color.a("#A8516E", "China rose");
5641 Color.a("#AA381E", "Chinese red");
5642 Color.a("#856088", "Chinese violet");
5643 Color.a("#7B3F00", "Chocolate");
5644 Color.a("#FFA700", "Chrome yellow");
5645 Color.a("#98817B", "Cinereous");
5646 Color.a("#E4D00A", "Citrine");
5647 Color.a("#9FA91F", "Citron");
5648 Color.a("#7F1734", "Claret");
5649 Color.a("#FBCCE7", "Classic rose");
5650 Color.a("#0047AB", "Cobalt");
5651 Color.a("#D2691E", "Cocoa brown");
5652 Color.a("#965A3E", "Coconut");
5653 Color.a("#6F4E37", "Coffee Brown");
5654 Color.a("#9BDDFF", "Columbia blue");
5655 Color.a("#002E63", "Cool black");
5656 Color.a("#8C92AC", "Cool grey");
5657 Color.a("#B87333", "Copper");
5658 Color.a("#AD6F69", "Copper penny");
5659 Color.a("#CB6D51", "Copper red");
5660 Color.a("#996666", "Copper rose");
5661 Color.a("#FF3800", "Coquelicot");
5662 Color.a("#FF7F50", "Coral");
5663 Color.a("#F88379", "Coral pink");
5664 Color.a("#FF4040", "Coral red");
5665 Color.a("#893F45", "Cordovan");
5666 Color.a("#FBEC5D", "Corn Yellow");
5667 Color.a("#B31B1B", "Cornell Red");
5668 Color.a("#6495ED", "Cornflower blue");
5669 Color.a("#FFF8DC", "Cornsilk");
5670 Color.a("#FFF8E7", "Cosmic latte");
5671 Color.a("#FFBCD9", "Cotton candy");
5672 Color.a("#FFFDD0", "Cream");
5673 Color.a("#DC143C", "Crimson");
5674 Color.a("#BE0032", "Crimson glory");
5675 Color.a("#00B7EB", "Cyan");
5676 Color.a("#58427C", "Cyber grape");
5677 Color.a("#FFD300", "Cyber yellow");
5678 Color.a("#FFFF31", "Daffodil");
5679 Color.a("#F0E130", "Dandelion");
5680 Color.a("#00008B", "Dark blue");
5681 Color.a("#666699", "Dark blue-gray");
5682 Color.a("#654321", "Dark brown");
5683 Color.a("#5D3954", "Dark byzantium");
5684 Color.a("#A40000", "Dark candy apple red");
5685 Color.a("#08457E", "Dark cerulean");
5686 Color.a("#986960", "Dark chestnut");
5687 Color.a("#CD5B45", "Dark coral");
5688 Color.a("#008B8B", "Dark cyan");
5689 Color.a("#536878", "Dark electric blue");
5690 Color.a("#B8860B", "Dark goldenrod");
5691 Color.a("#A9A9A9", "Dark gray");
5692 Color.a("#013220", "Dark green");
5693 Color.a("#00416A", "Dark imperial blue");
5694 Color.a("#1A2421", "Dark jungle green");
5695 Color.a("#BDB76B", "Dark khaki");
5696 Color.a("#734F96", "Dark lavender");
5697 Color.a("#534B4F", "Dark liver");
5698 Color.a("#543D37", "Dark liver (horses)");
5699 Color.a("#8B008B", "Dark magenta");
5700 Color.a("#003366", "Dark midnight blue");
5701 Color.a("#4A5D23", "Dark moss green");
5702 Color.a("#556B2F", "Dark olive green");
5703 Color.a("#FF8C00", "Dark orange");
5704 Color.a("#9932CC", "Dark orchid");
5705 Color.a("#779ECB", "Dark pastel blue");
5706 Color.a("#03C03C", "Dark pastel green");
5707 Color.a("#966FD6", "Dark pastel purple");
5708 Color.a("#C23B22", "Dark pastel red");
5709 Color.a("#E75480", "Dark pink");
5710 Color.a("#003399", "Dark powder blue");
5711 Color.a("#4F3A3C", "Dark puce");
5712 Color.a("#872657", "Dark raspberry");
5713 Color.a("#8B0000", "Dark red");
5714 Color.a("#E9967A", "Dark salmon");
5715 Color.a("#560319", "Dark Scarlet");
5716 Color.a("#8FBC8F", "Dark sea green");
5717 Color.a("#3C1414", "Dark sienna");
5718 Color.a("#8CBED6", "Dark sky blue");
5719 Color.a("#483D8B", "Dark slate blue");
5720 Color.a("#2F4F4F", "Dark slate gray");
5721 Color.a("#177245", "Dark spring green");
5722 Color.a("#918151", "Dark tan");
5723 Color.a("#FFA812", "Dark tangerine");
5724 Color.a("#CC4E5C", "Dark terra cotta");
5725 Color.a("#00CED1", "Dark turquoise");
5726 Color.a("#D1BEA8", "Dark vanilla");
5727 Color.a("#9400D3", "Dark violet");
5728 Color.a("#9B870C", "Dark yellow");
5729 Color.a("#00703C", "Dartmouth green");
5730 Color.a("#555555", "Davy's grey");
5731 Color.a("#D70A53", "Debian red");
5732 Color.a("#A9203E", "Deep carmine");
5733 Color.a("#EF3038", "Deep carmine pink");
5734 Color.a("#E9692C", "Deep carrot orange");
5735 Color.a("#DA3287", "Deep cerise");
5736 Color.a("#B94E48", "Deep chestnut");
5737 Color.a("#C154C1", "Deep fuchsia");
5738 Color.a("#004B49", "Deep jungle green");
5739 Color.a("#F5C71A", "Deep lemon");
5740 Color.a("#9955BB", "Deep lilac");
5741 Color.a("#CC00CC", "Deep magenta");
5742 Color.a("#D473D4", "Deep mauve");
5743 Color.a("#355E3B", "Deep moss green");
5744 Color.a("#FFCBA4", "Deep peach");
5745 Color.a("#A95C68", "Deep puce");
5746 Color.a("#843F5B", "Deep ruby");
5747 Color.a("#FF9933", "Deep saffron");
5748 Color.a("#00BFFF", "Deep sky blue");
5749 Color.a("#4A646C", "Deep Space Sparkle");
5750 Color.a("#7E5E60", "Deep Taupe");
5751 Color.a("#66424D", "Deep Tuscan red");
5752 Color.a("#BA8759", "Deer");
5753 Color.a("#1560BD", "Denim");
5754 Color.a("#EDC9AF", "Desert sand");
5755 Color.a("#EA3C53", "Desire");
5756 Color.a("#B9F2FF", "Diamond");
5757 Color.a("#696969", "Dim gray");
5758 Color.a("#9B7653", "Dirt");
5759 Color.a("#1E90FF", "Dodger blue");
5760 Color.a("#D71868", "Dogwood rose");
5761 Color.a("#85BB65", "Dollar bill");
5762 Color.a("#664C28", "Donkey Brown");
5763 Color.a("#00009C", "Duke blue");
5764 Color.a("#E5CCC9", "Dust storm");
5765 Color.a("#EFDFBB", "Dutch white");
5766 Color.a("#E1A95F", "Earth yellow");
5767 Color.a("#555D50", "Ebony");
5768 Color.a("#1B1B1B", "Logan's old colour </3"); //Logan's old colour </3
5769 Color.a("#614051", "Eggplant");
5770 Color.a("#F0EAD6", "Eggshell");
5771 Color.a("#1034A6", "Egyptian blue");
5772 Color.a("#7DF9FF", "Electric blue");
5773 Color.a("#FF003F", "Electric crimson");
5774 Color.a("#00FF00", "Electric green");
5775 Color.a("#6F00FF", "Electric indigo");
5776 Color.a("#CCFF00", "Electric lime");
5777 Color.a("#BF00FF", "Electric purple");
5778 Color.a("#3F00FF", "Electric ultramarine");
5779 Color.a("#FFFF00", "Electric yellow");
5780 Color.a("#50C878", "Emerald");
5781 Color.a("#6C3082", "Eminence");
5782 Color.a("#1B4D3E", "English green");
5783 Color.a("#B48395", "English lavender");
5784 Color.a("#AB4B52", "English red");
5785 Color.a("#563C5C", "English violet");
5786 Color.a("#96C8A2", "Eton blue");
5787 Color.a("#44D7A8", "Eucalyptus");
5788 Color.a("#801818", "Falu red");
5789 Color.a("#B53389", "Fandango");
5790 Color.a("#DE5285", "Fandango pink");
5791 Color.a("#F400A1", "Fashion fuchsia");
5792 Color.a("#E5AA70", "Fawn");
5793 Color.a("#4D5D53", "Feldgrau");
5794 Color.a("#4F7942", "Fern green");
5795 Color.a("#FF2800", "Ferrari Red");
5796 Color.a("#6C541E", "Field drab");
5797 Color.a("#B22222", "Firebrick");
5798 Color.a("#CE2029", "Fire engine red");
5799 Color.a("#E25822", "Flame");
5800 Color.a("#FC8EAC", "Flamingo pink");
5801 Color.a("#F7E98E", "Flavescent"); //Logan's new stupid colour?
5802 Color.a("#EEDC82", "Flax");
5803 Color.a("#A2006D", "Flirt");
5804 Color.a("#FFFAF0", "Floral white");
5805 Color.a("#FFBF00", "Fluorescent orange");
5806 Color.a("#FF1493", "Fluorescent pink");
5807 Color.a("#FF004F", "Folly");
5808 Color.a("#014421", "Forest green");
5809 Color.a("#228B22", "Forest green (web)");
5810 Color.a("#856D4D", "French bistre");
5811 Color.a("#0072BB", "French blue");
5812 Color.a("#FD3F92", "French fuchsia");
5813 Color.a("#86608E", "French lilac");
5814 Color.a("#9EFD38", "French lime");
5815 Color.a("#FD6C9E", "French pink");
5816 Color.a("#4E1609", "French puce");
5817 Color.a("#C72C48", "French raspberry");
5818 Color.a("#F64A8A", "French rose");
5819 Color.a("#77B5FE", "French sky blue");
5820 Color.a("#8806CE", "French violet");
5821 Color.a("#AC1E44", "French wine");
5822 Color.a("#A6E7FF", "Fresh Air");
5823 Color.a("#FF77FF", "Fuchsia pink");
5824 Color.a("#CC397B", "Fuchsia purple");
5825 Color.a("#C74375", "Fuchsia rose");
5826 Color.a("#E48400", "Fulvous");
5827 Color.a("#CC6666", "Fuzzy Wuzzy");
5828 Color.a("#DCDCDC", "Gainsboro");
5829 Color.a("#E49B0F", "Gamboge");
5830 Color.a("#007F66", "Generic viridian");
5831 Color.a("#F8F8FF", "Ghost white");
5832 Color.a("#FE5A1D", "Giants orange");
5833 Color.a("#B06500", "Ginger");
5834 Color.a("#6082B6", "Glaucous");
5835 Color.a("#E6E8FA", "Glitter");
5836 Color.a("#00AB66", "GO green");
5837 Color.a("#D4AF37", "Gold (metallic)");
5838 Color.a("#FFD700", "Gold (web) (Golden)");
5839 Color.a("#85754E", "Gold Fusion");
5840 Color.a("#996515", "Golden brown");
5841 Color.a("#FCC200", "Golden poppy");
5842 Color.a("#FFDF00", "Golden yellow");
5843 Color.a("#DAA520", "Goldenrod");
5844 Color.a("#A8E4A0", "Granny Smith Apple");
5845 Color.a("#6F2DA8", "Grape");
5846 Color.a("#808080", "Gray");
5847 Color.a("#BEBEBE", "Gray (X11 gray)");
5848 Color.a("#465945", "Gray-asparagus");
5849 Color.a("#1CAC78", "Green (Crayola)");
5850 Color.a("#008000", "Green");
5851 Color.a("#00A877", "Green (Munsell)");
5852 Color.a("#009F6B", "Green (NCS)");
5853 Color.a("#00A550", "Green (pigment)");
5854 Color.a("#66B032", "Green (RYB)");
5855 Color.a("#ADFF2F", "Green-yellow");
5856 Color.a("#A99A86", "Grullo");
5857 Color.a("#663854", "Halaya ube");
5858 Color.a("#446CCF", "Han blue");
5859 Color.a("#5218FA", "Beyonce Purple");
5860 Color.a("#E9D66B", "Hansa yellow");
5861 Color.a("#3FFF00", "Harlequin");
5862 Color.a("#C90016", "Harvard crimson");
5863 Color.a("#DA9100", "Harvest gold");
5864 Color.a("#DF73FF", "Heliotrope");
5865 Color.a("#AA98A9", "Heliotrope gray");
5866 Color.a("#F0FFF0", "Honeydew");
5867 Color.a("#006DB0", "Honolulu blue");
5868 Color.a("#49796B", "Chloe's green");
5869 Color.a("#FF1DCE", "Hot magenta");
5870 Color.a("#FF69B4", "Hot pink");
5871 Color.a("#71A6D2", "Iceberg");
5872 Color.a("#FCF75E", "Icterine");
5873 Color.a("#319177", "Illuminating Emerald");
5874 Color.a("#602F6B", "Imperial");
5875 Color.a("#002395", "Imperial blue");
5876 Color.a("#66023C", "Imperial purple");
5877 Color.a("#ED2939", "Imperial red");
5878 Color.a("#B2EC5D", "Inchworm");
5879 Color.a("#4C516D", "Independence");
5880 Color.a("#138808", "India green");
5881 Color.a("#CD5C5C", "Indian red");
5882 Color.a("#E3A857", "Indian yellow");
5883 Color.a("#4B0082", "Indigo");
5884 Color.a("#002FA7", "International Klein Blue");
5885 Color.a("#FF4F00", "International orange (aerospace)");
5886 Color.a("#BA160C", "International orange (engineering)");
5887 Color.a("#C0362C", "International orange (Golden Gate Bridge)");
5888 Color.a("#5A4FCF", "Iris");
5889 Color.a("#F4F0EC", "Isabelline");
5890 Color.a("#009000", "Islamic green");
5891 Color.a("#B2FFFF", "Italian sky blue");
5892 Color.a("#FFFFF0", "Ivory");
5893 Color.a("#00A86B", "Jade");
5894 Color.a("#9D2933", "Japanese carmine");
5895 Color.a("#264348", "Japanese indigo");
5896 Color.a("#5B3256", "Japanese violet");
5897 Color.a("#D73B3E", "Jasper");
5898 Color.a("#A50B5E", "Jazzberry jam");
5899 Color.a("#DA614E", "Jelly Bean");
5900 Color.a("#343434", "Jet");
5901 Color.a("#F4CA16", "Jonquil");
5902 Color.a("#8AB9F1", "Jordy blue");
5903 Color.a("#BDDA57", "June bud");
5904 Color.a("#29AB87", "Jungle green");
5905 Color.a("#4CBB17", "Kelly green");
5906 Color.a("#7C1C05", "Kenyan copper");
5907 Color.a("#3AB09E", "Keppel");
5908 Color.a("#C3B091", "Khaki");
5909 Color.a("#E79FC4", "Kobi");
5910 Color.a("#354230", "Kombu green");
5911 Color.a("#E8000D", "KU Crimson");
5912 Color.a("#087830", "La Salle Green");
5913 Color.a("#D6CADD", "Languid lavender");
5914 Color.a("#26619C", "Lapis lazuli");
5915 Color.a("#A9BA9D", "Laurel green");
5916 Color.a("#CF1020", "Lava");
5917 Color.a("#B57EDC", "Lavender (floral)");
5918 Color.a("#CCCCFF", "Lavender blue");
5919 Color.a("#FFF0F5", "Lavender blush");
5920 Color.a("#C4C3D0", "Lavender gray");
5921 Color.a("#9457EB", "Lavender indigo");
5922 Color.a("#EE82EE", "Lavender magenta");
5923 Color.a("#E6E6FA", "Lavender mist");
5924 Color.a("#FBAED2", "Lavender pink");
5925 Color.a("#967BB6", "Lavender purple");
5926 Color.a("#FBA0E3", "Lavender rose");
5927 Color.a("#7CFC00", "Lawn green");
5928 Color.a("#FFF700", "Lemon");
5929 Color.a("#FFFACD", "Lemon chiffon");
5930 Color.a("#CCA01D", "Lemon curry");
5931 Color.a("#FDFF00", "Lemon glacier");
5932 Color.a("#E3FF00", "Lemon lime");
5933 Color.a("#F6EABE", "Lemon meringue");
5934 Color.a("#FFF44F", "Lemon yellow");
5935 Color.a("#1A1110", "Licorice");
5936 Color.a("#545AA7", "Liberty");
5937 Color.a("#FDD5B1", "Light apricot");
5938 Color.a("#ADD8E6", "Light blue");
5939 Color.a("#B5651D", "Light brown");
5940 Color.a("#E66771", "Light carmine pink");
5941 Color.a("#F08080", "Light coral");
5942 Color.a("#93CCEA", "Light cornflower blue");
5943 Color.a("#F56991", "Light crimson");
5944 Color.a("#E0FFFF", "Light cyan");
5945 Color.a("#FF5CCD", "Light deep pink");
5946 Color.a("#C8AD7F", "Light French beige");
5947 Color.a("#F984EF", "Light fuchsia pink");
5948 Color.a("#FAFAD2", "Light goldenrod yellow");
5949 Color.a("#D3D3D3", "Light gray");
5950 Color.a("#90EE90", "Light green");
5951 Color.a("#FFB3DE", "Light hot pink");
5952 Color.a("#F0E68C", "Light khaki");
5953 Color.a("#D39BCB", "Light medium orchid");
5954 Color.a("#ADDFAD", "Light moss green");
5955 Color.a("#E6A8D7", "Light orchid");
5956 Color.a("#B19CD9", "Light pastel purple");
5957 Color.a("#FFB6C1", "Light pink");
5958 Color.a("#E97451", "Light red ochre");
5959 Color.a("#FFA07A", "Light salmon");
5960 Color.a("#FF9999", "Light salmon pink");
5961 Color.a("#20B2AA", "Light sea green");
5962 Color.a("#87CEFA", "Light sky blue");
5963 Color.a("#778899", "Light slate gray");
5964 Color.a("#B0C4DE", "Light steel blue");
5965 Color.a("#B38B6D", "Light taupe");
5966 Color.a("#FFFFE0", "Light yellow");
5967 Color.a("#C8A2C8", "Lilac");
5968 Color.a("#BFFF00", "Lime");
5969 Color.a("#32CD32", "Lime green");
5970 Color.a("#9DC209", "Limerick");
5971 Color.a("#195905", "Prostitute green");
5972 Color.a("#FAF0E6", "Linen");
5973 Color.a("#6CA0DC", "Little boy blue");
5974 Color.a("#B86D29", "Liver (dogs)");
5975 Color.a("#6C2E1F", "Liver");
5976 Color.a("#987456", "Liver chestnut");
5977 Color.a("#FFE4CD", "Lumber");
5978 Color.a("#E62020", "Lust");
5979 Color.a("#FF00FF", "Magenta");
5980 Color.a("#CA1F7B", "Magenta (dye)");
5981 Color.a("#D0417E", "Magenta (Pantone)");
5982 Color.a("#FF0090", "Magenta (process)");
5983 Color.a("#9F4576", "Magenta haze");
5984 Color.a("#AAF0D1", "Magic mint");
5985 Color.a("#F8F4FF", "Magnolia");
5986 Color.a("#C04000", "Mahogany");
5987 Color.a("#6050DC", "Majorelle Blue");
5988 Color.a("#0BDA51", "Malachite");
5989 Color.a("#979AAA", "Manatee");
5990 Color.a("#FF8243", "Mango Tango");
5991 Color.a("#74C365", "Mantis"); //The colour of Mantis (#78cb53) - new fav colour
5992 Color.a("#880085", "Mardi Gras");
5993 Color.a("#800000", "Maroon");
5994 Color.a("#E0B0FF", "Mauve");
5995 Color.a("#915F6D", "Mauve taupe");
5996 Color.a("#EF98AA", "Mauvelous");
5997 Color.a("#4C9141", "May green");
5998 Color.a("#73C2FB", "Maya blue");
5999 Color.a("#E5B73B", "Golden");
6000 Color.a("#66DDAA", "Medium aquamarine");
6001 Color.a("#0000CD", "Medium blue");
6002 Color.a("#E2062C", "Medium candy apple red");
6003 Color.a("#AF4035", "Medium carmine");
6004 Color.a("#035096", "Medium electric blue");
6005 Color.a("#1C352D", "Medium jungle green");
6006 Color.a("#BA55D3", "Medium orchid");
6007 Color.a("#9370DB", "Medium purple");
6008 Color.a("#BB3385", "Medium red-violet");
6009 Color.a("#AA4069", "Medium ruby");
6010 Color.a("#3CB371", "Medium sea green");
6011 Color.a("#80DAEB", "Medium sky blue");
6012 Color.a("#7B68EE", "Medium slate blue");
6013 Color.a("#C9DC87", "Medium spring bud"); //Fallen | pc players color
6014 Color.a("#00FA9A", "Medium spring green");
6015 Color.a("#674C47", "Medium taupe");
6016 Color.a("#48D1CC", "Medium turquoise");
6017 Color.a("#D9603B", "Pale vermilion");
6018 Color.a("#F8B878", "Mellow apricot");
6019 Color.a("#F8DE7E", "Mellow yellow");
6020 Color.a("#FDBCB4", "Melon");
6021 Color.a("#0A7E8C", "Metallic Seaweed");
6022 Color.a("#9C7C38", "Metallic Sunburst");
6023 Color.a("#E4007C", "Mexican pink");
6024 Color.a("#191970", "Midnight blue");
6025 Color.a("#004953", "Midnight green (eagle green)");
6026 Color.a("#FFC40C", "Mikado yellow");
6027 Color.a("#E3F988", "Mindaro");
6028 Color.a("#3EB489", "Mint");
6029 Color.a("#F5FFFA", "Mint cream");
6030 Color.a("#98FF98", "Mint green");
6031 Color.a("#FFE4E1", "Misty rose");
6032 Color.a("#73A9C2", "Moonstone blue");
6033 Color.a("#AE0C00", "Mordant red 19");
6034 Color.a("#8A9A5B", "Moss green");
6035 Color.a("#30BA8F", "Mountain Meadow");
6036 Color.a("#997A8D", "Mountbatten pink");
6037 Color.a("#18453B", "MSU Green");
6038 Color.a("#306030", "Mughal green");
6039 Color.a("#C54B8C", "Mulberry");
6040 Color.a("#FFDB58", "Mustard");
6041 Color.a("#317873", "Myrtle green");
6042 Color.a("#F6ADC6", "Nadeshiko pink");
6043 Color.a("#2A8000", "Napier green");
6044 Color.a("#FFDEAD", "Navajo white");
6045 Color.a("#000080", "Navy");
6046 Color.a("#FFA343", "Neon Carrot");
6047 Color.a("#FE4164", "Neon fuchsia");
6048 Color.a("#39FF14", "Neon green");
6049 Color.a("#214FC6", "New Car");
6050 Color.a("#D7837F", "New York pink");
6051 Color.a("#A4DDED", "Non-photo blue");
6052 Color.a("#059033", "North Texas Green");
6053 Color.a("#E9FFDB", "Nyanza");
6054 Color.a("#0077BE", "Ocean Boat Blue");
6055 Color.a("#CC7722", "Ochre");
6056 Color.a("#43302E", "Old burgundy");
6057 Color.a("#CFB53B", "Old gold");
6058 Color.a("#FDF5E6", "Old lace");
6059 Color.a("#796878", "Old lavender");
6060 Color.a("#673147", "Old mauve");
6061 Color.a("#867E36", "Old moss green");
6062 Color.a("#C08081", "Old rose");
6063 Color.a("#808000", "Olive");
6064 Color.a("#6B8E23", "Olive Drab #3");
6065 Color.a("#3C341F", "Olive Drab #7");
6066 Color.a("#9AB973", "Olivine");
6067 Color.a("#353839", "Onyx");
6068 Color.a("#B784A7", "Opera mauve");
6069 Color.a("#FF7F00", "Orange");
6070 Color.a("#FF7538", "Orange (Crayola)");
6071 Color.a("#FF5800", "Orange (Pantone)");
6072 Color.a("#FB9902", "Orange (RYB)");
6073 Color.a("#FFA500", "Orange (web)");
6074 Color.a("#FF9F00", "Orange peel");
6075 Color.a("#FF4500", "Orange-red");
6076 Color.a("#DA70D6", "Orchid");
6077 Color.a("#F2BDCD", "Orchid pink");
6078 Color.a("#FB4F14", "Orioles orange");
6079 Color.a("#414A4C", "Outer Space");
6080 Color.a("#FF6E4A", "Outrageous Orange");
6081 Color.a("#002147", "Oxford Blue");
6082 Color.a("#990000", "Crimson Red");
6083 Color.a("#006600", "Pakistan green");
6084 Color.a("#273BE2", "Palatinate blue");
6085 Color.a("#682860", "Palatinate purple");
6086 Color.a("#BCD4E6", "Pale aqua");
6087 Color.a("#AFEEEE", "Pale blue");
6088 Color.a("#987654", "Pale brown");
6089 Color.a("#9BC4E2", "Pale cerulean");
6090 Color.a("#DDADAF", "Pale chestnut");
6091 Color.a("#DA8A67", "Pale copper");
6092 Color.a("#ABCDEF", "Pale cornflower blue");
6093 Color.a("#E6BE8A", "Pale gold");
6094 Color.a("#EEE8AA", "Pale goldenrod");
6095 Color.a("#98FB98", "Pale green");
6096 Color.a("#DCD0FF", "Pale lavender");
6097 Color.a("#F984E5", "Pale magenta");
6098 Color.a("#FADADD", "Pale pink");
6099 Color.a("#DDA0DD", "Pale plum");
6100 Color.a("#DB7093", "Nipple");
6101 Color.a("#96DED1", "Pale robin egg blue");
6102 Color.a("#C9C0BB", "Pale silver");
6103 Color.a("#ECEBBD", "Pale spring bud");
6104 Color.a("#BC987E", "Pale taupe");
6105 Color.a("#78184A", "Pansy purple");
6106 Color.a("#009B7D", "Paolo Veronese green");
6107 Color.a("#FFEFD5", "Papaya whip");
6108 Color.a("#E63E62", "Paradise pink");
6109 Color.a("#AEC6CF", "Pastel blue");
6110 Color.a("#836953", "Pastel brown");
6111 Color.a("#CFCFC4", "Pastel gray");
6112 Color.a("#77DD77", "Pastel green");
6113 Color.a("#F49AC2", "Pastel magenta");
6114 Color.a("#FFB347", "Pastel orange");
6115 Color.a("#DEA5A4", "Pastel pink");
6116 Color.a("#B39EB5", "Pastel purple");
6117 Color.a("#FF6961", "Pastel red");
6118 Color.a("#CB99C9", "Pastel violet");
6119 Color.a("#FDFD96", "Pastel yellow");
6120 Color.a("#FFE5B4", "Peach");
6121 Color.a("#FFCC99", "Peach-orange");
6122 Color.a("#FFDAB9", "Peach puff");
6123 Color.a("#FADFAD", "Peach-yellow");
6124 Color.a("#D1E231", "Pear");
6125 Color.a("#EAE0C8", "Pearl");
6126 Color.a("#88D8C0", "Dolphin Aqua");
6127 Color.a("#B768A2", "Pearly purple");
6128 Color.a("#E6E200", "Peridot");
6129 Color.a("#1C39BB", "Persian blue");
6130 Color.a("#00A693", "Persian green");
6131 Color.a("#32127A", "Persian indigo");
6132 Color.a("#D99058", "Persian orange");
6133 Color.a("#F77FBE", "Persian pink");
6134 Color.a("#701C1C", "Persian plum");
6135 Color.a("#CC3333", "Persian red");
6136 Color.a("#FE28A2", "Persian rose");
6137 Color.a("#EC5800", "Persimmon");
6138 Color.a("#CD853F", "Peru");
6139 Color.a("#000F89", "Phthalo blue");
6140 Color.a("#123524", "Phthalo green");
6141 Color.a("#45B1E8", "Picton blue");
6142 Color.a("#C30B4E", "Pictorial carmine");
6143 Color.a("#FDDDE6", "Piggy pink");
6144 Color.a("#01796F", "Pine green");
6145 Color.a("#FFC0CB", "Pink");
6146 Color.a("#D74894", "Pink (Pantone)");
6147 Color.a("#FFDDF4", "Pink lace");
6148 Color.a("#D8B2D1", "Pink lavender");
6149 Color.a("#FF9966", "Pink-orange");
6150 Color.a("#E7ACCF", "Pink pearl");
6151 Color.a("#F78FA7", "Pink Sherbet");
6152 Color.a("#93C572", "Pistachio");
6153 Color.a("#E5E4E2", "Platinum");
6154 Color.a("#8E4585", "Plum");
6155 Color.a("#BE4F62", "Popstar");
6156 Color.a("#FF5A36", "Portland Orange");
6157 Color.a("#B0E0E6", "Powder blue");
6158 Color.a("#FF8F00", "Princeton orange");
6159 Color.a("#003153", "Prussian blue");
6160 Color.a("#DF00FF", "Psychedelic purple");
6161 Color.a("#CC8899", "Puce");
6162 Color.a("#644117", "Pullman Brown (UPS Brown)");
6163 Color.a("#FF7518", "Pumpkin");
6164 Color.a("#800080", "Purple");
6165 Color.a("#9F00C5", "Purple (Munsell)");
6166 Color.a("#A020F0", "Purple");
6167 Color.a("#69359C", "Purple Heart");
6168 Color.a("#9678B6", "Purple mountain majesty");
6169 Color.a("#4E5180", "Purple navy");
6170 Color.a("#FE4EDA", "Purple pizzazz");
6171 Color.a("#50404D", "Purple taupe");
6172 Color.a("#9A4EAE", "Purpureus");
6173 Color.a("#51484F", "Quartz");
6174 Color.a("#436B95", "Queen blue");
6175 Color.a("#E8CCD7", "Queen pink");
6176 Color.a("#8E3A59", "Quinacridone magenta");
6177 Color.a("#FF355E", "Radical Red");
6178 Color.a("#FBAB60", "Rajah");
6179 Color.a("#E30B5D", "Raspberry");
6180 Color.a("#E25098", "Raspberry pink");
6181 Color.a("#B3446C", "Raspberry rose");
6182 Color.a("#826644", "Raw umber");
6183 Color.a("#FF33CC", "Razzle dazzle rose");
6184 Color.a("#E3256B", "Razzmatazz");
6185 Color.a("#8D4E85", "Razzmic Berry");
6186 Color.a("#FF0000", "Red");
6187 Color.a("#EE204D", "Red (Crayola)");
6188 Color.a("#F2003C", "Red (Munsell)");
6189 Color.a("#C40233", "Red (NCS)");
6190 Color.a("#ED1C24", "Red (pigment)");
6191 Color.a("#FE2712", "Red (RYB)");
6192 Color.a("#A52A2A", "Red-brown");
6193 Color.a("#860111", "Red devil");
6194 Color.a("#FF5349", "Red-orange");
6195 Color.a("#E40078", "Red-purple");
6196 Color.a("#C71585", "Red-violet");
6197 Color.a("#A45A52", "Redwood");
6198 Color.a("#522D80", "Regalia");
6199 Color.a("#002387", "Resolution blue");
6200 Color.a("#777696", "Rhythm");
6201 Color.a("#004040", "Rich black");
6202 Color.a("#F1A7FE", "Rich brilliant lavender");
6203 Color.a("#D70040", "Rich carmine");
6204 Color.a("#0892D0", "Rich electric blue");
6205 Color.a("#A76BCF", "Rich lavender");
6206 Color.a("#B666D2", "Rich lilac");
6207 Color.a("#B03060", "Rich maroon");
6208 Color.a("#444C38", "Rifle green");
6209 Color.a("#704241", "Deep Roast coffee");
6210 Color.a("#00CCCC", "Robin egg blue");
6211 Color.a("#8A7F80", "Rocket metallic");
6212 Color.a("#838996", "Roman silver");
6213 Color.a("#F9429E", "Rose bonbon");
6214 Color.a("#674846", "Rose ebony");
6215 Color.a("#B76E79", "Rose gold");
6216 Color.a("#FF66CC", "Rose pink");
6217 Color.a("#C21E56", "Rose red");
6218 Color.a("#905D5D", "Rose taupe");
6219 Color.a("#AB4E52", "Rose vale");
6220 Color.a("#65000B", "Rosewood");
6221 Color.a("#D40000", "Rosso corsa");
6222 Color.a("#BC8F8F", "Rosy brown");
6223 Color.a("#0038A8", "Royal azure");
6224 Color.a("#002366", "Royal blue");
6225 Color.a("#4169E1", "Royal light blue");
6226 Color.a("#CA2C92", "Royal fuchsia");
6227 Color.a("#7851A9", "Royal purple");
6228 Color.a("#FADA5E", "Royal yellow");
6229 Color.a("#CE4676", "Ruber");
6230 Color.a("#D10056", "Rubine red");
6231 Color.a("#E0115F", "Ruby");
6232 Color.a("#9B111E", "Ruby red");
6233 Color.a("#FF0028", "Ruddy");
6234 Color.a("#BB6528", "Ruddy brown");
6235 Color.a("#E18E96", "Ruddy pink");
6236 Color.a("#A81C07", "Rufous");
6237 Color.a("#80461B", "Russet");
6238 Color.a("#679267", "Russian green");
6239 Color.a("#32174D", "Russian violet");
6240 Color.a("#B7410E", "Rust");
6241 Color.a("#DA2C43", "Rusty red");
6242 Color.a("#8B4513", "Saddle brown");
6243 Color.a("#FF6700", "Safety orange (blaze orange)");
6244 Color.a("#EED202", "Safety yellow");
6245 Color.a("#F4C430", "Saffron");
6246 Color.a("#BCB88A", "Sage");
6247 Color.a("#23297A", "St. Patrick's blue");
6248 Color.a("#FA8072", "Salmon");
6249 Color.a("#FF91A4", "Salmon pink");
6250 Color.a("#C2B280", "Sand");
6251 Color.a("#ECD540", "Sandstorm");
6252 Color.a("#F4A460", "Sandy brown");
6253 Color.a("#92000A", "Sangria");
6254 Color.a("#507D2A", "Sap green");
6255 Color.a("#0F52BA", "Sapphire");
6256 Color.a("#0067A5", "Sapphire blue");
6257 Color.a("#CBA135", "Satin sheen gold");
6258 Color.a("#FF2400", "Scarlet");
6259 Color.a("#FFD800", "School bus yellow");
6260 Color.a("#76FF7A", "Screamin' Green");
6261 Color.a("#006994", "Sea blue");
6262 Color.a("#2E8B57", "Sea green");
6263 Color.a("#321414", "Seal brown");
6264 Color.a("#FFF5EE", "Seashell");
6265 Color.a("#FFBA00", "Selective yellow");
6266 Color.a("#704214", "Sepia");
6267 Color.a("#8A795D", "Shadow");
6268 Color.a("#778BA5", "Shadow blue");
6269 Color.a("#FFCFF1", "Shampoo");
6270 Color.a("#009E60", "Shamrock green");
6271 Color.a("#8FD400", "Sheen Green");
6272 Color.a("#D98695", "Shimmering Blush");
6273 Color.a("#FC0FC0", "Shocking pink");
6274 Color.a("#882D17", "Sienna");
6275 Color.a("#C0C0C0", "Silver");
6276 Color.a("#ACACAC", "Silver chalice");
6277 Color.a("#5D89BA", "Silver Lake blue");
6278 Color.a("#C4AEAD", "Silver pink");
6279 Color.a("#BFC1C2", "Silver sand");
6280 Color.a("#CB410B", "Sinopia");
6281 Color.a("#007474", "Skobeloff");
6282 Color.a("#87CEEB", "Sky blue");
6283 Color.a("#CF71AF", "Sky magenta");
6284 Color.a("#6A5ACD", "Slate blue");
6285 Color.a("#708090", "Slate gray");
6286 Color.a("#C84186", "Smitten");
6287 Color.a("#738276", "Smoke");
6288 Color.a("#933D41", "Smokey topaz");
6289 Color.a("#100C08", "Smoky black");
6290 Color.a("#FFFAFA", "Snow");
6291 Color.a("#CEC8EF", "Soap");
6292 Color.a("#893843", "Solid pink");
6293 Color.a("#757575", "Sonic silver");
6294 Color.a("#9E1316", "Spartan Crimson");
6295 Color.a("#1D2951", "Space cadet");
6296 Color.a("#807532", "Spanish bistre");
6297 Color.a("#0070B8", "Spanish blue");
6298 Color.a("#D10047", "Spanish carmine");
6299 Color.a("#E51A4C", "Spanish crimson");
6300 Color.a("#989898", "Spanish gray");
6301 Color.a("#009150", "Spanish green");
6302 Color.a("#E86100", "Spanish orange");
6303 Color.a("#F7BFBE", "Spanish pink");
6304 Color.a("#E60026", "Spanish red");
6305 Color.a("#4C2882", "Spanish violet");
6306 Color.a("#007F5C", "Spanish viridian");
6307 Color.a("#0FC0FC", "Spiro Disco Ball");
6308 Color.a("#A7FC00", "Spring bud");
6309 Color.a("#00FF7F", "Spring green");
6310 Color.a("#007BB8", "Star command blue");
6311 Color.a("#4682B4", "Steel blue");
6312 Color.a("#CC33CC", "Steel pink");
6313 Color.a("#4F666A", "Stormcloud");
6314 Color.a("#E4D96F", "Straw");
6315 Color.a("#FC5A8D", "Strawberry");
6316 Color.a("#FFCC33", "Sunglow");
6317 Color.a("#E3AB57", "Sunray");
6318 Color.a("#FAD6A5", "Sunset");
6319 Color.a("#FD5E53", "Sunset orange");
6320 Color.a("#CF6BA9", "Super pink");
6321 Color.a("#D2B48C", "Tan");
6322 Color.a("#F94D00", "Tangelo");
6323 Color.a("#F28500", "Tangerine");
6324 Color.a("#FFCC00", "Tangerine yellow");
6325 Color.a("#483C32", "Dark Grayish Brown");
6326 Color.a("#8B8589", "Taupe gray");
6327 Color.a("#D0F0C0", "Tea green");
6328 Color.a("#F4C2C2", "Tea rose");
6329 Color.a("#008080", "Teal");
6330 Color.a("#367588", "Teal blue");
6331 Color.a("#99E6B3", "Teal deer");
6332 Color.a("#00827F", "Teal green");
6333 Color.a("#CF3476", "Telemagenta");
6334 Color.a("#CD5700", "Tenne");
6335 Color.a("#E2725B", "Terra cotta");
6336 Color.a("#D8BFD8", "Thistle");
6337 Color.a("#DE6FA1", "Thulian pink");
6338 Color.a("#FC89AC", "Tickle Me Pink");
6339 Color.a("#0ABAB5", "Tiffany Blue");
6340 Color.a("#E08D3C", "Tiger's eye");
6341 Color.a("#DBD7D2", "Timberwolf");
6342 Color.a("#EEE600", "Titanium yellow");
6343 Color.a("#FF6347", "Tomato");
6344 Color.a("#746CC0", "Toolbox");
6345 Color.a("#FFC87C", "Topaz");
6346 Color.a("#FD0E35", "Tractor red");
6347 Color.a("#00755E", "Tropical rain forest");
6348 Color.a("#0073CF", "True Blue");
6349 Color.a("#417DC1", "Tufts Blue");
6350 Color.a("#FF878D", "Tulip");
6351 Color.a("#DEAA88", "Tumbleweed");
6352 Color.a("#B57281", "Turkish rose");
6353 Color.a("#40E0D0", "Turquoise");
6354 Color.a("#00FFEF", "Turquoise blue");
6355 Color.a("#A0D6B4", "Turquoise green");
6356 Color.a("#7C4848", "Tuscan red");
6357 Color.a("#C09999", "Tuscany");
6358 Color.a("#8A496B", "Twilight lavender");
6359 Color.a("#0033AA", "UA blue");
6360 Color.a("#D9004C", "UA red");
6361 Color.a("#8878C3", "Ube");
6362 Color.a("#536895", "UCLA Blue");
6363 Color.a("#FFB300", "UCLA Gold");
6364 Color.a("#3CD070", "UFO Green");
6365 Color.a("#120A8F", "Ultramarine");
6366 Color.a("#4166F5", "Ultramarine blue");
6367 Color.a("#FF6FFF", "Ultra pink");
6368 Color.a("#635147", "Umber");
6369 Color.a("#FFDDCA", "Unbleached silk");
6370 Color.a("#5B92E5", "United Nations blue");
6371 Color.a("#B78727", "University of California Gold");
6372 Color.a("#FFFF66", "Unmellow yellow");
6373 Color.a("#7B1113", "UP Maroon");
6374 Color.a("#AE2029", "Upsdell red");
6375 Color.a("#E1AD21", "Urobilin");
6376 Color.a("#004F98", "USAFA blue");
6377 Color.a("#F77F00", "University of Tennessee Orange");
6378 Color.a("#D3003F", "Utah Crimson");
6379 Color.a("#F3E5AB", "Vanilla");
6380 Color.a("#F38FA9", "Vanilla ice");
6381 Color.a("#C5B358", "Vegas gold");
6382 Color.a("#C80815", "Venetian red");
6383 Color.a("#43B3AE", "Verdigris");
6384 Color.a("#E34234", "Medium vermilion");
6385 Color.a("#D9381E", "Vermilion");
6386 Color.a("#8F00FF", "Violet");
6387 Color.a("#7F00FF", "Violet (color wheel)");
6388 Color.a("#8601AF", "Violet (RYB)");
6389 Color.a("#324AB2", "Logie Bear");
6390 Color.a("#F75394", "Violet-red");
6391 Color.a("#40826D", "Viridian");
6392 Color.a("#009698", "Viridian green");
6393 Color.a("#922724", "Vivid auburn");
6394 Color.a("#9F1D35", "Vivid burgundy");
6395 Color.a("#DA1D81", "Vivid cerise");
6396 Color.a("#CC00FF", "Vivid orchid");
6397 Color.a("#00CCFF", "Vivid sky blue");
6398 Color.a("#FFA089", "Vivid tangerine");
6399 Color.a("#9F00FF", "Vivid violet");
6400 Color.a("#004242", "Warm black");
6401 Color.a("#A4F4F9", "Waterspout");
6402 Color.a("#645452", "Wenge");
6403 Color.a("#F5DEB3", "Wheat");
6404 Color.a("#FFFFFF", "White");
6405 Color.a("#F5F5F5", "White smoke");
6406 Color.a("#A2ADD0", "Wild blue yonder");
6407 Color.a("#D470A2", "Wild orchid");
6408 Color.a("#FF43A4", "Wild Strawberry");
6409 Color.a("#FC6C85", "Wild watermelon");
6410 Color.a("#FD5800", "Willpower orange");
6411 Color.a("#A75502", "Windsor tan");
6412 Color.a("#722F37", "Wine");
6413 Color.a("#C9A0DC", "Wisteria");
6414 Color.a("#C19A6B", "Wood brown");
6415 Color.a("#738678", "Xanadu");
6416 Color.a("#0F4D92", "Yale Blue");
6417 Color.a("#1C2841", "Yankees blue");
6418 Color.a("#FCE883", "Yellow Crayola");
6419 Color.a("#EFCC00", "Yellow Munsell");
6420 Color.a("#FEDF00", "Yellow Pantone");
6421 Color.a("#FEFE33", "Yellow");
6422 Color.a("#9ACD32", "Yellow Green");
6423 Color.a("#FFAE42", "Yellow Orange");
6424 Color.a("#FFF000", "Yellow rose");
6425 Color.a("#0014A8", "Zaffre");
6426 Color.a("#2C1608", "Zinnwaldite brown");
6427 Color.a("#39A78E", "Zomp");
6428
6429 // where it receives the message
6430 gClient.on("a", function (msg) {
6431 chat.receive(msg);
6432 });
6433
6434 $("#chat input").on("focus", function (evt) {
6435 releaseKeyboard();
6436 $("#chat").addClass("chatting");
6437 chat.scrollToBottom();
6438 });
6439
6440 $(document).mousedown(function (evt) {
6441 if (!$("#chat").has(evt.target).length > 0) {
6442 chat.blur();
6443 }
6444 });
6445
6446 document.addEventListener("touchstart", function (event) {
6447 for (var i in event.changedTouches) {
6448 var touch = event.changedTouches[i];
6449 if (!$("#chat").has(touch.target).length > 0) {
6450 chat.blur();
6451 }
6452 }
6453 });
6454
6455 $(document).on("keydown", function (evt) {
6456 if ($("#chat").hasClass("chatting")) {
6457 if (evt.keyCode == 27) {
6458 chat.blur();
6459 evt.preventDefault();
6460 evt.stopPropagation();
6461 } else if (evt.keyCode == 13) {
6462 $("#chat input").focus();
6463 }
6464 } else if (!gModal && (evt.keyCode == 27 || evt.keyCode == 13)) {
6465 $("#chat input").focus();
6466 }
6467 });
6468
6469 $("#chat input").on("keydown", function (evt) {
6470 if (evt.keyCode == 13) {
6471 var message = $(this).val();
6472
6473 // ♥ // local commands // ♥ //
6474
6475 if (message.length == 0) { //close chat if no input
6476 chat.blur();
6477
6478 } else if (message.substring(0, 6).toLowerCase() == cmdChar+"lhelp" || message.substring(0, 6).toLowerCase() == "!lhelp") { //local command list
6479 // thanks Someguy!
6480 localMsg("Local Commands: "+cmdChar+"name, "+cmdChar+"svol (speech volume), "+cmdChar+"spitch (speech pitch), "+cmdChar+"srate (speech speed), "+cmdChar+"sdefault, "+cmdChar+"lobby, "+cmdChar+"juggle (juggles the crown if you have it), "+cmdChar+"givefish (gives fish to fishlord), "+cmdChar+"fishlord (sets person who receives fish), "+cmdChar+"mathcheat (auto answers any "+cmdChar+"math question after a short delay)");
6481 $(this).val(""); //empties chatbox
6482 chat.blur(); //closes chat
6483
6484 } else if (message.substring(0, 5).toLowerCase() == cmdChar+"name" || message.substring(0, 5).toLowerCase() == "!name") { //name
6485 if (message.substring(5).trim() == "") {
6486 msgBox('Rename', 'Usage: '+cmdChar+'name new_name.', 3000, '#piano');
6487
6488 } else {
6489 gClient.sendArray([{
6490 "m": "userset",
6491 "set": {
6492 "name": message.substring(5).trim()
6493 }
6494 }]);
6495 selfName = message.substring(5).trim();
6496 msgBox('Renamed', message.substring(5).trim(), 3000, '#piano');
6497 }
6498 $(this).val("");
6499 chat.blur();
6500
6501 } else if (message.substring(0, 5).toLowerCase() == cmdChar+"svol" || message.substring(0, 5).toLowerCase() == "!svol") { //speech volume
6502 var speechVolumeTEMP = message.substring(6).trim()
6503 if (isNaN(speechVolumeTEMP) || speechVolumeTEMP > 1 || speechVolumeTEMP < 0 || speechVolumeTEMP == '') {
6504 msgBox('Speech Volume [usage]', 'Please enter a number no greater than 1 and no less than 0.', 5000, '#piano');
6505 $(this).val("");
6506 chat.blur();
6507 return;
6508
6509 } else {
6510 speechVolume = speechVolumeTEMP; //sets new variable value
6511 msgBox('Speech Volume', speechVolume, 3000, '#piano');
6512
6513 $(this).val("");
6514 chat.blur();
6515 }
6516
6517 } else if (message.substring(0, 7).toLowerCase() == cmdChar+"spitch" || message.substring(0, 7).toLowerCase() == "!spitch") { //speech pitch
6518 var speechPitchTEMP = message.substring(8).trim()
6519 if (isNaN(speechPitchTEMP) || speechPitchTEMP > 2 || speechPitchTEMP < 0 || speechPitchTEMP == '') {
6520 msgBox('Speech Pitch [usage]', 'Please enter a number no greater than 2 and no less than 0.', 5000, '#piano');
6521 $(this).val("");
6522 chat.blur();
6523 return;
6524
6525 } else {
6526 speechPitch = message.substring(8).trim() //sets new variable value
6527 msgBox('Pitch', speechPitch, 3000, '#piano');
6528 $(this).val("");
6529 chat.blur();
6530 }
6531
6532 } else if (message.substring(0, 6).toLowerCase() == cmdChar+"srate" || message.substring(0, 6).toLowerCase() == "!srate") { //speech rate
6533 var speechRateTEMP = message.substring(7).trim()
6534 if (isNaN(speechRateTEMP) || speechRateTEMP > 2 || speechRateTEMP < 0 || speechRateTEMP == '') {
6535 msgBox('Speech Pitch [usage]', 'Please enter a number no greater than 2 and no less than 0.', 5000, '#piano');
6536 $(this).val("");
6537 chat.blur();
6538 return;
6539
6540 } else {
6541 speechRate = message.substring(7).trim() //sets new variable value
6542 msgBox('Rate', speechRate, 3000, '#piano');
6543 $(this).val("");
6544 chat.blur();
6545 }
6546
6547 } else if (message.substring(0, 9).toLowerCase() == cmdChar+"sdefault" || message.substring(0, 9).toLowerCase() == "!sdefault") { //speech default
6548 speechVolume = 0.5; //default volume for spoken text
6549 speechPitch = 1; //default pitch for spoken text
6550 speechRate = 1; //default speed for spoken text
6551 msgBox('Speech Default', 'Volume, pitch and rate all reset.', 3000, '#piano');
6552 $(this).val("");
6553 chat.blur();
6554
6555 } else if (message.substring(0, 6).toLowerCase() == cmdChar+"lobby" || message.substring(0, 6).toLowerCase() == "!lobby") { //lobby
6556 if (gClient.isOwner()) {
6557 var lobbyConfirm = prompt("Are you sure you want to turn this room into a lobby?\nThis cannot be undone.\n\nEnter \"Yes, I am sure.\" below to continue.");
6558 if (lobbyConfirm == "Yes, I am sure.") {
6559 MPP.client.sendArray([{m: "chset", set: {lobby: true}}]);
6560 msgBox('Room is now a lobby', '', 3000, '#piano');
6561 } else {
6562 alert("Incorrectly entered text or you cancled.");
6563 }
6564
6565 } else {
6566 alert("You're not the owner of this room!");
6567 }
6568
6569 $(this).val("");
6570 chat.blur();
6571
6572 } else if (message.substring(0, 9).toLowerCase() == cmdChar+"givefish" || message.substring(0, 9).toLowerCase() == "!givefish") { //give fish
6573 giveFish = !giveFish;
6574 if (!giveFish) {
6575 msgBox('Give Fish', 'Off', 3000, '#piano');
6576
6577 } else {
6578 msgBox('Give Fish', 'On', 3000, '#piano');
6579 }
6580
6581 $(this).val("");
6582 chat.blur();
6583
6584 } else if (message.substring(0, 9).toLowerCase() == cmdChar+"fishlord" || message.substring(0, 9).toLowerCase() == "!fishlord") { //fish lord
6585 fishLord = message.substring(10).trim();
6586 if (fishLord == '') {
6587 msgBox('Fish Lord [usage]', cmdChar+'fishlord name_here', 3000, '#piano');
6588 $(this).val("");
6589 chat.blur();
6590 return;
6591 }
6592 msgBox('Fish Lord', 'Fish lord: ' + fishLord, 3000, '#piano');
6593 $(this).val("");
6594 chat.blur();
6595
6596 } else if (message.substring(0, 7).toLowerCase() == cmdChar+"juggle" || message.substring(0, 7).toLowerCase() == "!juggle") { //juggle
6597 function jugglePls() {
6598 juggling = setInterval(function() {
6599 gClient.sendArray([{
6600 m: "chown"
6601 }]);
6602 }, 2100); //2300 is good for just the dropping of it
6603 }
6604
6605 if (juggle) {
6606 juggle = false;
6607 clearInterval(juggling);
6608
6609 gClient.sendArray([{
6610 m: "chown",
6611 id: gClient.participantId
6612 }]);
6613 msgBox('Juggle Crown', 'Off', 2000, '#piano');
6614
6615 } else {
6616 juggle = true;
6617 jugglePls();
6618 msgBox('Juggle Crown', 'On', 2000, '#piano');
6619 }
6620
6621 $(this).val("");
6622 chat.blur();
6623
6624 } else if (message.substring(0, 10).toLowerCase() == cmdChar+"mathcheat" || message.substring(0, 10).toLowerCase() == "!mathcheat") { //juggle
6625 if (mathCheat) {
6626 mathCheat = false;
6627 msgBox('Math Cheats', 'Off', 2000, '#piano');
6628 } else {
6629 mathCheat = true;
6630 msgBox('Math Cheats', 'On', 2000, '#piano');
6631 }
6632
6633 $(this).val("");
6634 chat.blur();
6635
6636 // ♥ // local commands // ♥ //
6637
6638 } else if (message.length <= 512) {
6639 if (!meow && !leet) {
6640 //console.log("Triggered first");
6641 chat.send(message);
6642 $(this).val("");
6643 chat.blur();
6644 }
6645 if (message.substring(0,1).trim() != "!" && message.substring(0,1).trim() != "/" && message.substring(0,1).trim() != cmdChar) {
6646 if (meow) {
6647 //thanks electrashave!
6648 leet = false;
6649 var words = ['meow', 'meow', 'mew', 'purr'];
6650 var final = '';
6651 for (var i = 0; words.length > i; i++) {
6652 final += words[Math.floor(Math.random()*words.length)] + ' ';
6653 }
6654 final = final.toLowerCase();
6655 final = final.charAt(0).toUpperCase() + final.slice(1).trim() + '. *' + message.trim() + '*';
6656 chat.send(final);
6657 $(this).val("");
6658 chat.blur();
6659
6660 } else if (!leet){
6661 $(this).val("");
6662 chat.blur();
6663 }
6664
6665 if (leet) {
6666 meow = false;
6667 var alpha1 = "abcdefghijklmnopqrstuvwxyz0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~`?-=[]\;'\",./_+{}|:<>!@#$%^&*()♥°¬";
6668 var alpha2 = "4bcd3fgh1jklmn0pqrstuvwxyz0123456789 4BCD3FGH1JKLMN0PQRSTUVWXYZ0123456789~`?-=[]\;'\",./_+{}|:<>!@#$%^&*()♥°¬";
6669 var str = message;
6670 var newstr = '';
6671 for (var i = 0; i < str.length; i++) {
6672 charPos = alpha1.indexOf(str.charAt(i));
6673 newstr += alpha2.charAt(charPos);
6674 }
6675 chat.send(newstr);
6676 $(this).val("");
6677 chat.blur();
6678
6679 } else if (!meow) {
6680 $(this).val("");
6681 chat.blur();
6682 }
6683
6684 } else if (meow || leet) {
6685 //console.log("Triggered final");
6686 chat.send(message);
6687 $(this).val("");
6688 chat.blur();
6689 }
6690
6691 }
6692
6693 evt.preventDefault();
6694 evt.stopPropagation();
6695 } else if (evt.keyCode == 27) {
6696 chat.blur();
6697 evt.preventDefault();
6698 evt.stopPropagation();
6699 } else if (evt.keyCode == 9) {
6700 evt.preventDefault();
6701 evt.stopPropagation();
6702 }
6703 });
6704
6705 return {
6706 show: function () {
6707 $("#chat").fadeIn();
6708 },
6709
6710 hide: function () {
6711 $("#chat").fadeOut();
6712 },
6713
6714 clear: function () {
6715 if (clearChat) {
6716 $("#chat li").remove();
6717 return;
6718 }
6719 },
6720
6721 scrollToBottom: function () {
6722 var ele = $("#chat ul").get(0);
6723 ele.scrollTop = ele.scrollHeight;
6724 },
6725
6726 blur: function () {
6727 if ($("#chat").hasClass("chatting")) {
6728 $("#chat input").get(0).blur();
6729 $("#chat").removeClass("chatting");
6730 chat.scrollToBottom();
6731 captureKeyboard();
6732 }
6733 },
6734
6735 send: function (message) {
6736 gClient.sendArray([{
6737 m: "a",
6738 message: message
6739 }]);
6740 },
6741
6742
6743 receive: function (msg) {
6744 if (gChatMutes.indexOf(msg.p._id) != -1) return;
6745 msg.a = msg.a.replace(/</g, '<');
6746 msg.p.name = msg.p.name.replace(/</g, '<');
6747 content = msg.a.replace(/((https?\:\/\/|ftp\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi, function(url) {
6748 nice = url;
6749 if( url.match('^https?:\/\/') ) nice = nice.replace(/^https?:\/\//i,'')
6750 else url = 'http://' + url;
6751
6752 return '<a target="_blank" style="text-decoration: none;" href="'+ url +'">'+ url +'</a>';
6753 });
6754 var final = content;
6755
6756 var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
6757
6758 var li = $('<li><span class="name"/><span style="position: initial!important;" class="message"/>');
6759
6760 li.find(".name").html(msg.p.name + afterName); //fix for <3 showing up as lt;3 using .text instead of .html -thanks Someguy
6761 if (debug) {
6762 li.find(".name").html("[" + msg.p._id + "] " + msg.p.name + afterName);
6763 }
6764 if (timeStamp) {
6765 li.find(".name").html(getTime() + " | " + msg.p.name + afterName);
6766 }
6767 li.find(".message").html(
6768 "<span class='msg_'>"+ final + "</span>"
6769 );
6770
6771 li.css("color", msg.p.color || "white");
6772
6773 $("#chat ul").append(li);
6774
6775 var eles = $("#chat ul li").get();
6776 for (var i = 1; i <= 50 && i <= eles.length; i++) {
6777 eles[eles.length - i].style.opacity = 1.0 - (i * 0.03); //chat fade
6778 }
6779 if (eles.length > 50) {
6780 eles[0].style.display = "none";
6781 }
6782 if (eles.length > chatLimit) { //max chat log history default was 256
6783 $(eles[0]).remove();
6784 }
6785 updateChatLength(eles.length);
6786
6787 // scroll to bottom if not "chatting" or if not scrolled up
6788 if (!$("#chat").hasClass("chatting")) {
6789 chat.scrollToBottom();
6790 } else {
6791 var ele = $("#chat ul").get(0);
6792 if (ele.scrollTop > ele.scrollHeight - ele.offsetHeight - 50)
6793 chat.scrollToBottom();
6794 }
6795 if (debug2) {
6796 // test
6797 //idea to fix, I think it's the way you += the string. You need to replace the orginial with nothing then add the extra chars
6798 //length of msg: $('#chat li .msg_').get(0).innerHTML.length
6799 var myString = $('#chat li:last .msg_').get(0).innerHTML;
6800 var cut = myString.length;
6801 console.log("length: " + cut);
6802 var myArray = myString.split("");
6803 var loopTimer = 70;
6804 console.log('before loop ' + myString);
6805 $('#chat li:last .msg_').get(0).innerHTML = myString.substring(cut, cut);
6806 var frameLooper = setInterval( function() {
6807 console.log('looping ' + myString);
6808 if(myArray.length > 0) {
6809 $('#chat li:last .msg_').get(0).innerHTML += myArray.shift();
6810 } else {
6811 clearInterval(frameLooper);
6812 console.log('clearing loop ' + myString);
6813 return false;
6814 }
6815 }, loopTimer);
6816 console.log('done ' + myString);
6817
6818 //$('#chat li:last .msg_').get(0).innerHTML
6819
6820 // test
6821 }
6822
6823
6824 }
6825 };
6826
6827 })();
6828
6829
6830 clearChatFunc = function() {
6831 chat.clear();
6832 updateChatLength(0);
6833 }
6834
6835
6836 // use midi bridge (old one started here)
6837 $("#blah-btn").on("click", function (evt) {
6838 var pRoom = prompt("Enter the name of your lobby...", hotkeyRoom);
6839 if (!pRoom) return;
6840 var room_name = pRoom;
6841 changeRoom(room_name, "right", {
6842 "visible": true,
6843 "chat": true,
6844 "crownsolo": false,
6845 "lobby": true
6846 });
6847 });
6848
6849 // use midi bridge (old one ended here)
6850
6851
6852 // New MIDI
6853 var gWebMidiWorking;
6854 (function() {
6855
6856 MIDI_TRANSPOSE = -12;
6857
6858 var MIDI_KEY_NAMES = ["a-1", "as-1", "b-1"];
6859 var bare_notes = "c cs d ds e f fs g gs a as b".split(" ");
6860 for(var oct = 0; oct < 7; oct++) {
6861 for(var i in bare_notes) {
6862 MIDI_KEY_NAMES.push(bare_notes[i] + oct);
6863 }
6864 }
6865 MIDI_KEY_NAMES.push("c7");
6866
6867 if (navigator.requestMIDIAccess) {
6868 navigator.requestMIDIAccess().then(
6869 function(midi) {
6870 console.log(midi);
6871 if(midi.inputs.size > 0) {
6872 var inputs = midi.inputs.values();
6873 for(var input_it = inputs.next(); input_it && !input_it.done; input_it = inputs.next()) {
6874 var input = input_it.value;
6875 console.log(input);
6876 input.onmidimessage = function(evt) {
6877 var channel = evt.data[0] & 0xf;
6878 var cmd = evt.data[0] >> 4;
6879 var note_number = evt.data[1];
6880 var vel = evt.data[2];
6881 //console.log(channel, cmd, note_number, vel);
6882 if(cmd == 8 || (cmd == 9 && vel == 0)) {
6883 // NOTE_OFF
6884 release(MIDI_KEY_NAMES[note_number - 9 + MIDI_TRANSPOSE]);
6885 } else if(cmd == 9) {
6886 // NOTE_ON
6887 press(MIDI_KEY_NAMES[note_number - 9 + MIDI_TRANSPOSE], vel / 100);
6888 } else if(cmd == 11) {
6889 // CONTROL_CHANGE
6890 if(!gAutoSustain) {
6891 if(note_number == 64) {
6892 if(vel > 0) {
6893 pressSustain();
6894 } else {
6895 releaseSustain();
6896 }
6897 }
6898 }
6899 }
6900 };
6901 if(!gWebMidiWorking) {
6902 gWebMidiWorking = true;
6903 new Notification({title:"Nice!", text:"Web MIDI is going.", duration:2000}); //MIDI working
6904 }
6905 }
6906 } else {
6907 console.log("no midi inputs");
6908 gWebMidiWorking = false;
6909 }
6910 if(gMidiOutTest && midi.outputs.size > 0) {
6911 var outputs = midi.outputs.values();
6912 for(var output_it = outputs.next(); output_it && !output_it.done; output_it = outputs.next()) {
6913 var output = output_it.value;
6914 console.log(output);
6915 }
6916 gMidiOutTest = function(note_name, vel, delay_ms) {
6917 var note_number = MIDI_KEY_NAMES.indexOf(note_name);
6918 if(note_number == -1) return;
6919 note_number = note_number + 9 - MIDI_TRANSPOSE;
6920
6921 var outputs = midi.outputs.values();
6922 for(var output_it = outputs.next(); output_it && !output_it.done; output_it = outputs.next()) {
6923 var output = output_it.value;
6924 output.send([0x90, note_number, vel], window.performance.now() + delay_ms);
6925 }
6926 }
6927 }
6928 },
6929 function(err){
6930 console.log(err);
6931 gWebMidiWorking = false;
6932 } );
6933 }
6934 })();
6935
6936
6937
6938 //More button
6939 (function () {
6940 var loaded = false;
6941 $("#social").fadeIn(250);
6942 $("#more-button").click(function () {
6943 //stuff goes between here and..
6944 if (leet) {
6945 leet = false;
6946 } else {
6947 leet = true;
6948 }
6949 msgBox('1337 Mode', ''+leet, 2000, '#piano');
6950 });
6951 })();
6952
6953
6954 //api
6955 //window.MPP
6956 MPP = {
6957 press: press,
6958 release: release,
6959 piano: gPiano,
6960 client: gClient,
6961 chat: chat,
6962 msgBox: msgBox
6963 };
6964
6965
6966});
6967//main end
6968
6969//Thanks B@K$
6970MPP.client.sendArray = function(arr) {
6971 if (arr[0].m == "m") {
6972 logie = this;
6973 logie.participantUpdate({
6974 id: logie.participantId
6975 , x: parseFloat(arr[0].x)
6976 , y: parseFloat(arr[0].y)
6977 , m: "m"
6978 });
6979 }
6980 this.send(JSON.stringify(arr));
6981}
6982
6983// miscellaneous HTML changes
6984 // default place holder for chat
6985 $("#chat .translate").attr("placeholder", "")
6986
6987// miscellaneous HTML changes
6988
6989//HTML Stuff (note: the big buttons are 120px apart and the heart buttons are 25px apart -Logan)
6990//button 1
6991$("body #bottom .relative").append('<div id="1-btn" class="ugly-button 1_btn" style="position: fixed;bottom: 29px;right: 365px;width: 100px">Toggle Piano</div>');
6992$("#1-btn").click(function(){
6993 $("#piano").fadeToggle(1000);
6994});
6995
6996//Joke Generator
6997//button 2
6998$("body #bottom .relative").append('<div id="2-btn" class="ugly-button 2_btn" style="position: fixed;bottom: 29px;right: 245px;width: 100px">Joke Generator</div>');
6999$("#2-btn").click(function(){
7000 var Animal = ['chicken', 'turtle', 'rabbit', 'rat', 'kangaroo', 'cuddlepet', 'fox', 'wolf', 'bat', 'gecko', 'scorpion', 'cat', 'dog', 'parrot', 'seagull', 'elf', 'pony', 'pixie', 'polar bear', 'penguin', 'anteater', 'chipmunk', 'monkey', 'gorilla', 'goat', 'emu', 'elephant', 'horse', 'frog', 'hamster', 'duck', 'flamingo', 'eagle', 'gerbil', 'catfish', 'baboon', 'reindeer', 'seal', 'walrus', 'worm', 'Turkey', 'Panda', 'mule', 'donkey', 'meerkat', 'shark', 'lion', 'tiger', 'jaguar', 'jellyfish', 'igunana', 'lemming', 'crab', 'ladybird', 'rinoceros'];
7001 var Location = ['road', 'beach', 'field', 'desert', 'parking-lot', 'rugby park', 'lake', 'forest', 'table', 'railway', 'boat', 'village', 'airport', 'city', 'mall', 'river', 'quicksand', 'orchard', 'island', 'hall', 'stage', 'golf course', 'driveway'];
7002 var Punchline = ['To cuddle with a bunny.', 'To buy a jar of cat semen.', 'To put out a fire.', 'To buy a jar of dog semen.', 'To escape the anons.', 'To get to the other side.', 'To buy a chocolate milk.', 'To visit ' + selfName + '.', 'To buy small shoes.', 'To buy sheet music.', 'To stomp the small children.', 'To buy balloons.', 'To make better punchlines.', 'To buy a big fluffy bed to sleep in and cuddle.', 'To stamp on a cat with gumboots.', 'To help an eldery woman get run over.', 'To bite people.', 'To scratch people.', 'To eat people.', 'To aquire a large stick.', 'To send mail.', 'So it could die over there.', 'So it could strangulate small mammals.', 'So it could transport illicit drugs.', 'Because there was a car coming.', 'Because it’s cool.', 'Because it’s fat.', 'To sniff things up its nose.'];
7003 var Aselection = Math.floor(Math.random() * Animal.length);
7004 var Lselection = Math.floor(Math.random() * Location.length);
7005 var Pselection = Math.floor(Math.random() * Punchline.length);
7006 jokeGens++;
7007 document.getElementById("2-btn").innerHTML = "Joke Generator " + jokeGens
7008 sendChat("[Joke Generator #" + jokeGens + "] Why did the " + Animal[Aselection] + " cross the " + Location[Lselection] + "? " + Punchline[Pselection]);
7009});
7010
7011//Bunny ASCII Art
7012//button 3
7013$("body #bottom .relative").append('<div id="3-btn" class="ugly-button 3_btn" style="position: fixed;bottom: 29px;right: 125px;width: 100px">Bunny ASCII Art</div>');
7014$("#3-btn").click(function(){
7015
7016 });
7017
7018//♥ Test Button ♥
7019//button 4
7020function updateChatLength(num) {
7021 document.getElementById("4-btn").innerHTML = "Msgs: " + num;
7022}
7023$("body #bottom .relative").append('<div id="4-btn" class="ugly-button 4_btn" style="position: fixed;bottom: 29px;right: 5px;width: 100px; text-align:center"; title="Messages shown in chat">Msgs: 0</div>');
7024$("#4-btn").click(function(){
7025 var yayNayChat = confirm("Do you want to clear the chat?");
7026
7027 if (yayNayChat) {
7028 clearChat = true;
7029 clearChatFunc();
7030 clearChat = false;
7031 }
7032});
7033
7034//♥ button 5
7035$("body #bottom .relative").append('<div id="5-btn" class="ugly-button 5_btn" style="position: fixed;color: red;bottom: 2px;right: 5px;width: 10px"; title="Debug Toggle">♥</div>');
7036$("#5-btn").click(function(){
7037 if (debug) {
7038 //off
7039 debug = false;
7040 document.getElementById("5-btn").style.color = "red";
7041 } else {
7042 //on
7043 debug = true;
7044 document.getElementById("5-btn").style.color = "green";
7045 }
7046});
7047
7048//♥ button 6
7049$("body #bottom .relative").append('<div id="6-btn" class="ugly-button 6_btn" style="position: fixed;color: orange;bottom: 2px;right: 30px;width: 10px"; title="I love you :3">♥</div>');
7050$("#6-btn").click(function(){
7051 document.getElementById("6-btn").style.color = Col();
7052 //nothing as of now
7053});
7054
7055//♥ button 7
7056$("body #bottom .relative").append('<div id="7-btn" class="ugly-button 7_btn" style="position: fixed;color: yellow;bottom: 2px;right: 55px;width: 10px"; title="I love you :3">♥</div>');
7057$("#7-btn").click(function(){
7058 document.getElementById("7-btn").style.color = Col();
7059 //nothing as of now
7060});
7061
7062//♥ button 8
7063$("body #bottom .relative").append('<div id="8-btn" class="ugly-button 8_btn" style="position: fixed;color: green;bottom: 2px;right: 80px;width: 10px"; title="I love you :3">♥</div>');
7064$("#8-btn").click(function(){
7065 document.getElementById("8-btn").style.color = Col();
7066 //nothing as of now
7067});
7068
7069//♥ button 9
7070$("body #bottom .relative").append('<div id="9-btn" class="ugly-button 9_btn" style="position: fixed;color: blue;bottom: 2px;right: 105px;width: 10px"; title="I love you :3">♥</div>');
7071$("#9-btn").click(function(){
7072 document.getElementById("9-btn").style.color = Col();
7073 //nothing as of now
7074});
7075
7076//♥ button 10
7077$("body #bottom .relative").append('<div id="10-btn" class="ugly-button 10_btn" style="position: fixed;color: indigo;bottom: 2px;right: 130px;width: 10px"; title="I love you :3">♥</div>');
7078$("#10-btn").click(function(){
7079 document.getElementById("10-btn").style.color = Col();
7080 //nothing as of now
7081});
7082
7083//♥ button 11
7084$("body #bottom .relative").append('<div id="11-btn" class="ugly-button 11_btn" style="position: fixed;color: violet;bottom: 2px;right: 155px;width: 10px"; title="I love you :3">♥</div>');
7085$("#11-btn").click(function(){
7086 document.getElementById("11-btn").style.color = Col();
7087 //nothing as of now
7088});
7089
7090//♥ button 12
7091$("body #bottom .relative").append('<div id="12-btn" class="ugly-button 12_btn" style="position: fixed;color: indigo;bottom: 2px;right: 180px;width: 10px"; title="Debug Toggle">♥</div>');
7092$("#12-btn").click(function(){
7093 document.getElementById("12-btn").style.color = Col();
7094 //nothing as of now
7095});
7096
7097//♥ button 13
7098$("body #bottom .relative").append('<div id="13-btn" class="ugly-button 13_btn" style="position: fixed;color: blue;bottom: 2px;right: 205px;width: 10px"; title="I love you :3">♥</div>');
7099$("#13-btn").click(function(){
7100 document.getElementById("13-btn").style.color = Col();
7101 //nothing as of now
7102});
7103
7104//♥ button 14
7105$("body #bottom .relative").append('<div id="14-btn" class="ugly-button 14_btn" style="position: fixed;color: green;bottom: 2px;right: 230px;width: 10px"; title="I love you :3">♥</div>');
7106$("#14-btn").click(function(){
7107 document.getElementById("14-btn").style.color = Col();
7108 //nothing as of now
7109});
7110
7111//♥ button 15
7112$("body #bottom .relative").append('<div id="15-btn" class="ugly-button 15_btn" style="position: fixed;color: yellow;bottom: 2px;right: 255px;width: 10px"; title="I love you :3">♥</div>');
7113$("#15-btn").click(function(){
7114 document.getElementById("15-btn").style.color = Col();
7115 //nothing as of now
7116});
7117
7118//♥ button 16
7119$("body #bottom .relative").append('<div id="16-btn" class="ugly-button 16_btn" style="position: fixed;color: orange;bottom: 2px;right: 280px;width: 10px"; title="I love you :3">♥</div>');
7120var playingMid = false;
7121document.getElementById("16-btn").style.color = "red";
7122$("#16-btn").click(function(){
7123 if (!playingMid) {
7124 //MIDIjs.play('http://localhost:3000/midis/logan.mid');
7125 playingMid = true;
7126 document.getElementById("16-btn").style.color = "green";
7127 } else {
7128 //MIDIjs.stop();
7129 document.getElementById("16-btn").style.color = "red";
7130 playingMid = false;
7131 }
7132});
7133
7134//♥ button 17
7135$("body #bottom .relative").append('<div id="17-btn" class="ugly-button 17_btn" style="position: fixed;color: red;bottom: 2px;right: 305px;width: 10px"; title="Spin :3">♥</div>');
7136var spinning = false;
7137document.getElementById("17-btn").style.color = "red";
7138$("#17-btn").click(function(){
7139 if (spinning) {
7140 document.getElementById("17-btn").style.color = "red";
7141 $("#piano").removeClass("spin");
7142 spinning = false;
7143 } else {
7144 document.getElementById("17-btn").style.color = "green";
7145 $("#piano").addClass("spin");
7146 spinning = true;
7147 }
7148});
7149
7150//♥ button 18
7151$("body #bottom .relative").append('<div id="18-btn" class="ugly-button 18_btn" style="position: fixed;color: orange;bottom: 2px;right: 330px;width: 10px"; title="Bm">♥</div>');
7152$("#18-btn").click(function(){
7153 document.getElementById("18-btn").style.color = Col();
7154 MPP.press("b1", volume); MPP.press("fs2", volume); MPP.press("d2", volume); MPP.press("b2", volume); MPP.press("b-1", volume);
7155});
7156
7157//♥ button 19
7158$("body #bottom .relative").append('<div id="19-btn" class="ugly-button 19_btn" style="position: fixed;color: yellow;bottom: 2px;right: 355px;width: 10px"; title="B">♥</div>');
7159$("#19-btn").click(function(){
7160 document.getElementById("19-btn").style.color = Col();
7161 MPP.press("b1", volume); MPP.press("fs2", volume); MPP.press("ds2", volume); MPP.press("b2", volume); MPP.press("b-1", volume);
7162});
7163
7164//♥ button 20
7165$("body #bottom .relative").append('<div id="20-btn" class="ugly-button 20_btn" style="position: fixed;color: green;bottom: 2px;right: 380px;width: 10px"; title="F#7(3rd inv)">♥</div>');
7166$("#20-btn").click(function(){
7167 document.getElementById("20-btn").style.color = Col();
7168 MPP.press("cs2", volume); MPP.press("e2", volume); MPP.press("as2", volume); MPP.press("fs0", volume);
7169});
7170
7171//♥ button 21
7172$("body #bottom .relative").append('<div id="21-btn" class="ugly-button 21_btn" style="position: fixed;color: blue;bottom: 2px;right: 405px;width: 10px"; title="C#m">♥</div>');
7173$("#21-btn").click(function(){
7174 document.getElementById("21-btn").style.color = Col();
7175 MPP.press("cs2", volume); MPP.press("e2", volume); MPP.press("gs2", volume); MPP.press("cs0", volume);
7176});
7177
7178//♥ button 22
7179$("body #bottom .relative").append('<div id="22-btn" class="ugly-button 22_btn" style="position: fixed;color: indigo;bottom: 2px;right: 430px;width: 10px"; title="Csus(#4 #5)">♥</div>');
7180$("#22-btn").click(function(){
7181 document.getElementById("22-btn").style.color = Col();
7182 MPP.press("c2", volume); MPP.press("fs2", volume); MPP.press("gs2", volume);
7183});
7184
7185//♥ button 23
7186$("body #bottom .relative").append('<div id="23-btn" class="ugly-button 23_btn" style="position: fixed;color: violet;bottom: 2px;right: 455px;width: 10px"; title="E(2nd inv)">♥</div>');
7187$("#23-btn").click(function(){
7188 document.getElementById("23-btn").style.color = Col();
7189 MPP.press("b1", volume); MPP.press("e2", volume); MPP.press("gs2", volume);
7190});
7191
7192//♥ button 24
7193$("body #bottom .relative").append('<div id="24-btn" class="ugly-button 24_btn" style="position: fixed;bottom: 28px;right: 1072px;width: 10px"; title="cmd symbol">!</div>');
7194$("#24-btn").click(function(){
7195 setCmdChar();
7196 updateCmdChar(cmdChar);
7197
7198});
7199
7200// le label
7201$("body").append('<div id="resource-label" style="position: fixed; bottom: 529px; right: 17px;">Resource Monitor</div>');
7202
7203// thanks http://stackoverflow.com/users/165737/anurag
7204$("body #resource-label").css("fontSize", "11px");
7205
7206console.log(window.performance.now() - startUpDelay);
7207
7208// @copyright 2015+, electrashave
7209if (window.localStorage) {
7210 if (!localStorage.soundpack) {
7211 localStorage.soundpack = JSON.stringify({
7212 url: '/mp3/',
7213 ext: '.wav.mp3',
7214 name: 'MPP Default'
7215 });
7216 }
7217}
7218var soundpack = JSON.parse(localStorage.soundpack);
7219
7220$("#volume-label").text("Volume: " + Math.floor(MPP.piano.audio.volume * 100) + "%");
7221$(".volume-slider").on("mousemove", function(evt) {
7222 var v = evt.srcElement.value;
7223 MPP.piano.audio.setVolume(v);
7224 if (window.localStorage) localStorage.volume = v;
7225 $("#volume-label").text("Volume: " + Math.floor(v * 100) + "%");
7226});
7227
7228function reloadSounds(meow, asdf) {
7229if (meow.name == soundpack.name && !asdf) return false;
7230soundpack = meow;
7231 for (var i in MPP.piano.keys) {
7232 if (!MPP.piano.keys.hasOwnProperty(i)) continue;
7233 (function() {
7234 var key = MPP.piano.keys[i];
7235 MPP.piano.audio.load(key.note, soundpack.url + key.note + soundpack.ext, function() { //thanks Sommie
7236 key.loaded = true;
7237 key.timeLoaded = Date.now();
7238 if (key.domElement) // todo: move this to renderer somehow
7239 $(key.domElement).removeClass("loading");
7240 });
7241 })();
7242 }
7243 $("#meow").val("Current Sound: " + soundpack.name);
7244}
7245reloadSounds(soundpack, true);
7246//$.getScript('http://pastebin.com/raw.php?i=hWr6BgjW');
7247var gModal;
7248
7249function modalHandleEsc(evt) {
7250 if (evt.keyCode == 27) {
7251 closeModal();
7252 evt.preventDefault();
7253 evt.stopPropagation();
7254 }
7255};
7256
7257function openModal(selector, focus) {
7258 chat.blur();
7259 $(document).on("keydown", modalHandleEsc);
7260 $("#modal #modals > *").hide();
7261 $("#modal").fadeIn(250);
7262 $(selector).show();
7263 setTimeout(function() {
7264 $(selector).find(focus).focus();
7265 }, 100);
7266 gModal = selector;
7267};
7268
7269function closeModal() {
7270 $(document).off("keydown", modalHandleEsc);
7271 $("#modal").fadeOut(100);
7272 $("#modal #modals > *").hide();
7273 gModal = null;
7274
7275};
7276
7277
7278//from Logies script
7279setInterval(function() {
7280 for (var id in MPP.client.ppl) {
7281 if (!MPP.client.ppl.hasOwnProperty(id)) continue;
7282 var part = MPP.client.ppl[id];
7283 if (part.cursorDiv && (Math.abs(part.x - part.displayX) > 0.1 || Math.abs(part.y - part.displayY) > 0.1)) {
7284 part.displayX += (part.x - part.displayX) * 0.25;
7285 part.displayY += (part.y - part.displayY) * 0.25;
7286 part.cursorDiv.style.left = part.displayX + "%";
7287 part.cursorDiv.style.top = part.displayY + "%";
7288 }
7289 }
7290}, 1);
7291
7292$("#modals").append('<div id="select-sound" class="dialog" style="display: none; height: 275px; margin-top: -130px;"><input type="text" class="text translate" id="meow" value="Current Sound: ' + soundpack.name + '" readonly><p></p><p></p><div class="ugly-button default-piano">MPP Default</div><p></p> <p></p><div class="ugly-button hard-piano">Maestro</div><p></p> <p></p><div class="ugly-button new-piano">Guitar</div><p></p> <p></p><div class="ugly-button soft-piano">Soft Piano</div><p></p> <p></p><div class="ugly-button harpsicord">Klaver</div><p></p> <p></p><div class="ugly-button music-box">NewPiano</div><p></p> <p></p><div class="ugly-button bells">8-bit</div><p></p> </div>');
7293
7294$("body #bottom .relative").append('<div id="sound-btn" class="ugly-button sound-btn" style="position: fixed;bottom: 23px;right: 30px;width: 100px">Sounds</div>'); // bottom: 30px;right: 588px; = default
7295$("#sound-btn").click(function() {
7296 openModal("#select-sound");
7297});
7298$("#select-sound .new-piano").click(function() {
7299 localStorage.soundpack = JSON.stringify({
7300 url: 'https://dl.dropboxusercontent.com/u/24213061/Acustic%20Guitar%20v2/',
7301 ext: '.wav',
7302 name: 'Guitar'
7303 });
7304 closeModal();
7305 reloadSounds(JSON.parse(localStorage.soundpack));
7306});
7307$("#select-sound .hard-piano").click(function() {
7308 localStorage.soundpack = JSON.stringify({
7309 url: 'https://dl.dropboxusercontent.com/u/216104606/LoudAndProudPiano/',
7310 ext: '.mp3',
7311 name: 'Maestro'
7312 });
7313 closeModal();
7314 reloadSounds(JSON.parse(localStorage.soundpack));
7315});
7316$("#select-sound .music-box").click(function() {
7317 localStorage.soundpack = JSON.stringify({
7318 url: 'https://dl.dropboxusercontent.com/u/258840068/CustomSounds/NewPiano/',
7319 ext: '.mp3',
7320 name: 'NewPiano'
7321 });
7322 closeModal();
7323 reloadSounds(JSON.parse(localStorage.soundpack));
7324});
7325$("#select-sound .bells").click(function() {
7326 localStorage.soundpack = JSON.stringify({
7327 url: 'https://dl.dropboxusercontent.com/u/24213061/Digital/',
7328 ext: '.wav',
7329 name: '8-bit'
7330 });
7331 closeModal();
7332 reloadSounds(JSON.parse(localStorage.soundpack));
7333});
7334$("#select-sound .soft-piano").click(function() {
7335 localStorage.soundpack = JSON.stringify({
7336 url: 'https://dl.dropboxusercontent.com/u/216104606/GreatAndSoftPiano/',
7337 ext: '.mp3',
7338 name: 'Soft Piano'
7339 });
7340 closeModal();
7341 reloadSounds(JSON.parse(localStorage.soundpack));
7342});
7343$("#select-sound .default-piano").click(function() {
7344 localStorage.soundpack = JSON.stringify({
7345 url: '/mp3/',
7346 ext: '.wav.mp3',
7347 name: 'MPP Default'
7348 });
7349 closeModal();
7350 reloadSounds(JSON.parse(localStorage.soundpack));
7351});
7352$("#select-sound .harpsicord").click(function() {
7353 localStorage.soundpack = JSON.stringify({
7354 url: 'https://dl.dropboxusercontent.com/u/70730519/Klaver/',
7355 ext: '.wav',
7356 name: 'Klaver'
7357 });
7358 closeModal();
7359 reloadSounds(JSON.parse(localStorage.soundpack));
7360});
7361$("#banner").remove();
7362
7363
7364
7365//Theme
7366$("body").append('<style>* { margin: 0; } * { user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; } /*@font-face { font-family:QT; src: url(fonts/Roboto_Condensed/RobotoCondensed-Regular.tff); }*/ html, body { width: 100%; height: 100%; overflow: hidden; font: 20pt verdana; color: white; text-shadow: #666666 1px 1px; } body { position: absolute; } body { background: rgb(254,255,232); /* Old browsers */ background: -moz-radial-gradient(center, ellipse cover, rgba(66, 66, 64, 1) 0%, rgba(8, 8, 8, 1) 100%) 100%); /* FF3.6+ */ background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,rgba(254,255,232,1)), color-stop(100%,rgba(214,219,191,1))); /* Chrome,Safari4+ */ background: -webkit-radial-gradient(center, ellipse cover, rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* Chrome10+,Safari5.1+ */ background: -o-radial-gradient(center, ellipse cover, rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* Opera 12+ */ background: -ms-radial-gradient(center, ellipse cover, rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* IE10+ */ background: radial-gradient(ellipse at center, rgba(66, 66, 64, 1) 0%,rgba(8, 8, 8, 1) 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr="#feffe8", endColorstr="#d6dbbf",GradientType=1 ); /* IE6-9 fallback on horizontal gradient */ } a { #names { position: fixed; top: 4px; left: 4px; font-size: 12px; width: 80%; } #names .name { float: left; position: relative; padding: 4px; margin: 2px; border-radius: 2px; -webkit-border-radius: 2px; -moz-border-radius: 2px; min-width: 50px; text-align: center; cursor: pointer; background-image: url("http://oi60.tinypic.com/4r8e4x.jpg"); } #names .name.me:after { content: "Me"; position: absolute; top: -4px; right: 50%; font-size: 10px; } #names .name.owner:before { content: url("http://i57.tinypic.com/s6rtsj.jpg"); position: absolute; top: -8px; left: 4px; } #names .name.play { transform: translateY(-4px); -webkit-transform: translateY(-4px); } #names .name.muted-notes { color: #7ae0ff; } #names .name.muted-notes:after { content: "Muted"; position: absolute; top: -4px; right: 50%; font-size: 8.6px; } #names .name.muted-chat { color: #7ae0ff; } #names .name.muted-chat:after { content: "Muted"; position: absolute; top: -4px; right: 50%; font-size: 8.6px; } #piano { width: 95%; height: 20%; margin: auto; position: relative; overflow: hidden; padding-left: 1%; } #piano .key { float: left; width: 1.8%; height: 90%; border: 1px solid black; background: #fff; margin-left: -0.5%; margin-bottom: 100%; box-shadow: 1px 2px 5px #000; -webkit-box-shadow: 1px 2px 5px #000; -moz-box-shadow: 1px 2px 5px #000; border-radius: 2px; -webkit-border-radius: 2px; -moz-border-radius: 2px; transition: background 4s ease-out; -webkit-transition: background 4s ease-out; -moz-transition: background 4s ease-out; -o-transition: background 4s ease-out; padding: 0px; overflow: hidden; } #piano .key.c, #piano .key.f { margin-left: 0; } #piano .key.sharp { width: 1.2%; height: 50%; background: #000; margin-left: -0.9%; position: relative; } #piano .key.loading { background: #888; } #piano .key.play { transform: translateY(1%); -webkit-transform: translateY(1%); -webkit-box-shadow: 0px 1px 2px #000; } .ease-out { transition: left 0.1s ease-out; -webkit-transition: left 0.1s ease-out; -moz-transition: left 0.1s ease-out; -o-transition: left 0.1s ease-out; } .ease-in { transition: left 0.1s ease-in; -webkit-transition: left 0.1s ease-in; -moz-transition: left 0.1s ease-in; -o-transition: left 0.1s ease-in; } .slide-left { left: -100%; } .slide-right { left: 100%; } .cursor { width: 16px; height: 24px; background: url("/cursor.png"); position: absolute; pointer-events: none; margin-left: -2px; margin-top: -2px; left: 200%; top: 100%;} .cursor .name { display: inline; position: relative; left: 16px; top: 8px; pointer-events: none; color: #fff; background: #000; border-radius: 2px; -webkit-border-radius: 2px; -moz-border-radius: 2px; white-space:nowrap; padding: 1px; font-size: 10px; background-image: url("http://oi60.tinypic.com/4r8e4x.jpg"); } .cursor.owner .name:after { content: url("http://i57.tinypic.com/s6rtsj.jpg"); position: relative; top: -8px; left: 0px; } .cursor .name { display: inline-block; } //.cursor .spotlight { display: none; position: relative; left: -14px; top: -9px; width: 32px; height: 32px; // border: 4px solid white; -webkit-border-radius: 100%; } .participant-menu { display: none; position: fixed; background: black; width: 150px; font-size: 12px; padding: 0px; margin: 0px; border-radius: 2px; } .participant-menu:last-child .menu-item:hover { border-bottom-left-radius: inherit; border-bottom-right-radius: inherit; } .participant-menu .info { height: 40px; text-align: center; line-height: 40px; font-size: 9px; color: rgba(255,255,255,0.9); overflow: hidden; opacity: 0; transition: opacity 0.2s ease-out; } .participant-menu .info:hover { opacity: 1; transition: opacity 0.2s ease-out; } .participant-menu .menu-item { cursor: pointer; margin: 0px; padding: 15px 5px; border-top: 1px solid rgba(255,255,255,0.3); } .participant-menu .menu-item:hover { background: rgba(255,255,255,0.4); } .participant-menu .menu-item.clicked { background: rgba(255,255,255,0.5); } #crown { position: absolute; width: 16px; height: 16px; background: url("http://i57.tinypic.com/s6rtsj.jpg") no-repeat; cursor: pointer; font-size: 10px; } #crown span { margin-left: 16px; margin-top: 2px; } #crownsolo-notice { position: fixed; top: 20%; width: 100%; text-align: center; opacity: 0.5; font-size: 20px; pointer-events: none; display: none; } #bottom{ position: fixed; bottom: 0px; left: 0px; width: 100%; height: 60px; background: #181818; margin-bottom: 3px; } #room, #room * { cursor: pointer; } #room { position: absolute; left: 0, top: 0; padding: 5px; width: 240px; height: 12px; background: #151515; border: 1px solid #393F39; cursor: pointer; margin: 9px 24px; font-size: 12px; } #room .info { white-space: nowrap; line-height: 12px; overflow: hidden; height: 20px; } #room .info.lobby { color: #85ceff; } #room .info.not-visible { color: #ce7aff; } //#room .info.crownsolo:after { content: url("/crownsolo.png"); position: relative; top: 2px; margin-left: 4px; } //#room .info.no-chat:after { content: url("/no-chat.png"); position: relative; top: 2px; margin-left: 4px; } #room .expand { width: 24px; height: 100%; position: absolute; right: 0; top: 0; background: #6D6D6D url("/arrow.png") no-repeat center 0%; } #room .more { display: none; position: absolute; bottom: 100%; left: -1px; width: 100%; overflow: hidden; overflow-y: scroll; background: #181818; border: 1px solid #2C2C2C; max-height: 600px; } #room .more > div { margin: 0; padding: 3px 6px 0px 6px; width: 100%; height: 20px; } #room .more .info:hover { background: #414141; } #room .more .new { background: #252525; } #room .more .new:hover { background: #535353; } .ugly-button { height: 12px; font-size: 12px; background: #3D3D3D; border: 1px solid #1A1A1A; padding: 5px; cursor: pointer; line-height: 12px; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; width: 100px; overflow: hidden; white-space:nowrap; } .ugly-button:hover { background: #444; } .ugly-button.stuck { background: #7B7B7B; } #new-room-btn { position: absolute; left: 300px; top: 9px; } #midi-btn { position: absolute; left: 420px; top: 9px; } #play-alone-btn { position: absolute; left: 540px; top: 9px; } #room-settings-btn { position: absolute; left: 660px; top: 9px; display: none; } #status { position: absolute; left: 0px; bottom: 10px; width: 320px; height: 20px; padding: 5px; font-size: 20px; font-weight: 800; line-height: 20px; pointer-events: none; } #status .number { font-size: 35px; } #volume { position: absolute; right: 478px; top: 0px; width: 100px; height: 40px; margin: 10px; } .volume-slider { width: 100%; height: 100%; background: /*url("http://24.158.102.46:8218/volume2.png") no-repeat*/none; background-position: 50% 50%; -webkit-appearance: none; } input[type=range] { -webkit-appearance: none; } input[type=range] { -webkit-appearance: none; border-radius: 8px; height: 7px; border: 1px solid #FFF; background-color:#2F2F2F; } input[type=range]::-webkit-slider-thumb {-webkit-appearance: none; background-color: #ecf0f1; border: 1px solid #bdc3c7; width: 20px; height: 20px; border-radius: 10px; cursor:pointer; } input[type=range]:focus { outline: none; } #volume-label { position: absolute; right: 495px; bottom: 7px; font-size: 10px; color: #ccc; } #banner { width: 468px; height: 60px; position: absolute; right: 0; top: 0; } #quota { width: 100%; height: 3px; position: fixed; bottom: 0; left: 0; background: #2D2D2D;background-image: url("http://oi60.tinypic.com/4r8e4x.jpg"); } #quota .value { width: 100%; height: 100%; display: block; background: #00C6FF; background-image: url("http://oi60.tinypic.com/4r8e4x.jpg");} .relative { position: relative; width: 100%; height: 100%; } .notification { position: absolute; } .notification-body { background: #131313; border-color: #131313; width: 400px; padding: 10px; position: relative; left: 0; top: 0; color: #bf7aff; font-size: 12px; text-shadow: #353535 1px 1px; border-radius: 6px; -webkit-border-radius: 6px; -moz-border-radius: 6px; } .notification-body:after { content: ""; position: absolute; top: 100%; left: 50%; margin-left: -3px; border-top: 10px solid transparent; border-top-color: inherit; border-left: 6px solid transparent; border-right: 6px solid transparent; } .title { border-bottom: 1px solid #7acaff; font-size: 16px; font-weight: bold; padding-bottom: 5px; margin-bottom: 8px; } .notification .x { position: absolute; right: 4px; top: 0; cursor: pointer; font-size: 16px; color: #44C2FF; text-shadow: none; } #modal { width: 100%; height: 100%; position: fixed; left: 0; top: 0; display: none; } #modal .bg { width: 100%; height: 100%; background: rgba(118, 131, 141, 0.94); opacity: 0.5; position: absolute; left: 0; top: 0; } #modal, #modal * { user-select: text; -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; } .dialog { background: #181818; width: 400px; height: 100px; position: fixed; left: 50%; top: 50%; margin-left: -200px; margin-top: -50px; padding: 10px; border: 1px solid #363636; overflow: hidden; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; box-shadow: 0px 0px 8px #000; -webkit-box-shadow: 0px 0px 8px #000; -moz-box-shadow: 0px 0px 8px #000; } .dialog p { margin: 10px; font-size: 20px; } .dialog input.text { font-size: 20px; height: 20px; width: 75%; } .dialog input.checkbox { margin: 0 5px; } .dialog .submit { background: #75BCF5; border: none; padding: 7px 40px 20px 30px; font-size: 20px; color: #fff; text-shadow: #444 2px 2px 2px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; box-shadow: inset 0px 0px 4px #000; -webkit-box-shadow: inset 0px 0px 4px #000; -moz-box-shadow: inset 0px 0px 4px #000; transition: all 0.25s; -webkit-transition: all 0.25s; -moz-transition: all 0.25s; -o-transition: all 0.25s; position: absolute; bottom: -10px; right: -10px; } .dialog .submit:hover { background: #88CAFF; transition: all 0.25s; -webkit-transition: all 0.25s; -moz-transition: all 0.25s; -o-transition: all 0.25s; } .dialog .close { background: #fe4; border: none; padding: 7px 40px 20px 30px; font-size: 20px; color: #fff; text-shadow: #444 2px 2px 2px; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; box-shadow: inset 0px 0px 4px #000; -webkit-box-shadow: inset 0px 0px 4px #000; -moz-box-shadow: inset 0px 0px 4px #000; transition: all 0.25s; -webkit-transition: all 0.25s; -moz-transition: all 0.25s; -o-transition: all 0.25s; position: absolute; bottom: -10px; right: -10px; } .dialog .close:hover { background: #ff8; transition: all 0.25s; -webkit-transition: all 0.25s; -moz-transition: all 0.25s; -o-transition: all 0.25s; } #room-settings { height: 400px; margin-top: -200px; } #instruments { height: 180px; margin-top: -100px; } #options { height: 200px; margin-top: -100px; } #chat { display: none; } #chat { position: fixed; bottom: 64px; left: 0; width: 100%; vertical-align: bottom; font-size: 13px; color: rgb(183, 246, 255); text-shadow: #606060 1px 1px; } #chat, #chat * { user-select: text; -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; } #chat ul { list-style: circle; margin: 4px; padding: 0; } #chat li { padding: 2px; opacity: 0; } #chat li .name { font-weight: bold; margin-right: 10px; } #chat li .message { margin-right: 6px; } #chat li .quote { color: #789922; } #chat input { margin: 4px; width: 99%; border: 1px solid #fff; background: none; text-shadow: #888 1px 1px; color: #fff; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; } #chat input::-webkit-input-placeholder { color: #ccc; } #chat input:-moz-placeholder { color: #ccc; } #chat input:focus { outline: none; border: 1px solid #7acaff; } #chat.chatting { background: rgba(21, 39, 40, 0.5); border-radius: 5px; box-shadow: 1px 1px 5px #404040; transition: all 0.1s; } #chat.chatting li { display: list-item !important; opacity: 1 !important; text-shadow: #aaa 1px 1px; } #chat.chatting ul { max-height: 50em; overflow-y: scroll; overflow-x: hidden; word-wrap: break-word; } #midi-connections .half h2 { margin: 5px; } #midi-connections .half { width: 50%; float: left; text-align: center; } #midi-connections .half select { width: 80%; height: 20px; margin: 2px; } #midi-connections .half button.remove { width: 10%; height: 20px; margin: 2px; padding: 0; } #midi-connections .half button.add { width: 50%; height: 20px; margin: 2px; } #social { display: none; position: fixed; top: 4px; right: 6px; width: 80px; font-size: 12px; } #social #more-button { margin-top: 4px; width: 77px; height: 37px; border-radius: 5px; border: 1px solid #000000; cursor: pointer; transition: all 0.25s; box-shadow: 1px 1px 8px #000000; color: #000000; text-shadow: none; background: url("/kitten") 0px 1px no-repeat; background-color: rgba(2, 2, 2, 0.64); } #social #more-button:hover { color: #000000; background-color: #323232; transition: background-color 0.25s; } #more { display: none; width: 1250px; margin: 0 auto; padding: 0px; border-radius: 10px; font: 15px sans-serif; border: 1px solid #b0c0c0; color: #566; background: #bcc; box-shadow: 1px 1px 8px #899; position: fixed; top: 50px; right: 50px; text-shadow: none; } #more div { margin: 0px; padding: 0px; } #more .items { margin-left: 1%; } #more .items .item { width: 33%; float: left; background: #cdd; transition: background 0.25s; } #more .items .item:hover { background: #d0e0e0; transition: background 0.25s; } #more .items .item .content { height: 200px; padding: 10px; border-right: 1px solid #bcc; border-bottom: 1px solid #bcc; } #more .items .item .content p { margin-top: 1em; margin-bottom: 1em; } #more .header { padding: 5px 10px; } #more .footer { clear: both; padding: 5px 10px; font-size: 12px; } #email:before { content: url("/envelope.png"); margin: 4px; } #crownsolo-notice { z-index: 0; } #cursors { z-index: 1; } #chat { z-index: 100; } #social { z-index: 200; } #names { z-index: 300; } #piano { z-index: 400; } #piano .key { z-index: 401; } #piano .key.sharp { z-index: 402; } #bottom { z-index: 500; } #crown { z-index: 600; } .notification { z-index: 700; } #cursors .cursor { z-index: 800; } #chat.chatting { z-index: 900; } .participant-menu { z-index: 1000; } #modal { z-index: 10000; } .clear { clear: both; } .spin { animation: spin 1s linear infinite; -webkit-animation: spin 1s linear infinite; -moz-animation: spin 1s linear infinite; -o-animation: spin 1s linear infinite; -ms-animation: spin 1s linear infinite; } @-webkit-keyframes spin { 0% { -webkit-transform: rotate(0deg);} 100% { -webkit-transform: rotate(360deg);} } @-moz-keyframes spin { 0% { -moz-transform: rotate(0deg);} 100% { -moz-transform: rotate(360deg);} } @-o-keyframes spin { 0% { -o-transform: rotate(0deg);} 100% { -o-transform: rotate(360deg);} } @-ms-keyframes spin { 0% { -ms-transform: rotate(0deg);} 100% { -ms-transform: rotate(360deg);} } input[type=color] { display: none; }</style>');
7367
7368//END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT// //END OF SCRIPT/