mirror of
https://github.com/Vonng/ddia.git
synced 2024-12-06 15:20:12 +08:00
2 lines
106 KiB
JavaScript
2 lines
106 KiB
JavaScript
|
!function(){function s(n){var r=Object.create(null);return function(e){var t=c(e)?e:JSON.stringify(e);return r[t]||(r[t]=n(e))}}var o=s(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),l=Object.prototype.hasOwnProperty,y=Object.assign||function(e){for(var t=arguments,n=1;n<arguments.length;n++){var r,i=Object(t[n]);for(r in i)l.call(i,r)&&(e[r]=i[r])}return e};function c(e){return"string"==typeof e||"number"==typeof e}function u(){}function r(e){return"function"==typeof e}function p(e){e=e.match(/^([^:/?#]+:)?(?:\/{2,}([^/?#]*))?([^?#]+)?(\?[^#]*)?(#.*)?/);return"string"==typeof e[1]&&0<e[1].length&&e[1].toLowerCase()!==location.protocol||"string"==typeof e[2]&&0<e[2].length&&e[2].replace(new RegExp(":("+{"http:":80,"https:":443}[location.protocol]+")?$"),"")!==location.host}var h=document.body.clientWidth<=600,i=window.history&&window.history.pushState&&window.history.replaceState&&!navigator.userAgent.match(/((iPod|iPhone|iPad).+\bOS\s+[1-4]\D|WebApps\/.+CFNetwork)/),n={};function d(e,t){if(void 0===t&&(t=!1),"string"==typeof e){if(void 0!==window.Vue)return b(e);e=t?b(e):n[e]||(n[e]=b(e))}return e}var f=document,g=f.body,m=f.head;function b(e,t){return t?e.querySelector(t):f.querySelector(e)}function k(e,t){return[].slice.call(t?e.querySelectorAll(t):f.querySelectorAll(e))}function v(e,t){return e=f.createElement(e),t&&(e.innerHTML=t),e}function a(e,t){return e.appendChild(t)}function w(e,t){return e.insertBefore(t,e.children[0])}function x(e,t,n){r(t)?window.addEventListener(e,t):e.addEventListener(t,n)}function _(e,t,n){r(t)?window.removeEventListener(e,t):e.removeEventListener(t,n)}function S(e,t,n){e&&e.classList[n?t:"toggle"](n||t)}function e(e,t){void 0===t&&(t=document);var n=t.readyState;if("complete"===n||"interactive"===n)return setTimeout(e,0);t.addEventListener("DOMContentLoaded",e)}var t=Object.freeze({__proto__:null,getNode:d,$:f,body:g,head:m,find:b,findAll:k,create:v,appendTo:a,before:w,on:x,off:_,toggleClass:S,style:function(e){a(m,v("style",e))},documentReady:e}),A=decodeURIComponent,T=encodeURIComponent;function E(e){var t={};return(e=e.trim().replace(/^(\?|#|&)/,""))&&e.split("&").forEach(function(e){e=e.replace(/\+/g," ").split("=");t[e[0]]=e[1]&&A(e[1])}),t}function R(e,t){void 0===t&&(t=[]);var n,r=[];for(n in e)-1<t.indexOf(n)||r.push(e[n]?(T(n)+"="+T(e[n])).toLowerCase():T(n));return r.length?"?"+r.join("&"):""}var O=s(function(e){return/(:|(\/{2}))/g.test(e)}),$=s(function(e){return e.split(/[?#]/)[0]}),F=s(function(e){if(/\/$/g.test(e))return e;e=e.match(/(\S*\/)[^/]+$/);return e?e[1]:""}),C=s(function(e){return e.replace(/^\/+/,"/").replace(/([^:])\/{2,}/g,"$1/")}),L=s(function(e){for(var t=e.replace(/^\//,"").split("/"),n=[],r=0,i=t.length;r<i;r++){var o=t[r];".."===o?n.pop():"."!==o&&n.push(o)}return"/"+n.join("/")});function z(e){return e.split("/").filter(function(e){return-1===e.indexOf("#")}).join("/")}function N(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];return C(e.map(z).join("/"))}var M=s(function(e){return e.replace("#","?id=")});function D(e,t){return-1!==e.indexOf(t,e.length-t.length)}var P={};var I=function(e){this.config=e};function j(e){var t=location.href.indexOf("#");location.replace(location.href.slice(0,0<=t?t:0)+"#"+e)}I.prototype.getBasePath=function(){return this.config.basePath},I.prototype.getFile=function(e,t){void 0===e&&(e=this.getCurrentPath());var n,r,i=this.config,o=this.getBasePath(),a="string"==typeof i.ext?i.ext:".md";return e=i.alias?function e(t,n,r){var i=Object.keys(n).filter(function(e){return(P[e]||(P[e]=new RegExp("^"+e+"$"))).test(t)&&t!==r})[0];return i?e(t.replace(P[i],n[i]),n,t):t}(e,i.alias):e,n=e,r=a,e=(e=new RegExp("\\.("+r.replace(/^\./,"")+"|html)$","g").test(n)?n:/\/$/g.test(n)?n+"README"+r:""+n+r)==="/README"+a&&i.homepage||e,e=O(e)?e:N(o,e),t&&(e=e.replace(new RegExp("^"+o),"")),e},I.prototype.onchange=function(e){void 0===e&&(e=u),e()},I.prototype.getCurrentPath=function(){},I.prototype.normalize=function(){},I.prototype.parse=function(){},I.prototype.toURL=function(e,t,n){var r=n&&"#"===e[0
|