Skip to content

Instantly share code, notes, and snippets.

@GMMan
Created May 10, 2015 19:50
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GMMan/d81f576b65b6618c2a29 to your computer and use it in GitHub Desktop.
Save GMMan/d81f576b65b6618c2a29 to your computer and use it in GitHub Desktop.
Play album tracks on Groupees purchases page back-to-back
// ==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