Netflix Queue Manager for Greasemonkey
background
Greasemonkey is a Firefox extension that runs javascript code on the current browser page. It is used to change the behavior of a web page usually by adding functionality, or altering the appearance. It is quite analogous to the bookmarklet model. The difference is that a Greasemonky script can be invoked automatically whenever a certain page is visited, while a bookmarklet must be invoked by the user.
With Greasemonky any site-specific bookmarklet can be adapted to run automatically when that site is visited. Here we provide an adapted version of the Netflix Queue Manager.
It is not necessary to have Greasemonkey to run the Netflix Queue Manager. Using the Greasemonkey version won’t save you any time–either way it is one click away. The only advantage is being able to remove a bookmark from your toolbar or favorites list.
installation
If you have Greasemonky installed just use this link:
Netflix Queue Manager for Greasemonkey
Right-click and select “Install User Script” or click the link to view the file then select “Tools->Install User Script”.
implementation
This is relatively simple. Minimally the bookmarklet link just needs to be encapsulated into a file so that Greasemonky can install it. This works, but the Manager will be invoked automatically on the Queue page. This is undesirable because it will always appear after the page is updated.
To defer the Manager launch, the new script adds an highly visible link near the top of the page. The link appears whenever you visit your Netflix queue. Just click the link to start the Manager.

The original script in netflix-manager.js is unchanged. The original bookmarklet code is just wrapped in a function that is called when the new link is clicked.
(function(){
window.launch_manager = function() {
var script=document.createElement('script');
script.src='http://badsegue.org/samples/toolman.js';
document.getElementsByTagName('body')[0].appendChild(script);
var script=document.createElement('script');
script.src='http://badsegue.org/samples/netflix-manager.js';
document.getElementsByTagName('body')[0].appendChild(script);
}
var h = document.getElementById("header");
var d = document.createElement("div");
d.style.border = "2px dashed cyan";
d.style.backgroundColor = "orange";
d.innerHTML = "<a href='javascript:launch_manager()'>Launch Netflix Queue Manager</a>";
h.appendChild(d);
}
)()
I updated the metadata to exclude netflix.com/QueueAdd*.
“http://www.netflix.com/QueueAddConfirmation” is the URL after you add something to your queue, and was causing the @include to display the Manager link on this non-queue page. You can re-install the script to get the update, or add the @exclude directive yourself using Tools/Manage User Scripts.
Comment by badsegue — June 6, 2005 @ 2:16 amHey, I LOVE this script, but I have one request:
Is there any way to prevent series disks from being broken up? I have several sets, like the Sopranos Season 1, in my queue. The shuffle command breaks up the set and I have to track them down and reorder them manually to keep them together.
Comment by BrianS — June 14, 2005 @ 4:43 amBrian - series discs are a little tricky to deal with, as far as shuffling and sorting go. The simplest fix may be to provide a “re-group” function that will move any series discs adjacent to the first in the series. It will be easier if series discs have consecutive ID numbers. The ones in my queue have consecutive IDs, but I don’t know if that’s always true. It’s also not true if you have gaps in the series, like discs 1, 3, 5. Then it would be necessary to look at the title and try to correlate the discs, and those are not consistent either. Sometimes it’s “vol. x” and other times it’s “disc x”, and there may be other variants to confuse things further. I’ll have to think about it for a bit.
Comment by badsegue — June 14, 2005 @ 9:59 amSounds like a pretty cool script but I am hesitant to try it since the script links to other script on an external site. (see article)
I realize you probably do this to make code changes easier and more efficient, but such a practice would also be a handy tool for the malicious coder who wants to present innocent looking scripts so people will install them, only to change it later to do something else (as is suggested in above article)
Comment by Keeve — June 16, 2005 @ 12:14 amKeeve - I can understand your concerns. The script relies on external hosting because it’s easier to update, but also to allow support for IE. This is the only way to have a bookmarklet of this size in IE, as IE has limits on the length.
I think it’s important to keeps some perspective on the actual risks involved in running these types of scripts. At worst, you risk exposing data in the browser, in open pages or in cookies. If you don’t trust the script, and don’t trust the browser’s compartmentalization, then the simplest thing to do is not run the script.
You can take some extra precautions, and run the script in a “sandbox” mode. Restart the browser, and delete all sensitive cookies. Then visit the page where you want to run the script. You control when the script is invoked, either by running the bookmarklet, or by the Greasemonkey @include. When the script runs there is no data it can access except for what is in the current page. Is there anything in that page you wouldn’t want potentially exposed? Then don’t run the script. If the data is not sensitive then you are OK. Shut down the browser when you are done, and the risk is over.
For scripts like this, that look at a list of movies, or news articles, there is not much to worry about. On the other hand I would not use anything like this when doing online banking or stock trades.
Ultimately I think the browser security models will have to evolve to deal with these types of extensions, so developers can add enhancements, and users can feel secure about what is happening in the background.
Comment by badsegue — June 16, 2005 @ 2:17 amThis script kicks some serious booty! Thank a ton.
Comment by dfn_doe — June 29, 2005 @ 10:21 pm