Is a Follower
An add-on for Dribbble
This is a piece of Javascript that adds a small status indicator to the user's profile and shot pages to show if he/she is following you on Dribbble. A pair of announcements on Dribbble is here and here.To use
The same code is available in three packaged forms.- isFollower.user.js - a Greasemonkey script, Firefox
- isFollower.chrome.crx - an extension for Google Chrome (instructions)
- "> isFollower.js - a bookmarklet (instructions)
If you have a lot of followers - in thousands -
the code will take a while to run on its first run. This
is the only time it needs to download your entire
list of followers and due to Dribbble API restrictions
it cannot go faster than 30 followers per second after
the first thousand or two. All subsequent updates of
the list, e.g. when you pick up new followers, are
generally very fast.
Hovering your mouse over the indicator will show you, in
real-time, the progress:
The code works in Firefox, Safari, Mobile Safari and Chrome.
I would venture a guess that it doesn't work in Internet
Explorer, but that's an easy guess to make.
To hack
The source code is on Github. The copyright is mine, but otherwise feel free to do what you want with it: isFollower on githubHow it works
The thing works by pulling off your Followers list via Dribbble API and comparing user's ID from the currently viewed profile or a shot page against this list.The code does a decent job of trying to stay really fast. For one, it caches the folowers list locally. For two, it updates the list only if the number of your followers changes or if it was a week since the last update (just in case if some people followed and the same number of people un-followed). For three, when it updates the list, it does so incrementally, scanning from the most recent end and stopping once it picks up all the changes. This is the best part, because it means that updating the list after new followers are picked up (and without loosing any) can be done in just one or two API calls.
That being said, on the first run it needs to download the entire list. As of February 2012 the API allows querying the list in 30 follower increments and it also imposes a general cap of 60 requests/min. The code therefore implements request throttling - it sends first 30 requests back to back, next 30 - 250 ms apart and then spaces the rest in 1 sec intervals. Hence the blazing speed of the initial list update - up to several minutes for those with thousands of followers... poor bastards :D