initial commit
[CPE_learningsite] / CPE / CPE.App / CPE.App.Web / static / js / jquery.dictionary-1.2.js
1 (function (b) { if (b.isFunction(String.prototype.format) === false) { String.prototype.format = function () { var d = this; var c = arguments.length; while (c--) { d = d.replace(new RegExp("\\{" + c + "\\}", "gim"), arguments[c]) } return d } } if (b.isFunction(Date.prototype.toISOString) === false) { Date.prototype.toISOString = function () { var c = function (g, d) { g = g.toString(); for (var f = g.length; f < d; f++) { g = "0" + g } return g }; var e = this; return "{0}-{1}-{2}T{3}:{4}:{5}.{6}Z".format(e.getUTCFullYear(), c(e.getUTCMonth() + 1, 2), c(e.getUTCDate(), 2), c(e.getUTCHours(), 2), c(e.getUTCMinutes(), 2), c(e.getUTCSeconds(), 2), c(e.getUTCMilliseconds(), 3)) } } var a = function (d, c, f, e) { if (b.isPlainObject(d)) { for (var g in d) { if (e === true || typeof (d[g]) !== "undefined" && d[g] !== null) { a(d[g], c, f.length> 0 ? f + "." + g : g, e) } } } else { if (b.isArray(d)) { b.each(d, function (i, j) { a(j, c, "{0}[{1}]".format(f, i)) }); return } if (!b.isFunction(d)) { if (d instanceof Date) { c.push({ name: f, value: d.toISOString() }) } else { var h = typeof (d); switch (h) { case "boolean": case "number": h = d; break; case "object": if (e !== true) { return } default: h = d || "" } c.push({ name: f, value: h }) } } } }; b.extend({ toDictionary: function (f, e, d) { f = b.isFunction(f) ? f.call() : f; if (arguments.length === 2 && typeof (e) === "boolean") { d = e; e = "" } d = typeof (d) === "boolean" ? d : false; var c = []; a(f, c, e || "", d); return c } }) })(jQuery);