From 5c9c160c1af0b3462036cb0daf014e8643ea9244 Mon Sep 17 00:00:00 2001 From: Nova Date: Sat, 3 Aug 2024 23:45:06 +1000 Subject: [PATCH] uwu --- assets/code/apps.js | 84 ++++++++++++++++++++++++++++++++++++++------- assets/code/fs.js | 4 +-- assets/style.css | 12 +++++-- desktop.html | 3 +- 4 files changed, 83 insertions(+), 20 deletions(-) diff --git a/assets/code/apps.js b/assets/code/apps.js index 58d5715..dfa22d3 100644 --- a/assets/code/apps.js +++ b/assets/code/apps.js @@ -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}
(score: ${Math.round(a.score)}; found in: ${a.path})`; - 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}
(score: ${Math.round(a.score)}; found in: ${a.path})`; + console.log(`${a.text}
(score: ${Math.round(a.score)}; found in: ${a.path})`); + 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}
(score: ${Math.round(a.score)}; found in: ${a.path})`; + // document.querySelector("#answers").appendChild(p); + // count++; + // } else { + // undefineds++ + // } + // }); if (undefineds == ans.length) { document.querySelector("#answers").innerHTML = `No answers found.`; } diff --git a/assets/code/fs.js b/assets/code/fs.js index 2ad1f22..806a29d 100644 --- a/assets/code/fs.js +++ b/assets/code/fs.js @@ -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(); diff --git a/assets/style.css b/assets/style.css index b4f1150..3829c9c 100644 --- a/assets/style.css +++ b/assets/style.css @@ -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; @@ -61,6 +63,7 @@ body { font-family: 'Poppins', Arial; text-align: center; font-size: var(--fz1); + overflow: hidden; } .bold { @@ -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; } @@ -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; @@ -701,4 +704,7 @@ p { .splashscreen *{ margin-block-start: 0px; margin-block-end: 0px; +} +.tbmenu{ + z-index: 9002451; } \ No newline at end of file diff --git a/desktop.html b/desktop.html index 2047c09..eda3c25 100644 --- a/desktop.html +++ b/desktop.html @@ -51,8 +51,7 @@

NovaOS

-

Loading

- +

Version 0.0.9