An electron-based WIP aesthetic file explorer ^^
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FileKade/scripts/fileview/refresh.js

31 lines
1.2 KiB

3 years ago
const loadDir = require('./load/loaddir');
const headers = require('../../json/headers.json');
module.exports = (newPath, options={animate:true,scroll:true,resetNav:true}) => {
['animate', 'scroll', 'resetNav'].forEach(k => {if (typeof options[k] === 'undefined') {options[k] = true;}});
3 years ago
document.getElementById('files').remove();
let files = document.createElement('div');
files.className = 'files';
files.setAttribute('id', 'files');
document.getElementById('container').appendChild(files);
let fh = document.createElement('div');
fh.className = 'file-header';
fh.setAttribute('id', 'file-header');
files.appendChild(fh);
Object.keys(headers).forEach(k => {
let temp = document.createElement('p');
temp.innerHTML = k;
temp.style = `flex-basis: ${headers[k]}%;`;
temp.className = 'nosel';
3 years ago
fh.appendChild(temp);
});
if (options.resetNav) {
document.getElementById('header-nav').remove();
let nav = document.createElement('div');
nav.setAttribute('id', 'header-nav');
document.getElementById('controls').appendChild(nav);
}
if (options.scroll) {window.scrollTo(0, 0);}
loadDir(newPath, options);
3 years ago
};