-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRickRoll.js
More file actions
57 lines (57 loc) · 1.91 KB
/
Copy pathRickRoll.js
File metadata and controls
57 lines (57 loc) · 1.91 KB
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
var rickroll = function (opt) {
if (!opt) {
window.onclick = rickroll.showup;
window.ontouchmove = rickroll.showup;
};
if (opt) {
if (typeof(opt) !== 'object') {
throw new TypeError("The 'option' argument must be type of object, Received instead of "+typeof(opt));
return false;
};
if (opt.click) {
window.onclick = rickroll.showup;
window.onclick = rickroll.showup;
};
if (opt.scroll) window.onscroll = rickroll.showup;
if (opt.mousemove) window.onmousemove = rickroll.showup;
if (opt.mouseenter) window.onmouseenter = rickroll.showup;
if (opt.mouseleave) window.onmouseleave = rickroll.showup;
if (opt.mousewheel) window.onmousewheel = rickroll.showup;
if (opt.drag) window.ondrag = rickroll.showup;
if (opt.select) {
window.onselect = rickroll.showup;
window.onselectstart = rickroll.showup;
window.onselectionchange = rickroll.showup;
};
if (opt.input) {
window.oninput = rickroll.showup;
window.onkeydown = rickroll.showup;
window.onkeypress = rickroll.showup;
window.onkeyup = rickroll.showup;
};
if (opt.resize) window.onresize = rickroll.showup;
};
console.log("[RickRoll.js] Now listening to some click event....");
};
rickroll.video = "https://rituraj-rai.github.io/rickroll/Rick%20Rolled%20(Short%20Version).mp4";
// rickroll.video = "https://github.com/Rituraj-Rai/Rituraj-Rai/blob/main/Rick_Astley_Never_Gonna_Give_You_Up.mp4";
rickroll.showup = function () {
console.log("[RickRoll.js] rickroll.showup() called.");
var video = document.createElement("video");
video.load();
video.src = rickroll.video;
video.style.display = "block";
video.style.width = "100%";
video.style.height = "auto";
video.style.position = "fixed";
video.style.top = "0";
video.style.bottom = "0";
video.style.left = "0";
video.style.right = "0";
video.loop = true;
video.play().then(() => {
document.open();
document.appendChild(video);
document.close();
}).catch(console.error);
};