Wednesday, November 26, 2008

Analyzing the Amazon Universal WishList Bookmarklet

Amazon added a nifty Universal Wishlist function to their site back in August but I just discovered it today (thanks Yuriy!).  Essentially it is a personalized bookmarklet/favelet that injects code into any page, letting you add any and everything to your Amazon wishlist.

The code for the bookmarklet is this:


Not very readable – so I decided to expand it.  I added linebreaks, and in some cases vars, {}s and in one case changed a tertiary conditional to a regular if..else statement:

(function() {

    //order of execution:
    //1. Initialization
    //2. Script check
    //3. Load remote script
    //4. Execute remote script

    //***Initialization ***
    //create short aliases for common objects
    var w = window, l = w.location, d = w.document;
    //create a script element and give it a short alias
    var s = d.createElement('script');
    //create some more short aliases...
    var e = encodeURIComponent, x = 'undefined';
    var u = '';

    //***Script check ***
    //if the script element was not properly created...
    if (typeof s != 'object') {
        //..navigate to the Wishlist add page, passing along the current page url and title
        l.href = u + '?u=' + e(l) + '&t=' + e(d.title);
        //effectively ends the script

    //...else (script successfully created)

    //*** Load remote script ***
    //create a function that we can call recursively until the document is fully loaded
    function g() {
        //if the document is not fully loaded...
        if (d.readyState && d.readyState != 'complete') {
            //.. wait 200 milliseconds and then try again
            setTimeout(g, 200);
        } else { //... the document IS fully loaded
            //if the Amazon Universal Wishlist object is undefined...
            if (typeof AUWLBook == x) {
                //set the source of the script element to 
                //This is a pretty complex and large JavaScript object, not discussed here
                //Essentially it displays a floating div in the top left corner of the page
                //in which the user can enter product details and select from the pictures on the
                //current page.
                //AUWLBook is personalized for each user, setting Wishlist titles and regystryIds
                //If the user is signed out, it will navigate to the Amazon sign in page, and then 
                //to the wishlist
                //If the user is signed in, it will display a floating confirmation div with options
                //of navigating to the list or "continue shopping".
                //I don't BELIEVE the loc query parameter actually alters the generated JavaScript, 
                //it must be used for other purposes
                s.setAttribute('src', u + '.js?loc=' + e(l));
                //append the script
            //***Execute remote script ***
            //create a function that we can call recursively until the AUWLBook object is fully loaded
            function f() {
                //if the AUWLBook object is not loaded yet, wait 200 ms and try again
                if (typeof AUWLBook == x) {
                    setTimeout(f, 200);
                } else { //when loaded display the pop-over div - see above
            //call the f function
    //call the g function
} ())
See for the full js with proper highlighting.

Labels: , , , , ,

Tuesday, November 25, 2008

TypeMock offers Unit Testing Framework for SharePoint

First a disclosure:  This is a blatantly self-serving post: I want to be one of 50 recipients of a free copy of “Isolator for SharePoint”.

Mandatory statement:

Typemock are offering their new product for unit testing SharePoint called Isolator For SharePoint, for a special introduction price. it is the only tool that allows you to unit test SharePoint without a SharePoint server. To learn more click here.

The first 50 bloggers who blog this text in their blog and tell us about it, will get a Full Isolator license, Free. for rules and info click here.

But that said, I am intrigued by two things:  Roy Osherove is now doing SharePoint development?  That can’t hurt the community.  Second, I heard rumors this will work on a non-SharePoint server.  Could my VPC days be coming to an end?  (Couldn’t come fast enough…)

Labels: , , , , , ,

Friday, November 07, 2008


This looks like a really handy little utility for  testing stuff like workflow: the utility allows your program to connect to the SMTP server and “send”, but doesn’t actually send the message anywhere – it just gets added to the papercut app, which lets you see the raw, body and html view of the email.

via Scott Watermasysk

Labels: , , ,

I’m Free. Free Falling.

No more visiting every morning:



Labels: , , , , ,

Thursday, November 06, 2008

Morgan Stanley/Mary Meeker: State of the Web Economy

Mary Meeker Web 2.0 Presentation
View SlideShare presentation or Upload your own. (tags: web 2.0)

Labels: ,

Wednesday, November 05, 2008

Random: I'm tall, so I must be competent


Labels: ,

Tuesday, November 04, 2008


Now I want to see some change. No excuses.

Labels: , ,