folder part of ctx

modals
Kit Kasune 3 years ago
parent 5c7d78d324
commit 45ffea9c0e
  1. 5
      json/ctx.json
  2. 11
      scripts/contextmenu/createcontext.js
  3. 3
      scripts/startup/changelog.js
  4. 1
      scripts/startup/initcontext.js
  5. 5
      styles/context.css

@ -10,5 +10,10 @@
{"name": "Reload", "id": "ctx-reload", "onclick": "reload"}, {"name": "Reload", "id": "ctx-reload", "onclick": "reload"},
{"name": "Refresh", "id": "ctx-refresh", "onclick": "refresh"}, {"name": "Refresh", "id": "ctx-refresh", "onclick": "refresh"},
{"name": "Options", "id": "ctx-options", "onclick": "options"} {"name": "Options", "id": "ctx-options", "onclick": "options"}
],
[
{"name": "Rename", "id": "ctx-rename-folder", "onclick": "rename-folder"},
{"name": "Pin to Favorites", "id": "ctx-pin", "onclick": "pin"},
{"name": "Delete", "id": "ctx-delete-folder", "onclick": "delete-folder"}
] ]
] ]

@ -3,6 +3,17 @@ module.exports = (e, target, window) => {
window.kade.context = true; window.kade.context = true;
let ctx = document.getElementById('ctx'); let ctx = document.getElementById('ctx');
ctx.style.display = 'block'; ctx.style.display = 'block';
const ctxf = document.getElementById('ctx-folder');
if (target.classList.contains('file') || (target.parentElement && target.parentElement.classList.contains('file'))) {
ctxf.style.display = 'block';
ctxf.previousElementSibling.style.display = 'block';
if (target.classList.contains('file')) {window.kade.currentFolder = window.kade.cpath + '/' + target.children[1].innerHTML;}
else {window.kade.currentFolder = window.kade.cpath + '/' + target.parentElement.children[1].innerHTML;}
console.log(window.kade.currentFolder);
} else {
ctxf.style.display = 'none';
ctxf.previousElementSibling.style.display = 'none';
}
ctx.style.left = `${Math.min(e.pageX, (window.innerWidth - (ctx.clientWidth + 2)))}px`; ctx.style.left = `${Math.min(e.pageX, (window.innerWidth - (ctx.clientWidth + 2)))}px`;
ctx.style.top = `${Math.min(e.pageY, ((window.innerHeight + window.scrollY) - (ctx.clientHeight + 2)))}px`; ctx.style.top = `${Math.min(e.pageY, ((window.innerHeight + window.scrollY) - (ctx.clientHeight + 2)))}px`;
}; };

@ -60,9 +60,6 @@ module.exports = () => {
}); });
clww.style = `height: ${modalOut.clientHeight - 6};`; // TODO cry enough tears that they magically make this line work clww.style = `height: ${modalOut.clientHeight - 6};`; // TODO cry enough tears that they magically make this line work
console.log(clww.style.height);
console.log(modalOut.clientHeight - 6);
console.log(typeof clww.style);
let msm = new Mousetrap(modal); let msm = new Mousetrap(modal);
msm.bind('esc', () => { msm.bind('esc', () => {

@ -23,5 +23,6 @@ module.exports = () => {
} }
if (i + 1 < ctxl.length) {ctx.appendChild(document.createElement('hr'));} if (i + 1 < ctxl.length) {ctx.appendChild(document.createElement('hr'));}
} }
document.getElementById('ctx-pin').parentElement.id = 'ctx-folder';
} catch (e) {console.error(e);} } catch (e) {console.error(e);}
}; };

@ -34,3 +34,8 @@
align-content: stretch; align-content: stretch;
row-gap: 2px; row-gap: 2px;
} }
#ctx-folder {
padding: 0 0;
margin: 0 0;
}
Loading…
Cancel
Save