1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
| var extend = (function (extend, undefined) {
var isWindow = function (obj) { return obj && typeof obj === "object" && "setInterval" in obj; };
var class2type = {};
"Boolean Number String Function Array Date RegExp Object".split(" ").forEach(function (name) { class2type["[object " + name + "]"] = name.toLowerCase(); });
var isPlainObject = function (obj) { if (!obj || type(obj) !== "object" || obj.nodeType || isWindow(obj)) return false;
try { if (obj.constructor && !Object.prototype.hasOwnProperty.call(obj, "constructor") && !Object.prototype.hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf")) { return false; } } catch (e) { return false; }
var key; for (key in obj) {} return key === undefined || Object.prototype.hasOwnProperty.call(obj, key); };
var isFunction = function (obj) { return type(obj) === "function"; };
var isArray = Array.isArray || function (obj) { return type(obj) === "array"; };
var type = function (obj) { return obj == null ? String(obj) : class2type[Object.prototype.toString.call(obj)] || "object"; };
extend.clone = function () { var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false;
if (typeof target === "boolean") { deep = target; target = arguments[1] || {}; i = 2; }
if (typeof target !== "object" && !isFunction(target)) target = {};
if (length === i) { target = {}; --i; }
for (i ; i < length; i++) { if ((options = arguments[i]) != null) { for (name in options) { src = target[name]; copy = options[name];
if (target === copy) continue;
if (deep && copy && ( isPlainObject(copy) || (copyIsArray = isArray(copy)) )) { if (copyIsArray) { copyIsArray = false; clone = src && isArray(src) ? src : []; } else clone = src && isPlainObject(src) ? src : {};
target[name] = extend.clone(deep, clone, copy);
} else if (copy !== undefined) target[name] = copy; } } }
return target; };
return extend;
})(window.extend || {}, void 0);
|