Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

Commit

Permalink
fileman
Browse files Browse the repository at this point in the history
  • Loading branch information
novafurry committed May 11, 2024
1 parent 84487c7 commit 197e7f6
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 28 deletions.
26 changes: 26 additions & 0 deletions appStyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ body{
height: 100vh;
margin: 0px;
background-color: none;
color:white !important;
}
@font-face {
font-family: "lucide";
Expand All @@ -12,6 +13,7 @@ body{
}
*{
font-family: system-ui, 'lucide';
color:white !important;
}
navRail{
width: 100vw;
Expand All @@ -38,4 +40,28 @@ forward::after{
padding-left:0.5em;
font-size: 1.3em;
color:white;
}
.fileMan li{
list-style-type: "";
}
.fileMan li.folder::before {
content: "\e333";
border-radius: 0ch;
padding-inline: 0.5ch;
margin-inline-end: 0ch;
margin-left: -32.5px;
}
.fileMan li.fileGeneric::before {
content: "\e0c1";
border-radius: 0ch;
padding-inline: 0.5ch;
margin-inline-end: 0ch;
margin-left: -32.5px;
}
.fileMan li.parentDir::before {
content: "\e04e";
border-radius: 0ch;
padding-inline: 0.5ch;
margin-inline-end: 0ch;
margin-left: -32.5px;
}
69 changes: 51 additions & 18 deletions applications/fm.nvapp.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,52 @@
<link rel="stylesheet" href="../assets/lucide.css">
<appContent>
<link rel="stylesheet" href="../appStyle.css">
<navRail>
<back></back>
<forward></forward>
<up></up>
<breadcrumbs></breadcrumbs>
<search></search>
</navRail>
<main>
<ul id="files"></ul>
</main>
<script src="../libraries/foxyfs.js"></script>
<script>
root = foxyfs.ls("/")
console.log(root)
<body>
<link rel="stylesheet" href="../assets/lucide.css">
<appContent>
<link rel="stylesheet" href="../appStyle.css">
<ul class="fileMan">

</ul>
</appContent>
<script type="module">
import '../libraries/foxyfs.js';
import '../libraries/foxywincontent.js';
window.fm = {
refresh: async function (dir) {
var path = dir.split("/")
path[path.length - 1] = ''
path = path.filter(function (el) {
return el != '';
});
path = path.join("/")
document.querySelector("ul").innerHTML = `<li class="parentDir" onclick="alert('You cant go up.')">.. (Up one level)</li>`
if(dir.length > 1){
document.querySelector("ul").innerHTML = `<li class="parentDir" onclick="fm.up(`+path+`)">.. (Up one level)</li>`
}

},
nav: async function (where) {
fm.refresh(where)
var rootFirstIndex = await foxyfs.ls(where)
rootFirstIndex.forEach(node => {
var li = document.createElement("li")
if (node.kind == "directory") {
li.class = "folder"
li.onclick = function () {
fm.nav(where + "/" + node.name)
}
} else {
li.class = "fileGeneric"
li.onclick = function () {
alert("file opening not supported yet")
}
}
li.innerText = node.name
document.querySelector("ul").appendChild(li)
});
},
up: async function () {

}
}
fm.nav("/")
</script>
</inline>
</body>
Binary file added assets/SymbolsNerdFont-Regular.ttf
Binary file not shown.
12 changes: 6 additions & 6 deletions libraries/foxyfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ window.foxyfs = {
return el != '';
});
if (path.length == 0) {
var content = {};
var content = [];
for await (let [name, handle] of opfsRoot.entries()) {
content[name] = handle.kind
content.push({name: name, kind:handle.kind})
}
return content;
}
Expand All @@ -87,15 +87,15 @@ window.foxyfs = {
dirHandle = await dirHandle.getDirectoryHandle(item)
}
}
var content = {};
var content = [];
for await (let [name, handle] of dirHandle.entries()) {
content[name] = handle.kind
content.push({name: name, kind:handle.kind})
}
return content;
} else if (path.length == 1) {
var content = {};
var content = [];
for await (let [name, handle] of dirHandle.entries()) {
content[name] = handle.kind
content.push({name: name, kind:handle.kind})
}
return content;
}
Expand Down
14 changes: 14 additions & 0 deletions libraries/foxywincontent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
document.addEventListener("mousemove", function (e) {
setTimeout(function () {
window.parent.document.querySelector(".cur").style.top = `${e.clientY}px`
// console.log(e)
window.parent.document.querySelector(".cur").style.left = `${e.clientX}px`
if (e.srcElement.classList.contains("clickable")) {
window.parent.document.querySelector(".cur").style.background = "#0000FF";
}
else {
window.parent.document.querySelector(".cur").style.background = "#FFFFFF"
}
console.log("hi")
}, 0)
})
10 changes: 7 additions & 3 deletions libraries/foxywm.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,18 @@ export default function fwmInit() {
}
},
setName: function setName(id, name) {
console.log(window)
if (id == "fwm.current") {
console.log(lastWin)
document.querySelector("[aria-describedby='" + lastWin.id + "'] wmcontent").dataset.title = name
document.querySelector("[aria-describedby='" + lastWin.id + "'] wmcontent").childeren[0].innerText = name
document.querySelector("[aria-describedby='" + lastWin.id + "']").children[0].innerText = name

} else {
document.querySelector("[aria-describedby='" + id + "'] wmcontent").dataset.title = name
document.querySelector("[aria-describedby='" + id + "'] wmcontent").childeren[0].innerText = name
if(window.frameElement !== null){
window.parent.alert("bogos binted")
} else {
window.document.querySelector("[aria-describedby='" + id + "'] wmcontent").dataset.title = name
window.document.querySelector("[aria-describedby='" + id + "']").children[0].innerText = name}
}
},
killAll: function (id){
Expand Down
4 changes: 3 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ topBar[0].addEventListener("mouseleave", function () {
$("#WindowTitle")[0].innerText = "NovaOS";
$("#wb")[0].setAttribute("class", "noWin")
}, 2000);
})
})

wm.windows.default("fm")
3 changes: 3 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ body, html{
.ui-resizable-handle{
scale: 1.2;
}
.ui-dialog-title{
font-size:1.1em;
}

0 comments on commit 197e7f6

Please sign in to comment.