diff --git a/asset/docsify-quick-page.css b/asset/docsify-quick-page.css new file mode 100644 index 0000000000000000000000000000000000000000..df2481f73abcd9bd29db3ee681e73d0bfbf6d2bd --- /dev/null +++ b/asset/docsify-quick-page.css @@ -0,0 +1,39 @@ +#prev-page-button { + position:fixed; + top:140px; + width: 35px; + height: 35px; + right: 15px; + background-color: transparent; + background-image: url(emoji-up.svg); + background-repeat: no-repeat; + background-size: cover; + border:0; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + outline:none; + cursor: pointer; + transform: rotate(-90deg); +} + +#next-page-button { + position:fixed; + top:180px; + width:35px; + height:35px; + right:15px; + background-color: transparent; + background-image: url(emoji-down.svg); + background-repeat: no-repeat; + background-size: cover; + border:0; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + outline:none; + cursor: pointer; + transform: rotate(-90deg); +} \ No newline at end of file diff --git a/asset/docsify-quick-page.js b/asset/docsify-quick-page.js new file mode 100644 index 0000000000000000000000000000000000000000..d472eeb649e85a45e76cb3fe7b9bff56e1426b62 --- /dev/null +++ b/asset/docsify-quick-page.js @@ -0,0 +1,42 @@ +document.addEventListener('DOMContentLoaded', function() { + var prevBtn = document.createElement("div") + prevBtn.id = "prev-page-button" + document.body.appendChild(prevBtn) + var nextBtn = document.createElement("div"); + nextBtn.id = "next-page-button" + document.body.appendChild(nextBtn) + + var links = null + var linkMap = null + var getCurIdx = function() { + if (!links) { + links = Array + .from(document.querySelectorAll(".sidebar-nav a")) + .map(x => x.href) + linkMap = {} + links.forEach((x, i) => linkMap[x] = i) + } + + var elem = document.querySelector(".active a") + var curIdx = elem? linkMap[elem.href]: -1 + return curIdx + } + + prevBtn.addEventListener('click', function () { + if (!document.body.classList.contains('ready')) + return + var curIdx = getCurIdx() + location.href = curIdx == -1? + links[0]: + links[(curIdx - 1 + links.length) % links.length] + document.body.scrollIntoView() + }, false) + + nextBtn.addEventListener('click', function () { + if (!document.body.classList.contains('ready')) + return + var curIdx = getCurIdx() + location.href = links[(curIdx + 1) % links.length] + document.body.scrollIntoView() + }, false) +}) \ No newline at end of file diff --git a/asset/emoji-down.svg b/asset/emoji-down.svg new file mode 100644 index 0000000000000000000000000000000000000000..a1bea40f2b1c6aaf7557b642eb26fc7a3e5a32c1 --- /dev/null +++ b/asset/emoji-down.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/asset/emoji-up.svg b/asset/emoji-up.svg new file mode 100644 index 0000000000000000000000000000000000000000..8701e7824ed552903e739fd2bfda239c10a6f9a1 --- /dev/null +++ b/asset/emoji-up.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/index.html b/index.html index 04956cbc2ff9b0f7bd87884f7e0a19ad923dded5..a17b5fd0003341ea5deaf0ad51ce509013a7a3db 100644 --- a/index.html +++ b/index.html @@ -54,5 +54,7 @@ + + \ No newline at end of file