Last active
November 11, 2017 09:46
-
-
Save aniket91/7d1da89190beb1446a3c7bcf53b181b7 to your computer and use it in GitHub Desktop.
Greasemonkey script to automatically replay finshed songs in youtube
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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