Play Bad Apple on google.com
// ==UserScript==
// @name Bad Google
// @version 1.2
// @description Play Bad Apple on google.com
// @author PongonPolygon
// @match https://www.google.com/*
// @match https://google.com/*
// @icon data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIGZpbGw9IiMwMDAwMDAiIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xOC43MSAxOS41QzE3Ljg4IDIwLjc0IDE3IDIxLjk1IDE1LjY2IDIxLjk3QzE0LjMyIDIyIDEzLjg5IDIxLjE4IDEyLjM3IDIxLjE4QzEwLjg0IDIxLjE4IDEwLjM3IDIxLjk1IDkuMDk5OTcgMjJDNy43ODk5NyAyMi4wNSA2Ljc5OTk3IDIwLjY4IDUuOTU5OTcgMTkuNDdDNC4yNDk5NyAxNyAyLjkzOTk3IDEyLjQ1IDQuNjk5OTcgOS4zOUM1LjU2OTk3IDcuODcgNy4xMjk5NyA2LjkxIDguODE5OTcgNi44OEMxMC4xIDYuODYgMTEuMzIgNy43NSAxMi4xMSA3Ljc1QzEyLjg5IDcuNzUgMTQuMzcgNi42OCAxNS45MiA2Ljg0QzE2LjU3IDYuODcgMTguMzkgNy4xIDE5LjU2IDguODJDMTkuNDcgOC44OCAxNy4zOSAxMC4xIDE3LjQxIDEyLjYzQzE3LjQ0IDE1LjY1IDIwLjA2IDE2LjY2IDIwLjA5IDE2LjY3QzIwLjA2IDE2Ljc0IDE5LjY3IDE4LjExIDE4LjcxIDE5LjVaTTEzIDMuNUMxMy43MyAyLjY3IDE0Ljk0IDIuMDQgMTUuOTQgMkMxNi4wNyAzLjE3IDE1LjYgNC4zNSAxNC45IDUuMTlDMTQuMjEgNi4wNCAxMy4wNyA2LjcgMTEuOTUgNi42MUMxMS44IDUuNDYgMTIuMzYgNC4yNiAxMyAzLjVaIi8+PC9zdmc+
// @run-at document-idle
// @license MIT
// @namespace https://greasyfork.org/users/1594584
// ==/UserScript==
(function() {
'use strict';
console.log("Thanks for using Bad Google!");
let running = false;
let transition = false;
const element = document.querySelector('[jsname="RNNXgb"]'); // have no idea why these are the classes lol
const items = document.querySelector('[class="SDkEP"]');
const videoURL = "https://huggingface.co/spaces/Nick088/Bad-Apple-Video/resolve/b638ac1f80add1d288e583443f495c46224b75b3/bad-apple.mp4"; // thanks whoever made this lol
const elBG = element.style.backgroundColor;
const search = !!(element && items);
let hKeys = [];
document.addEventListener("keydown", (e) => { // stupid keybind stuff
hKeys.push(e.keyCode);
if (search) {
if (hKeys.includes(17) && hKeys.includes(66)) {
run();
}
}
});
document.addEventListener("keyup", (e) => {
hKeys = hKeys.filter(num => num !== e.keyCode);
});
const video = document.createElement("video");
if (search) { // video creation
video.style = "width: 100%; height: 100%; position: absolute; display: none;";
video.src = videoURL;
video.load();
video.autoplay = false;
video.controls = false;
element.appendChild(video);
element.style = "transition: all 1s ease-out; height: 3rem; width: 100%; overflow: hidden;";
items.style = "transition: all 1s ease-out; background-color: transparent; transform: translateY(0);";
}
function run() { // and running
if (!transition) {
if (!running) {
transition = true;
running = true;
element.style.height = "20rem";
element.style.width = "26.6666666667rem";
element.style.backgroundColor = "black";
items.style.transform = "translateY(-100%)";
setTimeout(() => {
video.style.display = "block";
video.play();
transition = false;
}, 1000);
} else {
video.pause();
video.currentTime = 0;
element.style.height = "3rem";
element.style.width = "100%";
items.style.transform = "translateY(0)";
element.style.backgroundColor = elBG;
video.style.display = "none";
setTimeout(() => {
running = false;
transition = false;
}, 1000);
}
}
}
video.addEventListener("ended", () => { // stop when ended
transition = true;
element.style.height = "3rem";
element.style.width = "100%";
items.style.transform = "translateY(0)";
element.style.backgroundColor = elBG;
video.style.display = "none";
setTimeout(() => {
running = false;
transition = false;
}, 1000);
});
})();