Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Greasemonkey script to automatically replay finshed songs in youtube
// ==UserScript==
// @name YoutubeReplayScript
// @include http://**
// @include https://**
// @require
// @require
// @description Replays songs automatically once it is finished playing.
// @namespace
// @version 1
// @grant none
// ==/UserScript==
function actionFunction(node){
console.log ("Found replay button. Clicking it!");
var clickEvent = document.createEvent ('MouseEvents');
clickEvent.initEvent ('click', true, true);
node[0].dispatchEvent (clickEvent);
return true;
console.log ("Waiting for replay button");
waitForKeyElements("[title|='Replay']", actionFunction);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.