ctx properly recognizes folders

modals
Kit Kasune 3 years ago
parent 7c70870beb
commit a2bfe3a5c1
  1. 4
      scripts/contextmenu/createcontext.js
  2. 1
      scripts/fileview/load/render.js

@ -4,10 +4,10 @@ module.exports = (e, target, window) => {
let ctx = document.getElementById('ctx');
ctx.style.display = 'block';
const ctxf = document.getElementById('ctx-folder');
if (target.classList.contains('file') || (target.parentElement && target.parentElement.classList.contains('file'))) {
if (target.classList.contains('folder') || (target.parentElement && target.parentElement.classList.contains('folder'))) {
ctxf.style.display = 'block';
ctxf.previousElementSibling.style.display = 'block';
if (target.classList.contains('file')) {window.kade.currentFolder = target.children[1].innerHTML.trim();}
if (target.classList.contains('folder')) {window.kade.currentFolder = target.children[1].innerHTML.trim();}
else {window.kade.currentFolder = target.parentElement.children[1].innerHTML.trim();}
} else {
ctxf.style.display = 'none';

@ -13,6 +13,7 @@ module.exports = (dir, options) => {
let cfc = document.createElement("div");
cfc.className = 'file';
if (options.animate) {cfc.classList.add('rise');}
if (file.type.toLowerCase().includes('folder')) {cfc.classList.add('folder');}
cfc.onclick = function () {
window.kade.elc = true;
if (cfc.classList.contains('file-active')) {if (file.dir) {refresh(`${window.kade.cpath}/${file.name}`);}}

Loading…
Cancel
Save