08.10.2026 - task 6 for school

This commit is contained in:
2026-10-08 20:53:32 +02:00
parent 553cf38eea
commit 06b66d19d1
2 changed files with 41 additions and 1 deletions
+37 -1
View File
@@ -60,10 +60,13 @@ document.getElementById("portfolioFilter").onchange = () => {
}; };
let foundProjects = repositories;
function projectSearch(){ function projectSearch(){
let value = document.getElementById("portfolioSearch").value.trim().toLowerCase(); let value = document.getElementById("portfolioSearch").value.trim().toLowerCase();
let selectedLanguage = document.getElementById("portfolioFilter").value; let selectedLanguage = document.getElementById("portfolioFilter").value;
let foundProjects = []; foundProjects = [];
repositories.forEach((project) => { repositories.forEach((project) => {
let textMatch = false; let textMatch = false;
@@ -123,3 +126,36 @@ if(isEvening() === true)
{ {
document.getElementById("portfolioList").classList.add("night"); document.getElementById("portfolioList").classList.add("night");
} }
document.getElementById("exportButton").onclick = () => {
exportProjects();
};
function buildExportText(projects){
let text = "";
// je Projekt eine Zeile bauen, Felder mit Semikolon getrennt,
// am Ende jeder Zeile ein \n anhaengen
// Reihenfolge: name;language;created;url;description
return text;
}
function exportProjects(){
// 1. Text holen ueber buildExportText(foundProjects)
// 2. let blob = new Blob([text], { type: "text/plain" });
// 3. let adresse = URL.createObjectURL(blob);
// 4. ein <a> anlegen, href = adresse, download = "projekte.txt", click()
// 5. URL.revokeObjectURL(adresse);
let adress = URL.createObjectURL(new Blob(["bla"], { type: "text/plain" }));
let link = document.createElement("a");
link.href = adress;
link.download = "projekte.txt";
link.click();
link.remove();
URL.revokeObjectURL(adress);
}
+4
View File
@@ -34,6 +34,10 @@
</div> </div>
</div> </div>
<div class="mb-3">
<button id="exportButton" class="btn btn-primary">Liste exportieren</button>
</div>
<p><small id="portfolioCount"></small></p> <p><small id="portfolioCount"></small></p>
<table class="table align-middle"> <table class="table align-middle">