blob: 4fb6880629458419aa324536da1d07a6ac47ea52 (
plain) (
blame)
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
|
import { default as mousetrap } from "mousetrap";
declare global {
interface Window {
rick: HTMLIFrameElement | null;
}
}
export const onInitialClientRender = (
_: any,
{
sequence = "up up down down left right left right b a",
}: { sequence?: string } = {}
) => {
mousetrap.bind(sequence, () => {
let iframe = document.createElement("iframe");
iframe.src = "https://www.youtube.com/embed/o-YBDTqX_ZU?autoplay=1&controls=0";
iframe.style.position = "fixed";
iframe.style.top = "0";
iframe.style.left = "0";
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.border = "none";
iframe.style.zIndex = "999999";
document.body.appendChild(iframe);
window.rick = iframe;
});
mousetrap.bind("esc", () => {
if (window.rick) {
window.rick.remove();
window.rick = null;
}
});
};
|