GreasyThug – Greasemonkey, Gears and jQuery

I’ve been called a greasy thug, too. It never stops hurting. So here’s what we’re gonna do: We’re gonna grease ourselves up real good and trash that place with a baseball bat. – Homer

Presenting: GreasyThug

Here’s my problem, I want to develop Greasemonkey scripts. This doesn’t sound like a problem, but JavaScript has a certain terribleness to it, at least in its current browser implementations, and I can never go back to raw JS, NEVER. I’ve also grown accustom to having an interactive console for development and debugging, but Firebug doesn’t have access to Greasemonkey code. And another thing, shouldn’t I be able to make changes to a page, on the fly, and have them persist, without having to dig out my scripts and modify them? Shouldn’t every website be using Gears by now? Wouldn’t it be great to be able to use jQuery in your browser console on every website you go to?

Fact: GreasyThug will make all of your wildest dreams come true.

GreasyThug – Interactive JavaScript Console Features

  • Built in jQuery functionality.
  • Google Gears included.
  • A persistent command history across page reloads and browser restarts.
  • Drag and drop – remembers where you put it for each site.
  • Ability to persist micro-scripts and apply them automatically everytime you visit the page.

Warning! GreasyThug is slick (it’s the grease) and dangerous (it’s a thug). An interactive console is essentially a pipe straight into eval(). So… BE CAREFUL! If your thug becomes compromised it will be your house that gets trashed with a baseball bat. Remember, this is eval in the elevated Greasemonkey privilages context, its strength for development is also its weakness for security.

Prerequisites

Demonstration

Let’s spruce up the google search page. Maybe we should make a whole Greasemonkey user script? Nah, that’s a huge hassle now that we already have GreasyThug.

  1. Go to Google.com
  2. A “The website below wants to store information on your computer using Gears” security warning will pop up, as it will do for everydomain that you have GreasyThug enabled for. It’s not really the website using Gears, though some might eventually. Click “Allow”. (This is how the command history and micro-scripts are saved).
  3. Now let’s get cracking! Drag the interactive console to a comfortable location. (It will begin in the top left by default)greasy_thug-1
  4. Execute some JavaScript statements to get a feel for it. No need for semicolons, we’re not chumps.
  5. Now on to the cool stuff: that white background is a little bland for Valentine’s Day, let’s spice it up. Pop this into your console:
    $('body').css('background-color', '#F8A')

    greasy_thug-03 It’s beautiful! See how I can use jQuery? Neat! Also, the up arrow populates the input with my previous command.

  6. Maybe it’s not quite as good looking as I thought, probably best to stick with white… let’s just refresh and forget about this debacle. greasy_thug-04 Back to normal… but the history remembered my command in case I want to try it again.
  7. It is my strong belief that there should be a link to STRd6 right next to everyone’s email address on the Google search page. Obviously this should only be for logged in users… I can only change it for myself though…
    $('#gb nobr').prepend($('<a href="strd6.com">STRd6</a>'))
  8. But what about when I refresh… it’ll disappear and all that hard work will be gone?!? Not so good friend:
    savePrevious()

    This will store whatever command you last executed to be executed again when you return. You can save many commands. These are those micro-scripts that you’ve been hearing so much about and they are the future.greasy_thug-06

So is this the end? It is for today. Now imagine sharing micro-scripts with your friends. It’s our internet now. It just takes some elbow grease and a little thuggery.

Feature requests go in the comments.

4 thoughts on “GreasyThug – Greasemonkey, Gears and jQuery

  1. Dude! this is awesome! exactly what i was looking for! any command for exiting it?

  2. Hello and thank you! I am just getting into the world of advanced javascript and greasemonkey and this is amazing.

    One feature I would love to see is a snippets or common commands box or something similar to that.

Leave a Reply

Your email address will not be published. Required fields are marked *