-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.min.js
1 lines (1 loc) · 1.1 KB
/
index.min.js
1
function formatDateTime(t){const e=new Date(t),o=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),i=String(e.getDate()).padStart(2,"0"),a=String(e.getHours()).padStart(2,"0"),c=String(e.getMinutes()).padStart(2,"0"),s=String(e.getSeconds()).padStart(2,"0");return`${o}-${n}-${i} ${a}:${c}:${s}`}const plugin=(t,e)=>{const o=e.config.repo,n=e.config.lastModifiedBranch||"main";t.beforeEach(t=>{const{file:i,path:a}=e.route;let c=e.config.lastModifiedText||"";"object"==typeof c&&Object.keys(c).some(t=>{const e=a&&a.indexOf(t)>-1;return c=e?c[t]:c,e});const s=`https://api.github.com/repos/${o}/commits?path=${i}`;return fetch(s,{method:"GET"}).then(t=>t.json()).then(t=>{const e=t[0].commit.committer.date,a=`https://github.com/${o}/commits/${n}/${i}`,s=formatDateTime(e),r=`\n <blockquote>\n <a href="${a}" target="_blank" style="color: #858585">${c+s}</a>\n </blockquote>\n `;document.getElementById("last-modified").innerHTML=r}),t+'<span id="last-modified"></span>'})};window.$docsify=window.$docsify||{},window.$docsify.plugins=(window.$docsify.plugins||[]).concat(plugin);