diff --git a/docs/main.js b/docs/main.js index 62791eac..372fcc34 100644 --- a/docs/main.js +++ b/docs/main.js @@ -38,7 +38,35 @@ window.$docsify = { }, executeScript: true, - + plugins: [ + function (hook, vm) { + hook.doneEach(() => { + var sidebar = document.getElementsByClassName("sidebar")[0]; + var resizeBar = document.createElement('div'); + resizeBar.classList.add('sidebarresizer') + sidebar.appendChild(resizeBar); + + var startX, startWidth; + resizeBar.addEventListener('mousedown', function (e) { + startX = e.clientX; + startWidth = sidebar.offsetWidth; + e.preventDefault(); + }); + + document.addEventListener('mousemove', function (e) { + if (startX) { + var newWidth = startWidth + (e.clientX - startX); + document.documentElement.style.setProperty('--sidebar-width', sidebar.style.width); + sidebar.style.width = Math.max(200, newWidth) + 'px'; + } + }); + + document.addEventListener('mouseup', function () { + startX = null; + }); + }) + }, + ] } let dropdowns = document.getElementsByClassName('dropdown') @@ -112,4 +140,4 @@ window.onpopstate = function (event) { } } -}; \ No newline at end of file +}; diff --git a/docs/style.css b/docs/style.css index 6538e5d1..cd4299df 100644 --- a/docs/style.css +++ b/docs/style.css @@ -108,6 +108,15 @@ top: 50px; } +.sidebarresizer { + width: 5px; + height: 100%; + position: absolute; + right: 0; + top: 0; + cursor: ew-resize; +} + .github-corner { position: fixed; top: 50px;