日期:2014-05-16  浏览次数:20329 次

求大神帮忙看一下JS
(function (window, $, undefined) {
    if (!$) { console.log("FQfast缺少jQuery依赖!"); return; }
    var FQfast = function () {
        return FQfast.fn.init();
    };

    FQfast.fn = FQfast.prototype = {
        init: function () {
            return this;
        }
    };
    // 添加扩展方法
    FQfast.extend = FQfast.fn.extend = function () {
        console.log("extend");
        var options, name, src, copy,
        target = arguments[0] || {},
        i = 1,
        length = arguments.length;
        if (length == 1) {
            target = this;
            i--;
        }
        for (; i < length; i++) {
            if ((options = arguments[i]) != null) {
                for (name in options) {
                    src = target[name];
                    copy = options[name];
                    if (src === copy) {
                        continue;
                    }
                    if (copy !== undefined) {
                        target[name] = copy;
                    }
                }
            }
        }
        return target;
    }
    FQfast.extend({
        Dialog: function () { alert("测试"); },
    });
    alert(FQfast.Dialog());
    // 将框架变量 -> window