Category Archive for 'Javascript'

Minifying Javascript and CSS on mrclay.org

Thursday, March 27th, 2008

Minify v2 is coming along, but it’s time to start getting some real-world testing, so last night I started serving this site’s Javascript and CSS (at least the 6 files in my WordPress templates) via a recent Minify snapshot.
As you can see below, I was serving 67K over 6 requests and was using some [...]

Thoughts on a Javascript “validator”

Monday, July 16th, 2007

(X)HTML and CSS have their own validators, but we need one for Javascript as well. JSLint could be part of it, but what I’m imagining would flag the use of “native” objects/interfaces not defined by W3C or ECMA standards. E.g., document.layers or window.ActiveXObject.
The hard part in doing this is finding a full Javascript interpreter with [...]

Hacking a 3rd party script for bookmarklet fun

Wednesday, June 27th, 2007

A few weeks ago I created a simple bookmarklet that loads del.icio.us’s PlayTagger script into the current page. This post covers how some problems with this script were worked through.
Too late
The first challenge was that PlayTagger was designed to initialize itself (let’s call this method “init“) on window.onload: If a user fired the bookmarklet after [...]

Kill these DOM0 shortcuts

Monday, June 25th, 2007

A problem a decade in the making

You can refer to a form’s elements in your code by using the element’s name (from the NAME attribute)
– an ancient Javascript spec.

This means myForm.myElement is a shortcut for myForm.elements['myElement']. I’m sure this was seen as handy and harmless at the time, but the problem is that references to [...]

Detect a blocked pop-up window

Wednesday, March 22nd, 2006

Since reliable info doesn’t seem to be out there, this Javascript detects if a pop-up window was blocked at least by IE6/XPsp2’s built-in blocker, FF or Opera 8.
var popWin; // global for easy reference later
function pop(url, name, features, replace) {
popWin = open(url, name, features, replace);
if (popWin == [...]

Bookmarklet manager bookmarklet?

Saturday, September 17th, 2005

In the redundancy file. Someone needs to create a bookmarklet that loads into the current page an interface for executing pre-saved bookmarklets. I’ve already seen several examples of this with pre-defined sets of bookmarklets (notably Favelet Suite) but why limit the user to one set? I’m already keeping my regular bookmarks and [...]