load folder pins on init

sidebar
Kit Kasune 3 years ago
parent 0876d9fb4b
commit 28262c8c60
  1. 2
      json/config/favorites.json
  2. 1
      scripts/contextmenu/pin.js
  3. 14
      scripts/startup/initsidebar.js

@ -1 +1 @@
{"C:/Users/clarkjr1836/Desktop/yb":"yb","C:/Users/clarkjr1836/Desktop/bot":"bot"} {"C:/Users/clarkjr1836/Desktop/yb":"yb","C:/Users/clarkjr1836/Desktop/bot":"bot","C:/Users/clarkjr1836/Desktop/bot/Natsuki":"Natsuki"}

@ -21,7 +21,6 @@ module.exports = () => {
['favorites-button', 'folder-pin', 'nosel'].forEach(x => fav.classList.add(x)); ['favorites-button', 'folder-pin', 'nosel'].forEach(x => fav.classList.add(x));
fav.innerHTML = fta; fav.innerHTML = fta;
fav.onclick = () => {refresh(tr);}; fav.onclick = () => {refresh(tr);};
console.log(fta, window.kade.cpath.replace(/\\+/gm, '/'));
cfc.appendChild(fav); cfc.appendChild(fav);
createToast( createToast(
"Folder Pinned", [`Folder "${fta}" was successfully pinned! You can now access it permanently in your sidebar!"`, `<em>${window.kade.cpath.replace(/\\+/gm, '/')}/${fta}</em>`], undefined, false, 5, "Folder Pinned", [`Folder "${fta}" was successfully pinned! You can now access it permanently in your sidebar!"`, `<em>${window.kade.cpath.replace(/\\+/gm, '/')}/${fta}</em>`], undefined, false, 5,

@ -2,6 +2,8 @@ const refresh = require('../fileview/refresh');
const qa = require('../../json/qa.json'); const qa = require('../../json/qa.json');
const os = require("os"); const os = require("os");
const fs = require('fs');
const path = require('path');
module.exports = () => { module.exports = () => {
let root let root
@ -24,4 +26,16 @@ module.exports = () => {
quick.classList.add('nosel'); quick.classList.add('nosel');
quickAccess.appendChild(quick); quickAccess.appendChild(quick);
}); });
if (fs.existsSync(path.join(__dirname, '../../', '/json/config/favorites.json'))) {
const pins = require('../../json/config/favorites.json');
let cfc = document.getElementById('custom-favorites-container');
Object.keys(pins).forEach(pin => {
let fav = document.createElement('div');
['favorites-button', 'folder-pin', 'nosel'].forEach(x => fav.classList.add(x));
fav.innerHTML = pins[pin];
fav.onclick = () => {refresh(pin);};
cfc.appendChild(fav);
});
}
}; };
Loading…
Cancel
Save