diff --git a/asset/edit.css b/asset/edit.css new file mode 100644 index 0000000000000000000000000000000000000000..960bc6efe0b1306734b087304b5400f93836d0cd --- /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 0000000000000000000000000000000000000000..753f3eda82e303dd02af58de9277952003ce2d54 --- /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 0000000000000000000000000000000000000000..e941dd3432dbfb63bcc00c85b89c4c1feddb85e3 --- /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 efbc1eb18ddd5f5a9731f3745ca860def62aea3f..cc2b36727db7864f04f6796b7b9a98bddee06fd3 100644 --- a/index.html +++ b/index.html @@ -20,6 +20,8 @@ + +
now loading...