WXAppUI/Scripts/knockout-2.1.0.js
(开头部分) 53KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
// Knockout JavaScript library v2.1.0
// (c) Steven Sanderson - http://knockoutjs.com/
// License: MIT (http://www.opensource.org/licenses/mit-license.php)
(function (window, document, navigator, undefined) {
function m(w) { throw w; } var n = void 0, p = !0, s = null, t = !1; function A(w) { return function () { return w } }; function E(w) {
function B(b, c, d) { d && c !== a.k.r(b) && a.k.S(b, c); c !== a.k.r(b) && a.a.va(b, "change") } var a = "undefined" !== typeof w ? w : {}; a.b = function (b, c) { for (var d = b.split("."), f = a, g = 0; g < d.length - 1; g++) f = f[d[g]]; f[d[d.length - 1]] = c }; a.B = function (a, c, d) { a[c] = d }; a.version = "2.1.0"; a.b("version", a.version); a.a = new function () {
function b(b, c) { if ("input" !== a.a.o(b) || !b.type || "click" != c.toLowerCase()) return t; var e = b.type; return "checkbox" == e || "radio" == e } var c = /^(\s|\u00A0)+|(\s|\u00A0)+$/g, d = {}, f = {}; d[/Firefox\/2/i.test(navigator.userAgent) ?
"KeyboardEvent" : "UIEvents"] = ["keyup", "keydown", "keypress"]; d.MouseEvents = "click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" "); for (var g in d) { var e = d[g]; if (e.length) for (var h = 0, j = e.length; h < j; h++) f[e[h]] = g } var k = { propertychange: p }, i = function () { for (var a = 3, b = document.createElement("div"), c = b.getElementsByTagName("i") ; b.innerHTML = "<\!--[if gt IE " + ++a + "]><i></i><![endif]--\>", c[0];); return 4 < a ? a : n }(); return {
Ca: ["authenticity_token", /^__RequestVerificationToken(_.*)?$/],
v: function (a, b) { for (var c = 0, e = a.length; c < e; c++) b(a[c]) }, j: function (a, b) { if ("function" == typeof Array.prototype.indexOf) return Array.prototype.indexOf.call(a, b); for (var c = 0, e = a.length; c < e; c++) if (a[c] === b) return c; return -1 }, ab: function (a, b, c) { for (var e = 0, f = a.length; e < f; e++) if (b.call(c, a[e])) return a[e]; return s }, ba: function (b, c) { var e = a.a.j(b, c); 0 <= e && b.splice(e, 1) }, za: function (b) { for (var b = b || [], c = [], e = 0, f = b.length; e < f; e++) 0 > a.a.j(c, b[e]) && c.push(b[e]); return c }, T: function (a, b) {
for (var a = a || [], c = [],
e = 0, f = a.length; e < f; e++) c.push(b(a[e])); return c
}, aa: function (a, b) { for (var a = a || [], c = [], e = 0, f = a.length; e < f; e++) b(a[e]) && c.push(a[e]); return c }, N: function (a, b) { if (b instanceof Array) a.push.apply(a, b); else for (var c = 0, e = b.length; c < e; c++) a.push(b[c]); return a }, extend: function (a, b) { if (b) for (var c in b) b.hasOwnProperty(c) && (a[c] = b[c]); return a }, ga: function (b) { for (; b.firstChild;) a.removeNode(b.firstChild) }, Ab: function (b) {
for (var b = a.a.L(b), c = document.createElement("div"), e = 0, f = b.length; e < f; e++) a.F(b[e]),
c.appendChild(b[e]); return c
}, X: function (b, c) { a.a.ga(b); if (c) for (var e = 0, f = c.length; e < f; e++) b.appendChild(c[e]) }, Na: function (b, c) { var e = b.nodeType ? [b] : b; if (0 < e.length) { for (var f = e[0], d = f.parentNode, g = 0, h = c.length; g < h; g++) d.insertBefore(c[g], f); g = 0; for (h = e.length; g < h; g++) a.removeNode(e[g]) } }, Pa: function (a, b) { 0 <= navigator.userAgent.indexOf("MSIE 6") ? a.setAttribute("selected", b) : a.selected = b }, w: function (a) { return (a || "").replace(c, "") }, Ib: function (b, c) {
for (var e = [], f = (b || "").split(c), g = 0, d = f.length; g <
d; g++) { var h = a.a.w(f[g]); "" !== h && e.push(h) } return e
}, Hb: function (a, b) { a = a || ""; return b.length > a.length ? t : a.substring(0, b.length) === b }, eb: function (a, b) { for (var c = "return (" + a + ")", e = 0; e < b; e++) c = "with(sc[" + e + "]) { " + c + " } "; return new Function("sc", c) }, kb: function (a, b) { if (b.compareDocumentPosition) return 16 == (b.compareDocumentPosition(a) & 16); for (; a != s;) { if (a == b) return p; a = a.parentNode } return t }, fa: function (b) { return a.a.kb(b, b.ownerDocument) }, o: function (a) { return a && a.tagName && a.tagName.toLowerCase() },
n: function (a, c, e) { var f = i && k[c]; if (!f && "undefined" != typeof jQuery) { if (b(a, c)) var g = e, e = function (a, b) { var c = this.checked; b && (this.checked = b.fb !== p); g.call(this, a); this.checked = c }; jQuery(a).bind(c, e) } else !f && "function" == typeof a.addEventListener ? a.addEventListener(c, e, t) : "undefined" != typeof a.attachEvent ? a.attachEvent("on" + c, function (b) { e.call(a, b) }) : m(Error("Browser doesn't support addEventListener or attachEvent")) }, va: function (a, c) {
(!a || !a.nodeType) && m(Error("element must be a DOM node when calling triggerEvent"));
if ("undefined" != typeof jQuery) { var e = []; b(a, c) && e.push({ fb: a.checked }); jQuery(a).trigger(c, e) } else "function" == typeof document.createEvent ? "function" == typeof a.dispatchEvent ? (e = document.createEvent(f[c] || "HTMLEvents"), e.initEvent(c, p, p, window, 0, 0, 0, 0, 0, t, t, t, t, 0, a), a.dispatchEvent(e)) : m(Error("The supplied element doesn't support dispatchEvent")) : "undefined" != typeof a.fireEvent ? (b(a, c) && (a.checked = a.checked !== p), a.fireEvent("on" + c)) : m(Error("Browser doesn't support triggering events"))
}, d: function (b) {
return a.la(b) ?
b() : b
}, Ua: function (b, c, e) { var f = (b.className || "").split(/\s+/), g = 0 <= a.a.j(f, c); if (e && !g) b.className += (f[0] ? " " : "") + c; else if (g && !e) { e = ""; for (g = 0; g < f.length; g++) f[g] != c && (e += f[g] + " "); b.className = a.a.w(e) } }, Qa: function (b, c) { var e = a.a.d(c); if (e === s || e === n) e = ""; "innerText" in b ? b.innerText = e : b.textContent = e; 9 <= i && (b.style.display = b.style.display) }, lb: function (a) { if (9 <= i) { var b = a.style.width; a.style.width = 0; a.style.width = b } }, Eb: function (b, e) { for (var b = a.a.d(b), e = a.a.d(e), c = [], f = b; f <= e; f++) c.push(f); return c },
L: function (a) { for (var b = [], e = 0, c = a.length; e < c; e++) b.push(a[e]); return b }, tb: 6 === i, ub: 7 === i, ja: i, Da: function (b, e) { for (var c = a.a.L(b.getElementsByTagName("input")).concat(a.a.L(b.getElementsByTagName("textarea"))), f = "string" == typeof e ? function (a) { return a.name === e } : function (a) { return e.test(a.name) }, g = [], d = c.length - 1; 0 <= d; d--) f(c[d]) && g.push(c[d]); return g }, Bb: function (b) { return "string" == typeof b && (b = a.a.w(b)) ? window.JSON && window.JSON.parse ? window.JSON.parse(b) : (new Function("return " + b))() : s }, sa: function (b,
e, c) { ("undefined" == typeof JSON || "undefined" == typeof JSON.stringify) && m(Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js")); return JSON.stringify(a.a.d(b), e, c) }, Cb: function (b, e, c) {
var c = c || {}, f = c.params || {}, g = c.includeFields || this.Ca, d = b; if ("object" == typeof b && "form" === a.a.o(b)) for (var d = b.action, h = g.length - 1; 0 <= h; h--) for (var k = a.a.Da(b, g[h]),
j = k.length - 1; 0 <= j; j--) f[k[j].name] = k[j].value; var e = a.a.d(e), i = document.createElement("form"); i.style.display = "none"; i.action = d; i.method = "post"; for (var z in e) b = document.createElement("input"), b.name = z, b.value = a.a.sa(a.a.d(e[z])), i.appendChild(b); for (z in f) b = document.createElement("input"), b.name = z, b.value = f[z], i.appendChild(b); document.body.appendChild(i); c.submitter ? c.submitter(i) : i.submit(); setTimeout(function () { i.parentNode.removeChild(i) }, 0)
}
}
}; a.b("utils", a.a); a.b("utils.arrayForEach", a.a.v);
a.b("utils.arrayFirst", a.a.ab); a.b("utils.arrayFilter", a.a.aa); a.b("utils.arrayGetDistinctValues", a.a.za); a.b("utils.arrayIndexOf", a.a.j); a.b("utils.arrayMap", a.a.T); a.b("utils.arrayPushAll", a.a.N); a.b("utils.arrayRemoveItem", a.a.ba); a.b("utils.extend", a.a.extend); a.b("utils.fieldsIncludedWithJsonPost", a.a.Ca); a.b("utils.getFormFields", a.a.Da); a.b("utils.postJson", a.a.Cb); a.b("utils.parseJson", a.a.Bb); a.b("utils.registerEventHandler", a.a.n); a.b("utils.stringifyJson", a.a.sa); a.b("utils.range", a.a.Eb);
a.b("utils.toggleDomNodeCssClass", a.a.Ua); a.b("utils.triggerEvent", a.a.va); a.b("utils.unwrapObservable", a.a.d); Function.prototype.bind || (Function.prototype.bind = function (a) { var c = this, d = Array.prototype.slice.call(arguments), a = d.shift(); return function () { return c.apply(a, d.concat(Array.prototype.slice.call(arguments))) } }); a.a.f = new function () {
var b = 0, c = "__ko__" + (new Date).getTime(), d = {}; return {
get: function (b, c) { var e = a.a.f.getAll(b, t); return e === n ? n : e[c] }, set: function (b, c, e) {
e === n && a.a.f.getAll(b,
t) === n || (a.a.f.getAll(b, p)[c] = e)
}, getAll: function (a, g) { var e = a[c]; if (!(e && "null" !== e)) { if (!g) return; e = a[c] = "ko" + b++; d[e] = {} } return d[e] }, clear: function (a) { var b = a[c]; b && (delete d[b], a[c] = s) }
}
}; a.b("utils.domData", a.a.f); a.b("utils.domData.clear", a.a.f.clear); a.a.G = new function () {
function b(b, c) { var f = a.a.f.get(b, d); f === n && c && (f = [], a.a.f.set(b, d, f)); return f } function c(e) {
var f = b(e, t); if (f) for (var f = f.slice(0), d = 0; d < f.length; d++) f[d](e); a.a.f.clear(e); "function" == typeof jQuery && "function" == typeof jQuery.cleanData &&
jQuery.cleanData([e]); if (g[e.nodeType]) for (f = e.firstChild; e = f;) f = e.nextSibling, 8 === e.nodeType && c(e)
} var d = "__ko_domNodeDisposal__" + (new Date).getTime(), f = { 1: p, 8: p, 9: p }, g = { 1: p, 9: p }; return {
wa: function (a, c) { "function" != typeof c && m(Error("Callback must be a function")); b(a, p).push(c) }, Ma: function (c, f) { var g = b(c, t); g && (a.a.ba(g, f), 0 == g.length && a.a.f.set(c, d, n)) }, F: function (b) { if (f[b.nodeType] && (c(b), g[b.nodeType])) { var d = []; a.a.N(d, b.getElementsByTagName("*")); for (var b = 0, j = d.length; b < j; b++) c(d[b]) } },
removeNode: function (b) { a.F(b); b.parentNode && b.parentNode.removeChild(b) }
}
}; a.F = a.a.G.F; a.removeNode = a.a.G.removeNode; a.b("cleanNode", a.F); a.b("removeNode", a.removeNode); a.b("utils.domNodeDisposal", a.a.G); a.b("utils.domNodeDisposal.addDisposeCallback", a.a.G.wa); a.b("utils.domNodeDisposal.removeDisposeCallback", a.a.G.Ma); (function () {
a.a.pa = function (b) {
var c; if ("undefined" != typeof jQuery) {
if ((c = jQuery.clean([b])) && c[0]) {
for (b = c[0]; b.parentNode && 11 !== b.parentNode.nodeType;) b = b.parentNode; b.parentNode &&
b.parentNode.removeChild(b)
}
} else { var d = a.a.w(b).toLowerCase(); c = document.createElement("div"); d = d.match(/^<(thead|tbody|tfoot)/) && [1, "<table>", "</table>"] || !d.indexOf("<tr") && [2, "<table><tbody>", "</tbody></table>"] || (!d.indexOf("<td") || !d.indexOf("<th")) && [3, "<table><tbody><tr>", "</tr></tbody></table>"] || [0, "", ""]; b = "ignored<div>" + d[1] + b + d[2] + "</div>"; for ("function" == typeof window.innerShiv ? c.appendChild(window.innerShiv(b)) : c.innerHTML = b; d[0]--;) c = c.lastChild; c = a.a.L(c.lastChild.childNodes) } return c
};
a.a.Y = function (b, c) { a.a.ga(b); if (c !== s && c !== n) if ("string" != typeof c && (c = c.toString()), "undefined" != typeof jQuery) jQuery(b).html(c); else for (var d = a.a.pa(c), f = 0; f < d.length; f++) b.appendChild(d[f]) }
后面还有 288 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。