Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Greasemonkey script to automatically replay finshed songs in youtube
// ==UserScript==
// @name YoutubeReplayScript
// @include http://*.youtube.com/*
// @include https://*.youtube.com/*
// @require http://code.jquery.com/jquery-1.7.1.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @description Replays songs automatically once it is finished playing.
// @namespace http://opensourceforgeeks.blogspot.in/
// @version 1
// @grant none
// ==/UserScript==
(function(){
function actionFunction(node){
console.log ("Found replay button. Clicking it!");
//node.click();
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.