Posts Tagged ‘extensions’

JavaScript Console v0.0.1

Monday, December 14th, 2009

jsConsoleSS

So I just made this little extension for Chrome.

There were some pretty convoluted to gymnastics I had to go through to get the console on the page and get it to execute the JS I wanted it to execute. Pretty much the only hook you have it an onClick (from what I can tell). They’ve got it locked down TIGHT.

This needs a LOT of experimentation done, but it looks like you can use it to define functions on the page through the console and call those functions. However, the functions do NOT persist. So, you can do:

function test(){
alert('test');
}
test();

and “execute js” and an alert will come up and say “test”.

But you can’t do:

function test(){
alert('test');
}

and “execute js” and then:

test();

and “execute js” and expect an alert to pop up.

I’m sure there are many sound reasons for this from a security standpoint, but it’s annoying as hell to try and program for. It would be great if I could fix this and I have a few ideas as to how I can do that…

The main reason I’m making this is basically as a prototype/POC for the Status-bar Calculator port from FF since I’m going to have to do some very similar things to get the Calculator to show up in the bottom right hand corner (like this does).

EDIT: After publishing the extension, it was pointed out to me that Chrome already *has* a JavaScript console if you hit Ctrl + Shift + J. However, that console only allows single line input, whereas this allows for as many lines as you want, making this just a *little* more functional. It would be awesome if I could find a way to hook this console into that console.

Checkout the project page.

Chrome Extension – Status-bar Calculator v0.1.9

Wednesday, December 9th, 2009

So I ported the Status-bar Calculator over to Chrome. It took me a little under 2 hours.

Chrome extensions are shaping up to be a gagillion times easier to create than FF extensions were back when I started doing them four years ago. I actually re-wrote the entire thing from scratch. It functions completely differently, relying entirely on the eval() function to do all of the math (where the FF version jumps through some crazy hoops).

The Chrome version has something I’ve wanted for a long time: history.

It’s not persistent yet, but while you are in a “session” the equation history keeps building below the box so you can see where you’ve been if you are plugging away at a list and lose your place.

As with the FF version, it’s MIT license. Steal it, or hack on it and contribute back to me (I’ll definitely credit you and much appreciate it).

You can check out the source code here or on Etherpad here.

I’m looking forward to really fleshing this thing out and making it rock for whenever extensions make their public debut in Chrome. Oh, yeah, btw, you have to install the developer beta of Chrome to get extensions…

Status-bar Cloninator

Friday, March 21st, 2008

So, I was a little dismayed to see that someone else had started a competing calculator extension for my Firefox calculator extension. Then, I realized they are my evil twin.

Let’s start with the names of the extensions. Mine:

Status-bar Calculator

Theirs:

Status-bar Scientific Calculator

hrm…

Now lets look at the extensions:

Mine:

Theirs:

ok. Now let’s evaluate the extension itself. Mine is a little calculator icon that sits in the browser. When you click it, it expands to reveal two textboxes that can be used for simple math and dec/hex/bin/oct conversions. Thiers is a little calculator icon that sits in the browser. When you click it, it expands to reveal one textbox that can be used to type in math equations and do dec/hex/bin/oct conversions.

Darn. Theirs is better. Crap.

Let’s go ahead and add some insult to the injury. Here is the description for my extension:

It’s a tiny calculator icon in the status bar. Click it, to expand it and use it. Click the ‘+’ to change to ‘-’, ‘/’, or ‘*’. Click ‘=’ to get the answer (output to the first textbox). Or, if you don’t like to use the mouse, you can use the +, -, *, /, ^, =, and ENTER function keys to do the calculations instead (just like a calculator). Click the calcultor icon to shrink it to just the icon when not using it.

Here is the description for theirs:

It’s a tiny calculator icon in the status bar. Click it, to expand it and use it. Enter the expression to calculate and hit enter to evaluate.

Wait… no… did they really just cut and paste my description??? Must have. There is no other possible explanation. Ok, so now let’s look at our websites. Take a look at mine, and now take a look at my evil twin’s. Notice anything? How about the big fat scrolling code in the background?!?

HE EVEN HAS THE SAME STUPID HAIRCUT AS ME!!!!

Why, Sunny, WHY???