Skip to content

Instantly share code, notes, and snippets.

@wookiehangover
Created February 25, 2011 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wookiehangover/843486 to your computer and use it in GitHub Desktop.
Save wookiehangover/843486 to your computer and use it in GitHub Desktop.
dotjs script that adds a sort button to your netflix instant queue
/*
*
* ___ ___ ___ ___ ___ ___
* /\__\ /\ \ /\ \ /\ \ /\__\ ___ |\__\
* /::| | /::\ \ \:\ \ /::\ \ /:/ / /\ \ |:| |
* /:|:| | /:/\:\ \ \:\ \ /:/\:\ \ /:/ / \:\ \ |:| |
* /:/|:| |__ /::\~\:\ \ /::\ \ /::\~\:\ \ /:/ / /::\__\ |:|__|__
* /:/ |:| /\__\ /:/\:\ \:\__\ /:/\:\__\ /:/\:\ \:\__\ /:/__/ __/:/\/__/ ____/::::\__\
* \/__|:|/:/ / \:\~\:\ \/__/ /:/ \/__/ \/__\:\ \/__/ \:\ \ /\/:/ / \::::/~~/~
* |:/:/ / \:\ \:\__\ /:/ / \:\__\ \:\ \ \::/__/ ~~|:|~~|
* |::/ / \:\ \/__/ \/__/ \/__/ \:\ \ \:\__\ |:| |
* /:/ / \:\__\ \:\__\ \/__/ |:| |
* \/__/ \/__/ \/__/ \|__|
*
* This adds a "sort queue" button to your netflix queue. Works with instant and regular queues.
*
*/
(function($){
$('#queue h2 input')
.before( $('<a>', { href: "#", text: "sort queue", id: "sortorific" }) );
$('#sortorific').live('click', function(e){
e.preventDefault();
var $t = $('table.qtbl #qbody'),
q = [],
z = [],
o = [];
$t.find('.tt').each(function(i, el){
q.push( $(el).text() );
z.push( $(el).text() );
});
z.sort();
$.each(q, function(i, el){
o.push( $.inArray(el, z) );
});
$t.find('input.o').each(function(i, el){
$(el).val( o[i] + 1 );
});
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment