/*
 * waitForImages 1.2.2
 * -----------------
 * Provides a callback when all images have loaded in your given selector.
 * http://www.alexanderdickson.com/
 *
 *
 * Copyright (c) 2011 Alex Dickson
 * Licensed under the MIT licenses.
 * See website for more info.
 *
 */

;(function($) {
    $.fn.waitForImages = function(finishedCallback, eachCallback, waitForAll) {

        // Handle options object.
        if (typeof finishedCallback === 'object') {
            eachCallback = finishedCallback.each;
            waitForAll = finishedCallback.waitForAll;
            finishedCallback = finishedCallback.finished;
        }

        // Handle missing callbacks.
        finishedCallback = finishedCallback || function() {};
        eachCallback = eachCallback || function() {};

        // Convert waitForAll to Boolean
        waitForAll = !! waitForAll;

        // Ensure callbacks are functions.
        if (!$.isFunction(finishedCallback) || !$.isFunction(eachCallback)) {
            throw new TypeError('An invalid callback was supplied.');
        };

        return this.each(function() {
            // Build a list of all imgs, dependent on what images will be considered.
            var obj = $(this),
                allImgs = [];

            if (waitForAll) {
                // CSS properties which may contain an image.
                var hasImgProperties = $.fn.waitForImages.hasImgProperties || [
                    'backgroundImage',
                    'listStyleImage',
                    'borderImage',
                    'borderCornerImage'
                    ];
                   
                var matchUrl = /url\((['"]?)(.*?)\1\)/g;

                // Get all elements, as any one of them could have a background image.
                obj.find('*').filter(function() {
                    var element = $(this);

                    // If an `img` element, add it. But keep iterating in case it has a background image too.
                    if (element.is('img')) {
                        var imageSource =  element.attr('src');
                        if (typeof(imageSource) === 'undefined' || imageSource == '') { return; }
                        allImgs.push({
                            src: imageSource,
                            element: element[0]
                        });
                    }

                    $.each(hasImgProperties, function(i, property) {
                        var propertyValue = element.css(property);
                        // If it doesn't contain this property, skip.
                        if ( ! propertyValue) {
                            return true;
                        }

                        // Get all url() of this element.
                        var match;
                        while (match = matchUrl.exec(propertyValue)) {
                            allImgs.push({
                                src: match[2],
                                element: element[0]
                            });
                        };
                    });
                });
            } else {
                // For images only, the task is simpler.
                obj.find('img').each(function() {
                    if (typeof(this.src) === 'undefined' || this.src == '') { return; }
                    allImgs.push({
                        src: this.src,
                        element: this
                    });
                });
            };

            var allImgsLength = allImgs.length,
                allImgsLoaded = 0;

            // If no images found, don't bother.
            if (allImgsLength == 0) {
                finishedCallback.call(obj[0]);
            };

            $.each(allImgs, function(i, img) {

                var image = new Image;

                image.onload = function() {
                    allImgsLoaded++;
                    eachCallback.call(img.element, allImgsLoaded, allImgsLength);
                    if (allImgsLoaded == allImgsLength) {
                        finishedCallback.call(obj[0]);
                        return false;
                    };
                };

                image.src = img.src;
            });
        });
    };
})(jQuery);
@@ -2002,175 +2002,22 @@
 'img
-')) %7B%0A                        var imageSource =  element.attr('src');%0A                        if (typeof(imageSource) === 'undefined' %7C%7C imageSource == '') %7B return; %7D
+%5Bsrc!=%22%22%5D')) %7B
 %0A   
@@ -2089,19 +2089,27 @@
 rc: 
-imageSource
+element.attr('src')
 ,%0A  
@@ -3043,16 +3043,25 @@
 ind('img
+%5Bsrc!=%22%22%5D
 ').each(
@@ -3077,96 +3077,8 @@
 ) %7B%0A
-                    if (typeof(this.src) === 'undefined' %7C%7C this.src == '') %7B return; %7D%0A
     

Use selectors instead of if statements