techniques #5: Greasemonkey script: Flickr LumberJockifier

  • Advertise with us
Blog entry by Gary Fixler posted 03-30-2010 11:48 AM 2035 reads 0 times favorited 5 comments Add to Favorites Watch
« Part 4: Sharpening up my little Buck Bros. 3" block plane Part 5 of techniques series Part 6: tattoo removal via handheld sander »

Something that’s always important to me is efficiency. I’m a weird mix of lazy and hardworking. I’ll spend 10 hours coding up something that will save me days of work later, mostly because I get bored of having to do the same steps over and over again. I post a lot of pictures here on LumberJocks, and my method is usually to pop off a tab with Flickr in it, move that new window to a separate monitor, then in my new post back in the first window type !()!: on its own line wherever I want an image. It’s become complete muscle memory to type that, and I fire it off like it’s a single character. Then I click in the address bar of the image page on Flickr that I want to link to, then middle-click after the : in the image link. That’s a Linux trick (actually part of Gnome and the window management system, though not important for our purposes here, other than to say that it’s nice to be able to select something, then just middle-click in a text area to paste it – no need for dragging, or copy/paste). Then I’d click on the image and drag it to the space between the first ! and the ( to drop the address to the actual image. Then I’d type the title-text between the ( and ). That’s the text that pops up when you roll over an image.

This was sort of okay, though a bit of a hassle for posts with a dozen images or so. Too, Flickr just recently changed their system – and there’s no way to change it back the way it was that I can find – such that dragging the image to try to easily drop its address in the right spot in my posts just draws a box over said image, which then pops up a thing asking if I want to write a note in that box or tell it which person I’m framing (a new feature, similar to Facebook’s person tagging ability). This means I actually need to click “ALL SIZES” above the image, then click on “medium” on the next page, then drag that image over into my post, then go back 2 pages to where I was. I have that sorted down to mouse gestures. I right-click on the “ALL SIZES” link, drag down and release, and that opens the link in a background tab. Then I click on that tab and click the “medium” size link, drag that over, then use the right-click, drag down and right mouse gesture to close that new tab, leaving me back where I was. Extra hassle! Gestures make it easier. Linux’s little tricks make it easier, but I must have posted hundreds of images here by now. I’m tired of going through these motions. I wanted something that would just give me the entire link I type here, except for the title text in the ()s, which I obviously would have to make up on the spot still.

Enter Greasemonkey. This is a free addon for Firefox, my web browser. It lets you write scripts in the Javascript language that can do anything you want that Javascript is capable of doing. Each script has parameters that let you define what pages it runs on, which can be a specific list, or something with a wildcard (e.g. anything at a particular site under a particular subdirectory). Greasemonkey is often used by people to modify a particular page, or set of pages on the internet. It doesn’t change the page online for anyone else, but it modifies the page for you, the user of Greasemonkey with a particular script installed. I decided to write one that would notice when I was looking at an image on Flickr, figure out what that image’s address was, and what the address of the page containing the image was, and glue them all together with the LumberJock’s punctuations as a proper bit of text I could just drop in place in my posts. I spent an hour or two diving back into the world of Javascript. I always forget so much. It’s pretty much a language I am able to use only through looking things up. Thank goodness for the huge vat of knowledge that is the internet. It still takes a lot of guessing and fighting.

Anyway, now it works. It puts a properly formulated bit of LJs image code right under the image. I just triple-click on it to select the entire line, then middle-click where I want it in my post in the other window, and it inserts it. To finish, I just type in the title-text inside the ()s and move on. Here’s what I see (the text just under the image is what my script added):

Greasemonkey modified Flickr page

The funny part is that I just embedded that image with a similar link grabbed from under that image on Flickr :)

If you have Greasemonkey installed and operational, you can click on the link here to the script and it’ll ask if you want to install it. If you don’t have it installed, you’ll probably just see the text of the .js file itself in your window, or it’ll just ask if you want to save the file. There’s not much to the script, only to the battle to figure out what small amount of code would solve the problem.

I used the script extensively in my last post, and I’m happy to report that it greatly sped me up.

-- Gary, Los Angeles, video game animator

5 comments so far

View TMcG's profile


191 posts in 4341 days

#1 posted 03-30-2010 12:35 PM

Nice, as a fellow pointy head I can appreciate exactly what you’re saying !

Installs in Chrome as an extension, not quite sure how to get it to do it’s thing though…..


View lew's profile


13488 posts in 5095 days

#2 posted 03-30-2010 04:40 PM

I envy your programming abilities. Having worked with computers and electronics since the early 60’s, it is frustrating to me to understand the tremendous power of computers and the fact they can be custom programmed to perform “our” tasks instead of just using the “canned” functions that someone else believes we need. But, alas, my mind functions something along the lines of an Ethiopian Earthquake- a jumbled mess. Hardware and troubleshooting come naturally but even the most Basic languages cause me to go screaming into the night.


-- Lew- Time traveler. Purveyor of the Universe's finest custom rolling pins.

View longgone's profile


5688 posts in 4648 days

#3 posted 03-30-2010 10:36 PM

I have absolutely no idea of what you said.

View MsDebbieP's profile


18619 posts in 5501 days

#4 posted 03-31-2010 12:20 PM

oh to save those annoying seconds wasted on the techno-crap! Sweet.
And on that thought – I join Greg the WhoDat :)

Congrats, though, on your time-saving success!

-- ~ Debbie, Canada (, Young Living Wellness )

View Gary Fixler's profile

Gary Fixler

1001 posts in 4722 days

#5 posted 03-31-2010 12:44 PM

Greg and MsDebbie – I should probably have just summed up: I made a thing that automatically writes some text under any image I view on flickr from now on. I can copy that text into a new post or comment on LumberJocks, and when I make the post, it will be automatically formatted to show that image, and make it a link to the flickr page where that image lives :)

TMcG – wish I could help, but I don’t know Chrome (yet). I bet the internet knows what’s up.

Lew – I think that’s a nearly universal feeling. I always wish my box could do something it can’t, and that I don’t know how to make it do. I’d like to go back to 14 year old me – the one just getting his first computer and learning gwbasic – and tell him everything I know. Then maybe by now I’d be some kind of uberuser.

Skarp – hard to tell if you’re being sarcastic or not! I actually do love regexs, even though they’re the bane of most programmer’s existence. For some reason, at some point they made sense to me, and I use them all the time now, especially in vim. I can usually write some pretty complicated ones straight out and they tend to just work. Woo!

-- Gary, Los Angeles, video game animator

Have your say...

You must be signed in to post the comments.

DISCLAIMER: Any posts on LJ are posted by individuals acting in their own right and do not necessarily reflect the views of LJ. LJ will not be held liable for the actions of any user.

Latest Projects | Latest Blog Entries | Latest Forum Topics