diff --git a/index.html b/index.html index 52ab5b1..4e5a77f 100755 --- a/index.html +++ b/index.html @@ -27,6 +27,7 @@

Quick Access

+
diff --git a/json/qa.json b/json/qa.json new file mode 100644 index 0000000..1682ad4 --- /dev/null +++ b/json/qa.json @@ -0,0 +1,23 @@ +{ + "default": [ + { + "name": "Desktop", + "win32": "{r}\\Desktop" + }, { + "name": "Documents", + "win32": "{r}\\Documents" + }, { + "name": "Pictures", + "win32": "{r}\\Pictures" + }, { + "name": "Videos", + "win32": "{r}\\Videos" + }, { + "name": "Music", + "win32": "{r}\\Music" + }, { + "name": "Downloads", + "win32": "{r}\\Downloads" + } + ] +} \ No newline at end of file diff --git a/scripts/startup/initsidebar.js b/scripts/startup/initsidebar.js new file mode 100644 index 0000000..4437c8c --- /dev/null +++ b/scripts/startup/initsidebar.js @@ -0,0 +1,27 @@ +const refresh = require('../fileview/refresh'); + +const qa = require('../../json/qa.json'); +const os = require("os"); + +module.exports = () => { + let root + switch (window.kade.platform) { + case 'win32': + root = `${os.homedir()}`; + break; + case 'linux': + root = `~/home`; + break; + } + + let quickAccess = document.getElementById('favorites-container'); + + qa.default.forEach(i => { + let quick = document.createElement('div'); + quick.innerHTML = i.name; + quick.onclick = () => {refresh(i[window.kade.platform].replace('{r}', root));}; + quick.className = 'favorites-button'; + quick.classList.add('nosel'); + quickAccess.appendChild(quick); + }); +}; \ No newline at end of file diff --git a/scripts/startup/preload.js b/scripts/startup/preload.js index f934d20..388e211 100755 --- a/scripts/startup/preload.js +++ b/scripts/startup/preload.js @@ -40,6 +40,7 @@ window.addEventListener('DOMContentLoaded', () => { } require('./initcontext')(); + require('./initsidebar')(); require('../fileview/refresh')(startDir); setButtons(); diff --git a/styles/sidebar.css b/styles/sidebar.css index 180b5b6..6b9a258 100644 --- a/styles/sidebar.css +++ b/styles/sidebar.css @@ -12,4 +12,27 @@ height: 100%; } -#container {margin-left: 200px;} \ No newline at end of file +#container {margin-left: 200px;} + +#favorites-container { + display: flex; + flex-direction: column; + align-items: stretch; + align-content: flex-start; + justify-content: flex-start; + row-gap: 6px; +} + +.favorites-button { + padding: 4px 6px; + color: #afafaf; + border-radius: 3px 3px; + cursor: pointer; + transition: padding-left .05s linear; +} + +.favorites-button:hover { + background-color: #a172a65f; + padding-left: 10px; + color: white; +} \ No newline at end of file