A notch above a monkey

Javascript 1.7

I fairly often talk to developers with disdain for Javascript. I don’t blame them, since I used to share it. There are various reasons for it, some more valid than others, but one that almost never comes up is the very thing that bothers me most.

I was reading about features promised for Javascript 1.7 which should be a part of Firefox 2.0 and I like lots of them. How wouldn’t I when only few of them can’t be found in Python.

The thing is, most of the time I have almost absolute control of which version of Python, Java or what have you I’ll use. But when your code lives inside of a browser, you’re pretty much stuck with what’s out there and if my experience is anything to go by then I won’t be using new features widely before next decade.

Who wants to wait that long?

Marela widgets II

Heat is gone, work isn’t, but I still found time to have fun while shamelessly copying other people ideas.

The result:

It’s a simple widget for displaying two randomly chosen pictures with a given tag out of up to a hundred.

The widget was successfully tested in Internet Explorer 6, Firefox 1.0 and Opera 9.0. It only sort of works in Safari, but if this is good enough for you, you can add it to your own page by inserting:


<script type="text/javascript" src="http://markos.gaivo.net/marela/doublerandom.js?username=markos&tag=moja-izbira&time=2"></script>

You should, however, replace:

  • my username (markos) with yours
  • select a tag of your chosing
  • set time lag in seconds between image replacements

I’m not quite happy with it yet. I’d like to fix Safari support and my code for avoiding two same images is still buggy. If you’d like to use the latest known working version, then use the link to my page. Otherwise you’re free to copy the contents of script’s directory.

And if you’re reading this post on the front page, you’ve might have noticed that there are no problems in using both widgets on the same page.

Marela widgets I

It’s the beginning of August, heat is temporarily gone and I wish it took work with it. But no, it’s still lying there and there’s enough of it that I have some problems deciding what to do first.

So how do you solve a problem like that?

Personally, I goof off by writing something fun (still more useful than reading blogs). For example a simple javascript file based on my Marela library that allows me (or you) to insert a single random image from your chosen Marela photostream like this:

If you don’t believe me just reload this page and look at its source.

See? Told you.

If you want to do the same, but don’t want to show my images on your page, just insert


<script type="text/javascript" src="http://markos.gaivo.net/marela/singlerandom.js?username=markos&tag=moja-izbira&size=2"></script>

in your page and replace markos with your Marela username (contact me, if you need an account) and moja-izbira with your chosen tag. You can specify the size of an image with a number from 1 to 3 (2 being default if attribute is missing).

I’ll write some more widgets like this through August, if I don’t change my mind. Hence the title of this post.

Also I’ll write Javascript for first 5 souls who need it as long as it’s a problem that won’t take too much of my time. This offer expires at the end of this month.