Created
May 10, 2015 19:50
-
-
Save GMMan/d81f576b65b6618c2a29 to your computer and use it in GitHub Desktop.
Play album tracks on Groupees purchases page back-to-back
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 Groupees Entire Album Playback | |
// @namespace http://cyanic.vnd/groupees/albumPlay | |
// @version 1.0.0 | |
// @description Allows an entire album to be played instead of a single track at a time. | |
// @author cyanic | |
// @match https://groupees.com/purchases | |
// @grant none | |
// ==/UserScript== | |
this.$ = window.$; | |
/* | |
* Function hook jQuery plugin | |
* version 1.0 | |
* author: Damien Antipa | |
* http://github.com/dantipa/ | |
*/ | |
(function(window, $, undefined){ | |
/** | |
* Hooks into a given method | |
* | |
* @param method | |
* @param fn | |
*/ | |
$.fn.hook = function (method, fn) { | |
var def = $.fn[method]; | |
if (def) { | |
$.fn[method] = function() { | |
var r = def.apply(this, arguments); //original method | |
fn(this, method, arguments); //injected method | |
return r; | |
} | |
} | |
} | |
})(window, window.jQuery); | |
$.fn.hook('html', function(el) { | |
el.find('.track-list').each(function(i, e) { | |
var audios = $(this).find('audio'); | |
audios.each(function(i, e) { | |
$(e).bind('ended', function(){audios.eq(i + 1).next().click();}); | |
return i < audios.length - 1; | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment