-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathStack Exchange Chat, Wheel of Blame and other Easter eggs.user.js
69 lines (66 loc) · 2.66 KB
/
Stack Exchange Chat, Wheel of Blame and other Easter eggs.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// ==UserScript==
// @name Stack Exchange Chat, Wheel of Blame and other Easter eggs
// @description Annoy yourself with song and "dance"!
// @description Reference https://meta.stackexchange.com/q/75861/148310 and the @homepage, below.
// @match *://chat.stackoverflow.com/rooms/*
// @match *://chat.stackexchange.com/rooms/*
// @match *://chat.meta.stackexchange.com/rooms/*
// @run-at document-body
// @noframes
// @grant none
// @version 1.2
// @history 1.2 Fix bug when last message was posted by a Stack Exchange bot.
// @history 1.1 Iframe or double-run problem in MS Edge!?
// @history 1.0 Initial release
// @author Brock Adams
// @homepage https://stackapps.com/a/7828/7653
// ==/UserScript==
window.addEventListener ("load", function () {
if ( ! Eggs.WOB) {
console.log ("Loading eggs.js...");
$.getScript ('//cdn-chat.sstatic.net/chat/Js/eggs.js');
}
if ( $("#yourPoison").length) {
console.error (`${top == self} Double run occured somehow?! Please report this message and your browser/OS/Tampermonkey details to the developer.`);
return;
}
$( `
<select id="yourPoison" style="margin-left: 3em;">
<option value="WoB">WoB</option>
<option value="Asteroids">Asteroids</option>
<option value="Assistant">Assistant</option>
<option value="Console">Console</option>
<option value="Cthulu">Cthulu</option>
</select>
<button id="gmEEoDBtn" class="button">EEgg</button>
` ).insertAfter ("#codify-button");
$("#gmEEoDBtn").click (launchEEgg);
} );
function launchEEgg (zEvent) {
var eeType = $("#yourPoison").val ();
switch (eeType) {
case "WoB":
/*-- Important: Autoplay blocker can kill the sound but
try/catch does not catch it here. The User must check the console for messages like:
"play method is not allowed by the user agent"
*/
var msg = $('.message').last ().addClass ('neworedit');
Eggs.WOB.blame (msg.parent().parent().attr('class').match(/user-(-?\d+)/)[1], msg);
break;
case "Asteroids":
Eggs.Asteroids ('insert coin');
break;
case "Assistant":
Eggs.Assistant ('I would like to start the assistant');
break;
case "Console":
Eggs.Console ('rm -r');
break;
case "Cthulu":
Eggs.Cthulu('<[^>]');
break;
default:
console.error ("Unexpected Easter Egg type: ", eeType);
break;
}
}