Skip to content

Commit

Permalink
uwu
Browse files Browse the repository at this point in the history
  • Loading branch information
novafurry committed Aug 3, 2024
1 parent 28a18cc commit 5c9c160
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 20 deletions.
84 changes: 71 additions & 13 deletions assets/code/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,22 +330,80 @@ var app = {
console.log(ans);
ans = ans.sort((a, b) => b.score - a.score);
console.log(ans);

var grpd = ans.reduce((acc, obj) => {
var key = obj.path;
if (!acc[key]) {
acc[key] = [];
}
acc[key].push(obj);
return acc;
}, {});
var grouped = []
for(key in grpd){
grouped.push({path: key, answers: grpd[key]})
}
console.log(grouped);
// Display answers
var undefineds = 0
var count = 0
document.querySelector("#answers").innerHTML = "";
ans.forEach(a => {
if (a !== undefined && count < 3) {
window.answersFormatted = []
grouped.forEach(async (ans, i) => {
var lowestStartIndex = 0;
var highestEndIndex = 0;
var isFirstLoop = true;
console.log(ans);
ans.answers.forEach((a, i) => {
console.log(a);
var p = document.createElement('p');
p.innerHTML = `${a.text}<br><small>(score: ${Math.round(a.score)}; found in: ${a.path})</small>`;
document.querySelector("#answers").appendChild(p);
count++;
} else {
undefineds++
}
if (isFirstLoop) {
lowestStartIndex = a.startIndex;
highestEndIndex = a.endIndex;
isFirstLoop = false;
} else {
if (a.startIndex < lowestStartIndex) {
lowestStartIndex = a.startIndex;
}
if (a.endIndex > highestEndIndex) {
highestEndIndex = a.endIndex;
}
}
});
console.log(
lowestStartIndex,
highestEndIndex,
isFirstLoop
)
var txtFile = await fs.read(ans.path);
console.log(txtFile)
answersFormatted.push({text: txtFile.substring(lowestStartIndex - 5, highestEndIndex + 5), score: ans.answers[0].score, path: ans.path});
console.log(answersFormatted)
});
var undefineds = 0
var count = 0
setTimeout(function(){
document.querySelector("#answers").innerHTML = "";
answersFormatted.forEach(a => {
console.log(a)
if (a !== undefined && count < 3) {
console.log(a);
var p = document.createElement('p');
p.innerHTML = `${a.text}<br><small>(score: ${Math.round(a.score)}; found in: ${a.path})</small>`;
console.log(`${a.text}<br><small>(score: ${Math.round(a.score)}; found in: ${a.path})</small>`);
document.querySelector("#answers").appendChild(p);
count++;
} else {
undefineds++
}
});
}, 1000)
// ans.forEach(a => {
// if (a !== undefined && count < 3) {
// console.log(a);
// var p = document.createElement('p');
// p.innerHTML = `${a.text}<br><small>(score: ${Math.round(a.score)}; found in: ${a.path})</small>`;
// document.querySelector("#answers").appendChild(p);
// count++;
// } else {
// undefineds++
// }
// });
if (undefineds == ans.length) {
document.querySelector("#answers").innerHTML = `No answers found.`;
}
Expand Down
4 changes: 2 additions & 2 deletions assets/code/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ setTimeout(function () {
var apps = 0
for (var key in app) {if (app[key].hasOwnProperty("onstartup")) {apps++}}
console.log(apps)
document.querySelector("#currentComponent").max = apps;
// document.querySelector("#currentComponent").max = apps;
var counter = 0;
for (var key in app) {
if (app[key].hasOwnProperty("onstartup")) {
document.querySelector("#currentComponentText").innerText = `Current App/Component: ${app[key].name}`;
await app[key].onstartup(); // this is where each compontent is called
counter++;
document.querySelector("#currentComponent").value = counter;
// document.querySelector("#currentComponent").value = counter;
}
}
document.querySelector(".splashscreen").remove();
Expand Down
12 changes: 9 additions & 3 deletions assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
--fz2: 12px;
--inv: 0;
}

*{
transition: all cubic-bezier(0.075, 0.82, 0.165, 1) 0.05s;
}
#background {
position: fixed;
left: 0;
Expand Down Expand Up @@ -61,6 +63,7 @@ body {
font-family: 'Poppins', Arial;
text-align: center;
font-size: var(--fz1);
overflow: hidden;
}

.bold {
Expand Down Expand Up @@ -595,7 +598,7 @@ p {
animation: tb 1.0s cubic-bezier(0.25, 1, 0.5, 1) forwards;
backdrop-filter: blur(var(--bl2));
-webkit-backdrop-filter: blur(var(--bl2));
z-index: 3;
z-index: 303369;
overflow-x: auto;
white-space: nowrap;
}
Expand Down Expand Up @@ -685,7 +688,7 @@ p {
bottom: 0;
top: 0;
background-color: var(--bg1);
z-index: 9999;
z-index: 303375;
display: flex;
align-items: center;
justify-content: center;
Expand All @@ -701,4 +704,7 @@ p {
.splashscreen *{
margin-block-start: 0px;
margin-block-end: 0px;
}
.tbmenu{
z-index: 9002451;
}
3 changes: 1 addition & 2 deletions desktop.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
</div>
<div class="splashscreen-text">
<h1>NovaOS</h1>
<h3>Loading</h3>
<progress id="currentComponent" max="100" value="70"></progress>
<progress id="currentComponent"></progress>
<br>
<small id="currentComponentText"></small>
<p>Version 0.0.9</p>
Expand Down

0 comments on commit 5c9c160

Please sign in to comment.