From cb050605e16263b109261ebb7ab05a90393560fc Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Fri, 22 Sep 2023 14:24:41 +0800 Subject: [PATCH 1/4] chore: use lastModified cdn --- index.html | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/index.html b/index.html index 82bcbfb7edddb..60a348e138256 100644 --- a/index.html +++ b/index.html @@ -43,6 +43,7 @@ window.$docsify = { name: 'leetcode', repo: 'doocs/leetcode', + lastModifiedText: isEn() ? 'Last updated: ' : '最近更新时间:', logo: '/images/doocs-leetcode.png', search: { depth: 2, @@ -128,41 +129,11 @@ return html + footer }) }, - (hook, vm) => { - hook.beforeEach((html) => { - function formatDateTime(dateTimeString) { - const date = new Date(dateTimeString); - const year = date.getFullYear(); - const month = String(date.getMonth() + 1).padStart(2, '0'); - const day = String(date.getDate()).padStart(2, '0'); - const hours = String(date.getHours()).padStart(2, '0'); - const minutes = String(date.getMinutes()).padStart(2, '0'); - const seconds = String(date.getSeconds()).padStart(2, '0'); - return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; - } - const { file } = vm.route - const apiUrl = `https://api.github.com/repos/${$docsify.repo}/commits?path=${file}`; - fetch(apiUrl, { method: 'GET' }).then(response => response.json()) - .then(data => { - const date = data[0].commit.committer.date - const commitUrl = `https://github.com/${$docsify.repo}/commits/main/${file}` - const lastModified = formatDateTime(date) - const prompt = isEn() ? 'Last updated: ' : '最近更新时间:' - const lastModifiedContent = ` -
- ${prompt + lastModified} -- ` - document.getElementById('last-modified').innerHTML = lastModifiedContent - }) - return ( - html + '' - ); - }); - }, ] } + From 4f012294ce246b8ca7ab1f5e1be5a33e0a8d69bf Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Fri, 22 Sep 2023 14:52:54 +0800 Subject: [PATCH 2/4] feat: update url --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 60a348e138256..1b28d994ff006 100644 --- a/index.html +++ b/index.html @@ -133,7 +133,7 @@ } +https://last-modified.oss-cn-beijing.aliyuncs.com/index.js?Expires=1695365805&OSSAccessKeyId=TMP.3KebgFkZXEVJsuUGgvn8J2ws7ZANDAz3eoAiiTsDdFxXPL5NS4QnXcpW4tKeNnAzDJ3k4PuVYrVVmNM9TZ9dLHVV5UZT9e&Signature=Pg%2Fa2Sz78PW4aEDtmlIgjtuMESc%3D"> From 289900c016fe13d88df804b21d5558ab21471c15 Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Fri, 22 Sep 2023 15:44:40 +0800 Subject: [PATCH 3/4] fix: replace url --- index.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.html b/index.html index 1b28d994ff006..0e50ce69bfc87 100644 --- a/index.html +++ b/index.html @@ -132,8 +132,7 @@ ] } - + From 18e6405af6c26551d1959514a84bdd5b32709bd6 Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Fri, 22 Sep 2023 16:09:17 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat:=20=E6=B3=A8=E9=87=8Ascript=20cdn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 0e50ce69bfc87..9e786d6624b11 100644 --- a/index.html +++ b/index.html @@ -132,8 +132,8 @@ ] } - + @@ -150,8 +150,10 @@ + +