April 17, 2008

Google - Single Page Results

Endless architectural spiral

This script lets you scroll down the search results without having to turn pages, in using infinite scrolling.

Instructions:

  1. Install the "Google - Single Page Results" script
    (requires Greasemonkey for Firefox)
  2. Search for something on Google
  3. Scroll down the page
  4. Continue scrolling down the page
  5. Repeat step 4 as much as you need ;-)


This is a variation on the "Flickr - Single Page Results" I wrote yesterday.

April 16, 2008

Flickr - Single Page Results

  1. Install the "Flickr - Single Page Results" script (requires Greasemonkey for Firefox)
  2. Search for something on Flickr
  3. Scroll down the page
  4. Continue scrolling down the page
  5. Repeat step 4 as much as you need ;-)
Beware, this is rather hypnotic and makes Flickr really addictive.

Watch out! Addictive stuff!

Recently, I have been fishing for images from Flickr to include in my blog posts. And it is clear that turning pages gets in the way.

Luckily, there is an "endless scrolling" AJAX technique. Live.com tried it for its image results, instead of chunking them. It was discussed on the Humanized blog and implemented in the Humanized Blog Reader.

This script here implements the same feature for the Flickr search results.

Note that this works best if you scroll down the page using the keyboard, rather than the scrollbar.
Also, I did not implement any kind of landmark or bookmarkability support (using the url hash).

The script is based off my previous "Single Page View" scripts (IGN, ArsTechnica, ACMQueue), but is a bit simpler and should be easier to adapt to other sites.

September 15, 2007

One-click video streaming from home server

Kitty with remote

I have some video files on a home server, which I want to watch on my laptop in the living room with the least possible hassle. The files are accessible thru HTTP. They can be played using MPlayer (thru MPUI on Windows) and VLC, which can stream videos over HTTP.

But the step from finding the video using my browser to opening the video in one of these media players involves an annoying copy and paste operation.

I wrote the One-Click Video Streaming Greasemonkey script to solve this. I can now start playing videos with a single click on the directory listing page in my browser.
The script adds a "one-click play" icon next to each video in the directory listings. Clicking that icon launches a media player, automatically opening the corresponding video stream.

Note that when you install the script, you need to specific the url patterns that should trigger this script. In my case, that's the root url for my media server.

Continue reading "One-click video streaming from home server"

August 14, 2007

"Inline IMDB ratings" script

The "Inline IMDB ratings" script finds any links to IMDB, then pulls the rating information for the corresponding movie and displays it next to the link, such as [8.4/10 rating] in this screenshot:

As usual, you need to use Firefox with the Greasemonkey extension to make use of this script.

API where art thou?

The script functions by scraping the HTML served by IMDB, since that site does not offer an API yet. An API would not only make this kind of mashup more maintainable, it would be a more efficient use of resources.

The question is does it make sense for IMDB to signup for a bunch of additional load by opening up APIs for a basic data service?

Silos and unique identifiers:

More generally, this script points out one major limitation with the data on the web today: the lack of unique identifiers. Unlike books, which can be tracked across silos by ISBN number, or real estate sites which use MLS numbers (Multiple Listing Service Number), each site uses their own identifier to identify movies.
With a unique identifier for movies and TV shows, you could build some integrations between review sites, recommendation services, showtime listings and rental services, across multiple devices (PC, media players, PVRs, cellphone).

IMDB links seem like a good candidate for this purpose, but sites like Yahoo Movies or Rotten Tomatoes probably see this as a competitive threat. I suppose that a more distributed design would have the movie companies assign unique urls to identify each movie they release, following the OpenID model.

Unfortunately, I do not see either happening in the near future. Different movie sites will remain mostly isolated in the meanwhile...

February 27, 2006

"MSDN - Fix titles" Greasemonkey script

Here's another small script, "MSDN - Fix Titles" which fixes the title on a number of MSDN pages.

Instead of something generic, the script tries to find a more specific title from the content frames.
In this example, "Welcome to the MSDN Library" gets replaced with a more relevant and usable title: "MSDN: Side-By-Side and Versioning Considerations for .NET Remoting".

"Add Torrent to ABC" Greasemonkey script

The "Add Torrent to ABC" userscript makes it easy to start a torrent download on a remote machine.
It simply adds an icon link next to the torrent links that it can identify. That link uses a web interface of the ABC bittorrent client to start the remote download.

I'm using phpABC for the web interface, since PHP-4-ABC is not maintained anymore (I had to tweak it to make it work with ABC 3.0. A simple password protection achieves the level of security I need.
The userscript is configured with the url of my home machine and you will need to modify it with your own url before using the script.

Continue reading ""Add Torrent to ABC" Greasemonkey script"

February 22, 2006

Comment Tracking with coComment

Tracking the comments I leave at other people's blogs have been a long time problem for me. And it looks like many bloggers have the same problem.

One item on my todo list (that I didn't get to) has been to write a Greasemonkey script that would log my comments using Gmail (building on top of my "Mailto Compose In GMail" userscript). But proper comment form detection was an obvious difficulty.

A new service has appeared, coComment, which solved that issue, allowing you to effectively track your comments.
It works by injecting some javascript into any page with a comment form, so that your submission gets logged onto their server in the background. This modification of the form can be done using a bookmarklet (don't forget to click it before submitting your comment) or a Greasemonkey scripts.
It is able to recognize comment forms from various blogging tools, by having some specific code for each platform it supports (Blogger, MovableType, ...). I wonder if a microformat could get any traction in standardizing comment forms a bit more.

Continue reading "Comment Tracking with coComment"

January 12, 2006

XmlHttpRequest Debugging (Firefox 1.5 update)

Here's XmlHttpRequest - Debugging (version 1.2), an update on the original.
The script now works in Firefox 1.5 with Greasemonkey 0.6.4.

Thanks to the readers who reported the problem for their help and patience.

Continue reading "XmlHttpRequest Debugging (Firefox 1.5 update)"

November 11, 2005

Greasemonkey Hacks is out

"Greasemonkey Hacks" was published early November in the O'Reilly hacks series. If you're into Greasemonkey or want to learn more about it, this book has many excellent hacks explained and provides a nice complement to Mark's online book on the topic, "Dive Into Greasemonkey".

I'm happy and proud to have contributed 7 hacks to the book, including "Trace XMLHttpRequest Activity", which is available online for free (pdf).
Thanks again, Mark, for the opportunity and feedback. It was a great learning experience and lots of fun!

October 21, 2005

XmlHttpRequest Debugging (update)

Here's XmlHttpRequest - Debugging (version 1.1), an update on the original.

The fixed bug: onreadystatechange callbacks weren't getting triggered properly. The reason was the native XmlHttpRequest object doesn't call onreadystatechange if it also has an onload callback. The replacement onload handler now calls any onload and onreadystatechange callback from the user, emulating the same logic.

Update (2006/02/20): A newer version is available, supporting Firefox 1.5 with Greasemonkey 0.6.4.

October 20, 2005

ArsTechnica - Single Page View

Now that I've written a couple of "Single Page View" user scripts, I'm getting increasingly impatient when I encounter sites that break articles onto multiple pages.
It really seems like a disservice to users, forcing them to interrupt their reading to navigate to the next page (clicking and loading time). I suppose it's mainly a trick to display more ads. I'd rather simply scroll down with the space bar or a flick of the mouse wheel.

So here's one more Greasemonkey script, this time for ArsTechnica: ArsTechnica - Single Page View.

Any other similar sites that could use a little bit of cutting and splicing?

Continue reading "ArsTechnica - Single Page View"

September 21, 2005

XmlHttpRequest - Add Latency

I found about Harry Fuecks' AJAX Proxy thru this post on AJAX apps and latency.
Network latency is indeed very important to take in account when building a responsive web application, and its easy for developpers using their local webserver to overlook. Although AJAX web apps do optimize the network traffic better than traditional web sites, they still face the issue of latency.

Harry's proxy is a tool to help developers test their AJAX apps under more realistic network conditions, by adding some latency to the calls to the server. But it seemed overkill compared to a Greasemonkey-based solution, so I put together a really short user script that mirrors the behavior of the proxy (and should work for https pages): XmlHttpRequest - Add Latency.
It should be much easier to install than the python based proxy server; just install the script and configure the sites that you want it to run on. You can also edit the script to modify the amount of delay that is injected.

September 02, 2005

XMLHttpRequest - Security Bypass

While trying to help Dare make his MovieFinder page run in Firefox, I ran into an issue that can make developing AJAX applications a pain: when testing your pages, you need to host them in the same domain as your services.

I explain the details of the problem and how the "XMLHttpRequest - Bypass Security" Greasemonkey user script solves it.

Note: this script is meant for development only, as it gives the page access to a potentially dangerous API. The default @include is "file:///*", but feel free to restrict it even further to the path for the pages you're trying to tweak. You should never have to @include an http url.

Continue reading "XMLHttpRequest - Security Bypass"

August 04, 2005

RealSimple - Printer Friendly Redirect

I heard of RealSimple via 43 Folders a while back. I was just able to finally unstack it and actually check the site out.
Access to the articles is actually restricted to the subscribers of the magazine.
But it turns out the design of the security check is quite broken: the printer-friendly pages actually don't perform the check and you can get the url for the printer-friendly pages without being a subscriber. My RealSimple - Printer Friendly Redirect takes you to the more convenient single-page view of the articles, without even having you log in.

July 26, 2005

Slashdot - Single Page View

Here's the latest addition to my "single page view" series, this time for slashdot. Slashdot - Single Page View allows you to expand comments without reloading the page.
Clicking a "x replies beneath your current threshold" link will fetch the relevant comments in the background and merge them into the current view.
If you click the same link again will collapse it back to the original view.

This screenshot illustrates a sample Slashdot comment before and after modification, and the result of an expansion using the modified link.
Note that the yellow hightlights were added to the screen capture and are not part of the Greasemonkey script ;-)

Because the script only knows how to expand the "x replies beneath your current threshold" links, but not the other sub-thread links, it works best with a high threshold (4 or 5) to avoid getting links that can't be expanded (yet).

This script also combines nicely with Matt's Slashdot Live Comment Tree script, which allows you to expand and collapse threads that are visible in a given page.

July 20, 2005

IGN - Single Page View

Just finished the IGN - Single Page View user script for Greasemonkey. Instead of having to turn pages, the first page of IGN articles display the content of the whole article.

It keeps the general structure of the ACM Queue - Single Page View script. It's modularized better though, so that it can be re-used as a mini-framework for future "single page view" scripts. Essentially, you need to customize how to compute the url for the next page, how to merge the next page's content into the main page and when to stop loading more pages.

Continue reading "IGN - Single Page View"

July 12, 2005

ACM Queue - Single Page View

Here's my latest Greasemonkey user script: ACM Queue - Single Page View.

Many of the ACM Queue articles are formatted into multiple pages. Even their printer-friendly versions are not single page.
This script fixes that by combining all the pages for a given article into a single view. The resulting view (screenshot) has as much cruft removed as possible, to let you focus on the content.

Continue reading "ACM Queue - Single Page View"

May 31, 2005

AJAX Debugging with Greasemonkey

Following up on my last Greasemonkey user script, "XMLHttpRequest Tracing", I wrote a new script that goes beyond tracing: "XMLHttpRequest Debugging".

Here is a screenshot of the new UI.
What it shows is the XMLHttpRequest debugging console, a floating div embedded in the page being debugged. This replaces the javascript console, which the previous script used for tracing.
Each individual XMLHttpRequest invocation will get listed there, with all the details on the request and the response, as well as options to edit and replay the request or replay the response callback.

Update: A newer version of the script is available.

Continue reading "AJAX Debugging with Greasemonkey"

May 10, 2005

"XMLHttpRequest Tracing" for AJAX debugging

Here's a Greasemonkey user script to trace XMLHttpRequest calls in the javascript console. It logs the "open" and "send" calls, as well as the response status code and text.
Its purpose is to help peek into AJAX applications, to learning or troubleshooting, without having to run a network sniffer.

This screenshot shows a sample output (Google Suggest). Each XMLHttpRequest instance is assigned a random ID (781 in this example) that allows you to track multiple requests being run in parallel.

It's a pretty early version, so feel free to send some suggestions and feedback.
It doesn't work on GMail. I'm not sure why yet (any pointers appreciated ;-).

Thanks to the anonymous contributor that posted that idea in the Greasemonkey user script requests page.

Continue reading ""XMLHttpRequest Tracing" for AJAX debugging"

May 05, 2005

"Identify Password Fields" Greasemonkey script

Here's a simple user script to identify password fields .

Here's a screenshot which shows how password fields are identified with a special background pattern.

My first approach used an XPath query to find all the password fields and add a special CSS class to their className. Then I discovered one of many CSS selector tricks, which turns this script into a one-line CSS rule: input[type='password'] { background-image: url(data:xxx) }.
The data: url simply is a small gif with a transparent background, that can be tiled nicely.

Continue reading ""Identify Password Fields" Greasemonkey script"

May 01, 2005

Detecting AdBlock: conflicts and collaboration

A long discussion started a couple of days back on the Greasemonkey mailinglist: should Greasemonkey let websites know that it is running (using some kind of special header)?

I was just exploring the DOM to try and write a script (FitSizeToTablet, more info at the end of the post). To my surprise, the javascript shell listed an _AdblockFiltered property on the window object. It not only makes AdBlock detectable to script running in the page, it actually lists all the urls that where blocked for this page.

Continue reading "Detecting AdBlock: conflicts and collaboration"

April 29, 2005

Textarea resize user script

Typing a lot of text, such as blogging or commenting, into small text boxes on a web page is uncomfortable. The following script makes it more comfortable. After you install it, you can enlarge any text box by typing Ctrl-Enter.

TextareaResize is my latest Greasemonkey user script.
It allows you to grow the size of textareas on most websites using the keyboard: while typing in a textarea, press Ctrl-Enter to expand the textarea vertically and Ctrl-Space to make it wider.

Update (2005/05/10): Updated to maximize how much of the textarea can be seen: the textarea is brought at the top of the window and won't be resized any larger than the viewport.

Update (2005/05/19): Updated the script with the code Matt Sherwood suggested in a comment: Shift-Ctrl-Enter and Shift-Ctrl-Space to shrink the size. I also improved the way the textarea gets centered, using ScrollIntoView.

April 12, 2005

"MSDN Language Filter" user script

Just finished my MSDN Language Filter Greasemonkey user script. It removes the code samples for the languages you don't care about (say VB or JScript), on MSDN.
It lets you choose which language you want to filter out (see screenshot below) and remembers your preferences (using the new GreaseMonkey 0.3 data persistence APIs).

Here's a screenshot.

Continue reading ""MSDN Language Filter" user script"

April 10, 2005

Various Greasemonkey user scripts

Wrote a couple more more Greasemonkey user scripts last week:

  • Allow Password Remembering removes the autocomplete="off" attributes that dictate the browser to never remember the tagged fields (usually for security or privacy reasons).
  • Auto Reload reloads the configured urls every minute. It's useful for staying logged into some sites that have their sessions expire after a certain time (again, usually for security reasons). It's a bit different than the ability of the tabbrowser extension to reload tabs, as this script can cause frames to reload (not the whole document). I'll probably look into a way to configure this one to choose how often the url should be refreshed.
  • O'Reilly Network Printer Friendly Redirect redirects to the printer friendly version of the O'Reilly Network pages, when they are loaded.
  • Business 2.0 Printer Friendly Links and Redirect re-writes article links directly to their printer-friendly version, rather than the article summary page. If you happen to land on one of these interstital pages, it'll also redirect you to the printer-friendly version. This user script is mostly useful if you have access to the Business 2.0 online articles, which requires an issue access code (found in the printed magazine) or a subscription code (printed on the address label of the magazine for those who subscribe).

Update (2005/04/12): Added How Stuff Works - Printer Friendly, which redirects and re-write links to the printer-friendly version of "How Stuff Works" pages. It also prevents the links from opening in a new window.

Update (2005/04/18): Thanks to Logan for the various improvements and suggestions. I updated IGN Butler to be cleaner and also skip ads on a number of other sites (see comments below). It seems that IGN, GameSpy, RottenTomatoes, PlanetDoom, PlanetHalfLife,... are all part of the same network. I never noticed that RottenTomates has links and ads from IGN.

April 04, 2005

Handle mailto: links with Gmail

I was just writing about the problem of having the browser send specialized blobs of data to a user selected service ("open-ended links"). One example is how to handle special URI schemes such as mailto: with a web-based service. There is a number of ways to do this, including registry hacks and browser extensions. I wish there was a more lightweight architecture supported by the browser...

Anyways, I experimented with Greasemonkey to get mailto: links to open in Gmail. The result is MailtoComposeInGMail.user.js.
It looks for mailto: links and re-writes them to go to the Gmail compose page, which most of the useful parameters (to, cc, subject, body,...) maintained.

It has a minor inconvenience, in that you cannot do "Copy email address" in the browser's context menu anymore (since it's not a mailto: link anymore). On the other hand, it allows you to open that link either in the current window or a separate tab the same way you would do any regular link.
I couldn't get both behaviors to work at the same time...

Continue reading "Handle mailto: links with Gmail"

March 15, 2005

BoingBoing Ad Remover

BoingBoing was just pointing at Mark Pilgrim's Google Butler, which strips Google ads and adds a number of useful features.
Since I was just posting about the coming conflicts around ad-filtering, I wanted to have some fun throwing oil onto the fire, as well as experiment with the Greasemonkey extension for Firefox. So here is "BoingBoing Butler" (requires Greasemonkey), which hides all non-content from BoingBoing.

While I'm at it, here's a some challenges to Greasemonkey hackers:

  • Could we use this to bring Google auto-completion to the main Google search page? or add more integration between the various Google services (search, mail, maps,...)?
  • Could this be used to create some in-page annotation using del.icio.us or wikis? or would javascript/domain restrictions prevent that?
  • Create an easy way to find Greasemonkey scripts for a site that you're at. It would search, list and describe all the useful customizations that you could apply to the site. Can this be done by re-using the existing search engines, using a distributed approach (FOAF, a file type or a standard url format?), instead of creating a dedicated directory site with a "search by site" functionality?

And also some questions:

  • How to avoid the blinking effect, as the sidebars are loaded and then hidden? Is it cleaner to completely remove the elements from the DOM, rather than using CSS to hide them?
  • Those user scripts are completely unsecure, aren't they? Any of them could include some spyware/adware script to phone home (log the websites that I visit) or display ads, is that right?

Continue reading "BoingBoing Ad Remover"

March 01, 2005

The brewing war over ad filtering

... and content modification.

It seems like the war for content control (DRM, implicit EULAs, DeCSS, PVRs, ...) is increasingly extending from the music and movie industry to the internet.

Services built on top of other sites generate a good portion of the conflicts: sites with deep-linking policies, lawyers restricting how their RSS can be redistributed or simply, general questions about copyright and caching/proxying/quoting/converting...

But the client (browser) is also a major friction point, because of its ability to modify the content, as illustrated in the debate over Microsoft's SmartTags and Google's AutoLinks.
Advertisement filtering is just a variation on the usual conflict between content producers or users, and many of the classic arguments apply. It's only more sensitive because ads are the revenue source for many websites.

Continue reading "The brewing war over ad filtering"