Netflix Queue Randomizer
Written on November 16, 2006
12/28/06 Update: Joseph Miller updated the script with a feature that keeps series in order. Check out his script here. Thanks Joseph!
I didn’t want to install Grease Monkey, and none of the other scripts worked too well so I wrote my own.
The Code:
javascript:(function(){var e=document.getElementsByTagName('input');var q=new Array();var t=0;for(var i=0;i<e.length;i++){if(e[i].className=='o'){ q.push(e[i]);}}for(var i=0;i<q.length;i++){var s=q[i].value;var b=Math.floor(Math.random()*q.length); q[i].value=q[b].value;q[b].value=s;}})()
Instructions:
Load up your Netflix queue page, copy and paste the above code into your location bar, and hit enter. You should see the numbers in your queue change into a random order. You can run the code several times to make sure it’s nice and shuffled up. When you’re done, just click on the Update button to save the new order.
Bookmarklet:
Netflix Queue Randomizer
Gentle Netflix Queue Randomizer (keeps series discs in order) – By Joseph Miller
Just drag the link into your bookmarks or right click and select “Add to Favorites…” or “Bookmark This link…”
Explanation:
javascript:(function() {
var e=document.getElementsByTagName('input');
var q=new Array();
var t=0;
for(var i=0;i<e.length;i++){
if(e[i].className=='o'){
q.push(e[i]);
}
}
for(var i=0;i<q.length;i++){
var s=q[i].value;
var b=Math.floor(Math.random()*q.length);
q[i].value=q[b].value;
q[b].value=s;
}
})()
All of the sort order input boxes on the Netflix Queue page have a class of “o”. The first for loop at line 5 goes through all of the input elements in the HTML, checks for className=”o” and stores all of those elements in an array. This is pretty the same as doing var q = document.getElementsByClass(”o”).
The second for loop at line 10 loops through array q and randomly swaps the text box values.
Filed in: javascript, netflix, web development.
Very cool. Any way to make it not put tv series discs out of order?
Sorry, but I don’t think there’s an easy way to do that.
It’d be great if Netflix would just add this kind of functionality into the page.
I’ve written a queue randomizer that keeps series in order. Go here for a queue randomizer that keeps series in order.
jimsotonna…
jimsotonna dropped by…