UNPKG

ydoc

Version:

基于 Markdown 的静态站点生成工具

6 lines 18.8 kB
/*! * DollarJS 2.0.0 -- a light, fast, modular, jQuery replacement * Github: https://github.com/seebigs/dollar-js * Released under the MIT license: https://opensource.org/licenses/MIT */ (function () { function t() { var t, n, e, i = M(); return B.each(W.call(arguments), function (r) { if (r) for (t = 0, n = r.length; t < n; t++)e = r[t], -1 === i.indexOf(e) && i.push(e) }), i } function n(t, n) { if (n) { var e = u(n), i = []; return B.each(e, function (n) { B.each(t, function (t) { typeof n.contains === $ && n.contains(t) && i.push(t) }) }), i } return t } function e(t, e) { function r() { var t = R.readyState; return "interactive" === t || "complete" === t } if (typeof t === H) return i(t, e); if (t.isDollar) return n(t.get(), e); if (t.nodeType) return n([t], e); if (t === t.window) return [t]; if (t.length) { for (var o, f = [], s = 0, u = t.length; s < u; s++)o = t[s], B.isElement(o) && f.push(o); return n(f, e) } return typeof t === $ && (r() ? t() : I.addEventListener ? R.addEventListener("DOMContentLoaded", t, !1) : R.attachEvent("onreadystatechange", function () { r() && t() })), [] } function i(t, n) { if (n) { var e = []; if (n = u(n), n.length > 1) { for (var r = 0, o = n.length; r < o; r++)B.merge(e, i(t, n[r])); return e } n = n[0] } else n = U; if (!n) return []; var f = /^\s*(?:#([\w-]+)|(\w+)|\.([\w-]+)|(<[\w\W]+>)[^>]*)\s*$/.exec(t); if (f) { if (t = f[1]) { var a = R.getElementById(t); return a && n !== a && n.contains(a) ? [a] : [] } if (t = f[2]) return n.getElementsByTagName(t); if (t = f[3]) return n.getElementsByClassName(t); if (t = f[4]) return [s(t)] } else { var l = /(.*)\:(.+)/.exec(t); if (l) { var c = l[1] || "*", h = l[2].split("("), p = _[h[0]]; if (p) return p(c, n, h) } } return W.call(n.querySelectorAll(t)) } function r(t) { var n = i(t); return -1 !== P.indexOf.call(n, this) } function o(t, n, e) { return !(!n || !t || 1 !== t.nodeType) && (typeof n !== H ? n.nodeType ? t === n : typeof n === $ ? !!n.call(t, t, e) : !!n.length && -1 !== n.indexOf(t) : G.call(t, n)) } function f(t, n) { for (var e = [], i = 0, r = t.length; i < r; i++)o(t[i], n, i) && e.push(t[i]); return e } function s(t) { var n = /^<(\w+)\s*\/?>(?:<\/\1>|)$/.exec(t); if (n) return R.createElement(n[1]); var e = R.createElement("div"); return e.innerHTML = t, e.childNodes[0] } function u(t) { return typeof t === H ? i(t) : t.isDollar ? t.get() : 1 === t.nodeType || 9 === t.nodeType ? [t] : Array.isArray(t) ? t : [U] } function a(t) { var n = t && t.nodeType; return n && 3 !== n && 8 !== n && 2 !== n } function l(t) { return 9 === t.nodeType && (t = t.documentElement), a(t) ? t : q } function c(t, n) { if (t) return t === t.window ? t[n] : (t = l(t), t && t.hasAttribute(n) ? t.getAttribute(n) : q) } function h(t, n, e) { return t === t.window && (t[n] = e), (t = l(t)) && t.setAttribute(n, e) } function p(t, n) { return t === t.window && (t[n] = q), (t = l(t)) && t.removeAttribute(n) } function d(t) { return Number(c(t, J)) || q } function v(t, n) { return h(t, J, n) } function y(t, n, e) { var i = d(n); if (i) return e ? t[i] && t[i][e] : t[i] } function m(t, n, e, i) { var r = d(n); r || (r = K, v(n, r), K++), t[r] || (t[r] = {}), t[r][e] = i } function g(t, n, e, i) { var r = y(t, n, e) || []; r.push(i), m(t, n, e, r) } function b(t, n, e) { var i = n + " " + C(e), r = t.style.transition ? t.style.transition.split(/,\s?/) : [], o = !1; return r.forEach(function (t, e) { 0 === t.indexOf(n + " ") && (r[e] = i, o = !0) }), o || r.push(i), r.join(", ") } function E(t, n) { var e = t.style.transition.split(/,\s?/), i = []; return e.forEach(function (t) { 0 !== t.indexOf(n + " ") && i.push(t) }), i.join(", ") } function C(t) { var n = []; return n.push(typeof t.duration === H ? t.duration : (parseInt(t.duration) || 400) + "ms"), n.push(t.easing || "ease"), n.push(typeof t.delay === H ? t.delay : (parseInt(t.delay) || 0) + "ms"), n.join(" ") } function T(t, n) { function e(t) { u.appendChild(t), o = !0 } t = [].concat.apply([], t); var i, r, o, f, u, a, l = t.length, c = this.length; for (r = 0; r < c; r++) { for (o = !1, u = R.createDocumentFragment(), i = 0; i < l; i++)(f = t[i]) && (typeof f === H ? (a = s(f)) && e(a) : 1 === f.nodeType ? e(f) : f.isDollar ? f.each(e) : typeof f === $ && (a = f(this[r], r), typeof a === H && (a = s(a)), a && e(a))); o && n(this[r], u) } return this } function w(t) { return t && t.dataset || function () { var n, e = {}, i = t.attributes, r = /^data-[a-z_\-\d]*$/i; for (var o in i) i.hasOwnProperty(o) && (n = i[o].name, r.test(n) && (n = B.format.dashToCamel(n.substr(5)), e[n] = i[o].value)); return e }() } function N(t, n) { return a(t) ? t[n] : q } function x(t, n) { return t && typeof n === H ? t.ownerDocument.defaultView.opener ? t.ownerDocument.defaultView.getComputedStyle(t, null)[n] || "" : k.getComputedStyle(t, null)[n] || t.style[n] || "" : "" } function O(t, n) { var e; return n = typeof n === H ? n : "", t ? (e = "float" === n ? "styleFloat" : B.format.dashToCamel(n.replace(/^-ms-/, "ms-")), t.currentStyle[e]) : "" } function S(t) { var n = t.style.display; if (n && "none" !== n || (n = y(X, t, "nonHiddenDisplayValue") || ""), !n && t.parentNode) { var e = R.createElement(t.nodeName); t.parentNode.appendChild(e), n = Y(e, "display"), t.parentNode.removeChild(e), m(X, t, "nonHiddenDisplayValue", n) } return n } function A(t, n) { if (typeof t !== H || typeof n !== $) return this; t = t.split(" "); var e, i, r; return this.each(function () { for (e = this.addEventListener || this.attachEvent, i = 0, r = t.length; i < r; i++)e.call(this, t[i], n, !1), g(X, this, tt, n) }), this } function D(t, n) { if (typeof t !== H) return this; t = t.split(" "); var e, i, r, o, f; return this.each(function () { for (e = 0, i = t.length; e < i; e++)for (r = typeof n === $ ? [n] : y(X, this, tt) || [], o = 0, f = r.length; o < f; o++)this.removeEventListener ? this.removeEventListener(t[e], r[o], !1) : this.detachEvent(t[e], r[o], !1) }), this } function j(t, n, e) { var i, r = { bubbles: !0, cancelable: !0 }; e && e.length && (r.detail = e), B.each(n, function (n) { B.each(t, function (t) { "click" === n ? t.click() : "focus" === n ? t.focus() : "blur" === n ? t.blur() : (i = new k.CustomEvent(n, r), t.dispatchEvent(i)) }) }) } function L(t, n) { return typeof n === $ ? A.call(this, t, n) : (j(this, t.split(" ")), this) } var q, B, M = function (t, n) { return new M.fn.init(t, n) }, H = "string", $ = "function", k = window, I = k.Element.prototype, z = Object.prototype, V = z.toString, F = z.hasOwnProperty, P = Array.prototype, W = P.slice, R = document, U = document.documentElement, Z = /[\s\t\r\n\f]+/g; M.isDollar = !0, M.fn = { isDollar: !0, indexOf: P.indexOf, push: P.push, pop: P.pop, shift: P.shift, unshift: P.unshift, slice: P.slice, splice: P.splice }, M.fn.init = function (t, n) { if (this.length = 0, !t) return this; if (!n) { if (/^#[\w-]+$/.test(t)) { var i = R.getElementById(t.substr(1)); return i && (this[0] = i, this.length = 1), this } if (/^[a-z]+$/.test(t)) { for (var r = R.getElementsByTagName(t), o = r.length, f = 0; f < o; f++)this[f] = r[f]; return this.length = o, this } } return B.merge(this, e(t, n)) }, M.fn.init.prototype = M.fn; var _ = { contains: function (t, n, e) { var r = e[1] && e[1].replace(/[\"\'\)]/g, ""); return r ? f(i(t, n), function (t) { return -1 !== (t.textContent || t.innerText).indexOf(r) }) : [] }, hidden: function (t, n) { return f(i(t, n), function (t) { return 1 === t.nodeType && !(t.offsetWidth || t.offsetHeight || t.getClientRects().length) }) }, visible: function (t, n) { return f(i(t, n), function (t) { return 1 === t.nodeType && !!(t.offsetWidth || t.offsetHeight || t.getClientRects().length) }) }, even: function (t, n) { return W.call(n.querySelectorAll(t + ":nth-child(even)")) }, odd: function (t, n) { return W.call(n.querySelectorAll(t + ":nth-child(odd)")) }, has: function (t, n, i) { var r = typeof i[1] === H && i[1].replace(")", ""); return r ? f(e(t, n), function (t) { return 1 === t.nodeType && !!e(r, t).length }) : [] }, not: function (t, n, e) { n === U && (n = R); var r = t; "*" !== t && " " === t[t.length - 1] && (r = t + "*"); var o = e[1].split(")"), f = o[1], s = (o[0] || "").split(","); f && (r += f); var u = [], a = i(r, n); return B.each(a, function (t) { var n = !0; B.each(s, function (e) { if (G.call(t, e)) return n = !1, !1 }), n && u.push(t) }), u } }, G = I.matches || I.webkitMatchesSelector || I.mozMatchesSelector || I.msMatchesSelector || I.oMatchesSelector || r, J = "dollar-node-id", K = 1, Q = {}, X = {}; M.utils = B = function () { function t(t) { return !!t && (1 === t.nodeType || 9 === t.nodeType) } function n(t) { return V.call(t) === o + "Object]" } function e(t, n) { if (t) if (t.length !== q) { for (var e = 0, i = t.length; e < i; e++)if (!1 === n.call(t[e], t[e], e, t)) return } else for (var r in t) if (F.call(t, r) && !1 === n.call(t[r], t[r], r, t)) return } function i() { var t = arguments[0], n = function (n, e) { n !== q && (t[e] = n) }; return e(W.call(arguments, 1), function (t) { e(t, n) }), t } function r() { var t, n, i = arguments[0]; return e(W.call(arguments, 1), function (e) { if (e) for (t = 0, n = e.length; t < n; t++)-1 === i.indexOf(e[t]) && i.push(e[t]) }), i } var o = "[object "; return { isElement: t, isObject: n, each: e, extend: i, merge: r, format: { camelToDash: function (t) { return t.replace(/([A-Z])/g, "-$1").toLowerCase() }, dashToCamel: function (t) { return t.replace(/\-(.)/g, function (t, n) { return n.charAt(0).toUpperCase() }) } } } }(), M.fn.closest = function (n, i) { if (!n) return M(); for (var r, o = e(n, i), f = [], s = 0, u = this.length; s < u; s++)for (r = this[s]; r && r !== i;) { if (-1 !== P.indexOf.call(o, r)) { f.push(r); break } r = r.parentNode } return t(f) }, M.fn.each = M.fn.forEach = function (t) { return B.each(this, t), this }, M.fn.eq = function (t) { return t = Array.isArray(t) ? NaN : parseInt(t, 10), M(t >= 0 ? this[t] : this[this.length + t]) }, M.fn.filter = function (n) { return this.length && n ? t(f(this, n)) : M() }, M.fn.find = function (n) { return n && this.length ? t(e(n, this)) : M() }, M.fn.get = function (t) { return t === q ? W.call(this, 0) : t < 0 ? this[t + this.length] : this[t] }, M.fn.reverse = P.reverse, M.fn.animate = function (t, n, e) { B.isObject(n) || (n = { duration: n }); var i = "transitionend"; return this.each(function (r, o) { B.each(t, function (t, f) { r.style.transition = b(r, f, n), r.style[f] = t; var s = function (t) { r.removeEventListener(i, s, !0), r.style.transition = E(r, t), typeof e === $ && e.call(r, r, o) }; r.addEventListener(i, s, !0) }) }), this }, M.fn.fadeIn = function (t, n) { return this.animate({ opacity: 1 }, t, n) }, M.fn.fadeOut = function (t, n) { return this.animate({ opacity: 0 }, t, n) }, M.fn.add = function (n, e) { return n ? t(this, M(n, e)) : this }, M.fn.concat = function () { var n = W.call(arguments); return n.unshift(this), t.apply(this, n) }, M.fn.has = function (t) { return t ? this.filter(function () { return !!e(t, this).length }) : M() }, M.fn.is = function (t) { return !(!t || !this.filter(t).length) }, M.fn.map = function (n) { if (typeof n !== $) return this; for (var e, i = [], r = 0, o = this.length; r < o; r++) { if (e = n.call(this[r], this[r], r, this), !B.isElement(e)) throw new Error(".map fn should return an Element, not " + typeof e); i.push(e) } return t.call(this, i) }, M.fn.not = function (n) { if (!n) return this; var e; return e = typeof n === $ ? function (t, e) { return !n.call(t, e, t) } : function (t, e) { return !o(t, n, e) }, t(this.filter(e)) }, M.fn.after = function () { return T.call(this, arguments, function (t, n) { var e = t.parentNode; e && (t.nextSibling ? e.insertBefore(n, t.nextSibling) : e.appendChild(n)) }) }, M.fn.append = function () { return T.call(this, arguments, function (t, n) { t.appendChild(n) }) }, M.fn.before = function () { return T.call(this, arguments, function (t, n) { t.parentNode && t.parentNode.insertBefore(n, t) }) }, M.fn.clone = function () { var t, n, e = this.length; for (n = 0; n < e; n++)t = this[n], 1 !== t.nodeType && 11 !== t.nodeType || (this[n] = t.cloneNode(!0)); return this }, M.fn.empty = function () { var t, n, e = this.length; for (n = 0; n < e; n++)t = this[n], 1 === t.nodeType && (t.textContent = ""); return this }, M.fn.html = function (t) { var n, e, i = this.length, r = this[0]; if (t === q) return r && 1 === r.nodeType ? r.innerHTML : q; try { for (e = 0; e < i; e++)n = this[e], 1 === n.nodeType && (n.innerHTML = t) } catch (n) { this.empty().append(t) } return this }, M.fn.prepend = function () { return T.call(this, arguments, function (t, n) { t.firstChild ? t.insertBefore(n, t.firstChild) : t.appendChild(n) }) }, M.fn.remove = function (t) { var n, e, i = this.length; if (t === q) for (e = 0; e < i; e++)n = this[e], n.parentNode && n.parentNode.removeChild(n); else for (e = 0; e < i; e++)n = this[e], o(n, t, e) && n.parentNode && n.parentNode.removeChild(n); return this }, M.fn.attr = function (t, n) { return n === q ? c(this[0], t) : (this.each(function (e, i) { a(e) && (typeof n === $ && (n = n(c(e, t), i)), e.setAttribute(t, n)) }), this) }, M.fn.data = function (t, n) { function e(t, n) { m(Q, i, n, t) } if (!this.length) return q; var i, r = {}; if (!t) return B.extend({}, w(this[0]), y(Q, this[0])); if (typeof t === H) { if (n === q) { var o = y(Q, this[0], t); return o === q ? w(this[0])[t] : o } r[t] = n } else B.isObject(t) && (r = t); for (var f = 0, s = this.length; f < s; f++)i = this[f], B.each(r, e); return this }, M.fn.prop = function (t, n) { return n === q ? N(this[0], t) : (this.each(function (e, i) { a(e) && (typeof n === $ && (n = n(N(e, t), i)), e[t] = n) }), this) }, M.fn.removeAttr = function (t) { return this.each(function () { this.removeAttribute(t) }), this }, M.fn.removeData = function (t) { for (var n, e, i = 0, r = this.length; i < r; i++)n = this[i], e = d(n), t ? (e && delete Q[e][t], n && (n.dataset ? n.dataset[t] && delete n.dataset[t] : p(n, "data-" + B.format.camelToDash(t)))) : Q[e] = {}; return this }, M.fn.removeProp = function (t) { return this.each(function () { a(this) && delete this[t] }), this }, M.fn.text = function (t) { if (t !== q) return this.each(function (n, e) { 1 !== n.nodeType && 11 !== n.nodeType && 9 !== n.nodeType || (n.textContent = typeof t === $ ? t(n.textContent, e) : t) }), this; var n = ""; return this.each(function (t) { var e = t.nodeType; 1 === e || 9 === e || 11 === e ? typeof t.textContent === H && (n += t.textContent) : 3 !== e && 4 !== e || (n += t.nodeValue) }), n }, M.fn.val = function (t) { if (t === q) return this[0] ? this[0].value : q; for (var n = 0; n < this.length && 1 === this[n].nodeType; n++)typeof t === $ && (t = t.call(this[n], this[n].value, n)), this[n].value = t; return this }; var Y = k.getComputedStyle !== q ? x : O; M.fn.addClass = function (t) { if (!t) return this; var n, e, i, r = this.length; if (typeof t === H) for (n = t.trim().split(" "), i = 0; i < r; i++)e = this[i].className.trim().replace(Z, " ").split(" "), this[i].className = B.merge([], e, n).join(" "); else if (typeof t === $) for (i = 0; i < r; i++)n = t.call(this[i], this[i].className, i).split(" "), e = this[i].className.trim().replace(Z, " ").split(" "), this[i].className = B.merge([], e, n).join(" "); return this }, M.fn.css = function (t, n) { function e(t, n) { r.style[n] = typeof t === $ ? t.call(r, Y(r, n), i) : t } if (!t) return this; var i, r, o = this.length, f = {}; if (typeof t === H) { if (n === q) return Y(this[0], t); f[t] = n } else B.isObject(t) && (f = t); for (i = 0; i < o; i++)r = this[i], B.each(f, e); return this }, M.fn.hasClass = function (t) { if (!t) return !1; t = " " + t.trim() + " "; for (var n = 0, e = this.length; n < e; n++)if (1 === this[n].nodeType && -1 !== (" " + this[n].className + " ").replace(Z, " ").indexOf(t)) return !0; return !1 }, M.fn.height = function () { return parseFloat(this.eq(0).css("height")) || 0 }, M.fn.hide = function () { return this.each(function () { this.style.display = "none" }), this }, M.fn.removeClass = function (t) { function n(t) { -1 === o.indexOf(t) && i.push(t) } for (var e, i, r, o, f = 0, s = this.length; f < s; f++)e = this[f], i = [], t ? (o = typeof t === $ ? t.call(e, e.className, f) : t, o.length && (o = typeof o === H ? o.trim().split(" ") : o, r = e.className.replace(Z, " ").split(" "), B.each(r, n), e.className = i.join(" "))) : e.className = ""; return this }, M.fn.show = function () { return this.each(function () { this.style.display = S(this), this.style.visibility = "visible", this.style.opacity = 1 }), this }, M.fn.width = function () { return parseFloat(this.eq(0).css("width")) || 0 }, M.fn.children = function (n) { for (var e = [], i = 0, r = this.length; i < r; i++)B.merge(e, this[i].children); return t(n ? M.fn.filter.call(e, n) : e) }, M.fn.first = function () { return this.eq(0) }, M.fn.last = function () { return this.eq(-1) }, M.fn.next = function (n) { for (var e, i = [], r = 0, o = this.length; r < o; r++)(e = this[r].nextElementSibling) && i.push(e); return t(n ? M.fn.filter.call(i, n) : i) }, M.fn.parent = function (n) { for (var e, i = [], r = 0, o = this.length; r < o; r++)(e = this[r].parentNode) && i.push(e); return t(n ? M.fn.filter.call(i, n) : i) }, M.fn.prev = function (n) { for (var e, i = [], r = 0, o = this.length; r < o; r++)(e = this[r].previousElementSibling) && i.push(e); return t(n ? M.fn.filter.call(i, n) : i) }, M.fn.siblings = function (n) { for (var e, i = [], r = 0, o = this.length; r < o; r++)for (this[r].parentNode && (e = this[r].parentNode.firstChild); e;)e !== this[r] && 1 === e.nodeType && i.push(e), e = e.nextSibling; return t(n ? M.fn.filter.call(i, n) : i) }; var tt = "activeEventListeners"; M.fn.click = function (t) { return L.call(this, "click", t) }, M.fn.focus = function (t) { return L.call(this, "focus", t) }, M.fn.blur = function (t) { return L.call(this, "blur", t) }, M.fn.change = function (t) { return L.call(this, "change", t) }, M.fn.resize = function (t) { return L.call(this, "resize", t) }, M.fn.off = M.fn.unbind = D, M.fn.on = M.fn.bind = A, M.fn.trigger = function (t) { return typeof t !== H ? this : (t = t.split(" "), j(this, t, W.call(arguments, 1)), this) }, function (t) { function n(t, n) { n = n || { bubbles: !1, cancelable: !1 }; var e = document.createEvent("CustomEvent"); return e.initCustomEvent(t, n.bubbles, n.cancelable, n.detail), e } typeof t.CustomEvent !== $ && (n.prototype = t.Event.prototype, t.CustomEvent = n) }(k), function () { var t = window; "undefined" != typeof module && module.exports ? module.exports = M : typeof t.define === $ && t.define.amd ? t.define(function () { return M }) : t.$ = M }.call(this) }).call(this);