From 8cb4dae1525cbfe479b06f58ec08358230882682 Mon Sep 17 00:00:00 2001 From: wizardforcel <562826179@qq.com> Date: Sun, 9 May 2021 15:47:22 +0800 Subject: [PATCH] 2021-05-09 15:47:22 --- asset/edit.css | 15 +++++++++++++++ asset/edit.js | 15 +++++++++++++++ asset/edit.svg | 13 +++++++++++++ index.html | 2 ++ 4 files changed, 45 insertions(+) create mode 100644 asset/edit.css create mode 100644 asset/edit.js create mode 100644 asset/edit.svg diff --git a/asset/edit.css b/asset/edit.css new file mode 100644 index 00000000..960bc6ef --- /dev/null +++ b/asset/edit.css @@ -0,0 +1,15 @@ +#edit-btn { + position: fixed; + right: 15px; + top: 260px; + width: 35px; + height: 35px; + background-repeat: no-repeat; + background-size: cover; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-image: url(edit.svg); +} \ No newline at end of file diff --git a/asset/edit.js b/asset/edit.js new file mode 100644 index 00000000..753f3eda --- /dev/null +++ b/asset/edit.js @@ -0,0 +1,15 @@ +document.addEventListener('DOMContentLoaded', function() { + var editBtn = document.createElement('div') + editBtn.id = 'edit-btn' + document.body.append(editBtn) + + var repo = window.$docsify.repo + editBtn.addEventListener('click', function() { + if (!repo) return + if (!/https?:\/\//.exec(repo)) + repo = 'https://github.com/' + repo + var url = repo + '/tree/master' + + location.hash.slice(1) + '.md' + window.open(url) + }) +}) \ No newline at end of file diff --git a/asset/edit.svg b/asset/edit.svg new file mode 100644 index 00000000..e941dd34 --- /dev/null +++ b/asset/edit.svg @@ -0,0 +1,13 @@ + + + + Edit + + + + + + + + + \ No newline at end of file diff --git a/index.html b/index.html index 3cd0faac..4944fa17 100644 --- a/index.html +++ b/index.html @@ -20,6 +20,8 @@ + +
now loading...
-- GitLab