Netflix Queue Shuffler: Randomize or reverse your queue with bookmarklets
update – April 22, 2009
This script hadn’t worked properly for a while. Its been tweaked so give it a try. It should work if you have drag-n-drop enabled or not, and works in both the normal and the instant queues.
background
A Netflix queue tends to show some clustering of movie types, due to the way people add one movie then add a similar suggested movie. If you want to restore some variety it can be tedious to move things around. Here’s a little tool to randomly re-order your Netflix queue.
approach
This is another task well suited for a bookmarklet. The page layout is straightforward, and only needs to manipulate the values of input fields. The code can be implemented in a few hundred bytes, so only one version is required to support IE and Firefox, without resorting to script injection.
implementation
The queue items are in a form. There are 3x+2 input fields in the form; the first and last are the submit buttons. The other fields are triplet groups with the position field, original position (hidden), and the remove checkbox. Here is the code:
javascript: (function(){ var items=document.forms[1].getElementsByTagName('input'); var os=[]; for(i=0;i<items.length;i++){ if(items[i].className=='o'){ os.push(items[i]); } } var total=os.length; for(var i=0;i<total;i++){ os[i].value=Math.floor(Math.random()*total); } alert(total+'%20shuffled.%20%20Update%20Your%20Queue%20to%20save.'); } )()
Here is the bookmarklet link:
Netflix Shuffler
Add this to your bookmarks/favorites by right-clicking or dragging it to the toolbar. To use it just navigate to your Netflix queue page and select the bookmarklet. The queue will be shuffled, then just click Update Your Queue to commit the changes.
bonus
Here is a slightly modified version that simply reverses the queue order. This might be useful if all the new releases are at the end and you want to see those first.
javascript: (function(){ var items=document.forms[1].getElementsByTagName('input'); var os=[]; for(i=0;i<items.length;i++){ if(items[i].className=='o'){ os.push(items[i]); } } var total=os.length; for(var i=0;i<total;i++){ os[i].value=total-i; } alert(total+' reversed. Update Your Queue to save.'); } )()
Here is the bookmarklet link:
Netflix Reverser