Created
February 25, 2011 07:38
-
-
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 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
/* | |
* | |
* ___ ___ ___ ___ ___ ___ | |
* /\__\ /\ \ /\ \ /\ \ /\__\ ___ |\__\ | |
* /::| | /::\ \ \:\ \ /::\ \ /:/ / /\ \ |:| | | |
* /:|:| | /:/\:\ \ \:\ \ /:/\:\ \ /:/ / \:\ \ |:| | | |
* /:/|:| |__ /::\~\:\ \ /::\ \ /::\~\:\ \ /:/ / /::\__\ |:|__|__ | |
* /:/ |:| /\__\ /:/\:\ \:\__\ /:/\:\__\ /:/\:\ \:\__\ /:/__/ __/:/\/__/ ____/::::\__\ | |
* \/__|:|/:/ / \:\~\:\ \/__/ /:/ \/__/ \/__\:\ \/__/ \:\ \ /\/:/ / \::::/~~/~ | |
* |:/:/ / \:\ \:\__\ /:/ / \:\__\ \:\ \ \::/__/ ~~|:|~~| | |
* |::/ / \:\ \/__/ \/__/ \/__/ \:\ \ \:\__\ |:| | | |
* /:/ / \:\__\ \:\__\ \/__/ |:| | | |
* \/__/ \/__/ \/__/ \|__| | |
* | |
* 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