Finished Firebase v.1

This commit is contained in:
2019-02-12 22:28:17 +00:00
parent 98696bfa9d
commit 92562a9c3f
2 changed files with 32 additions and 56 deletions
+28
View File
@@ -1,11 +1,35 @@
// Display all projects
function displayProjects() {
database = firebase.database().ref("projects");
database.once('value', function(snapshot) {
snapshot.forEach(function(child) {
firebase.database().ref("projects/"+child["key"]).on('value', function (data) {
var data1 = data.val();
var a = document.createElement("table")
if (data1["link"] == "") {
a.innerHTML = "<tr><td><div id='titles'>"+data1["title"]+"</h4><div class='"+data1["status"]+"'>"+data1["status"]+"</div></td></tr><tr class='spacing'><td>"+data1["description"]+"</td></tr><tr class='separator'></tr>"
} else {
a.innerHTML = "<tr><td><div id='titles'><a href='"+data1["link"]+"'>"+data1["title"]+"</a></h4><div class='"+data1["status"]+"'>"+data1["status"]+"</div></td></tr><tr class='spacing'><td>"+data1["description"]+"</td></tr><tr class='separator'></tr>"
}
document.getElementById("projects").appendChild(a)
}
)})
});
}
// Edit Selected Project
function editProject() {
var data = {
title: document.getElementById("project-list").value,
link: document.getElementById("edit-project-link").value,
status: document.getElementById("edit-project-status").value,
description: document.getElementById("edit-project-description").value
}
firebase.database().ref("projects/"+document.getElementById("project-list").value).set(data)
document.getElementById("project-list").value = '';
document.getElementById("edit-project-link").value = '';
document.getElementById("edit-project-status").value = 'active';
document.getElementById("edit-project-description").value = '';
}
// onChange page update
@@ -29,6 +53,10 @@ function submitProject() {
description: document.getElementById("new-project-description").value
}
firebase.database().ref("projects/"+document.getElementById("new-project-title").value).set(data)
document.getElementById("new-project-title").value = '';
document.getElementById("new-project-link").value = '';
document.getElementById("new-project-status").value = 'active';
document.getElementById("new-project-description").value = '';
}
// Pull Project List and Display in Option
+4 -56
View File
@@ -10,7 +10,7 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-119545665-1"></script>
</head>
<body onload="onLoad()">
<body onload="onLoad();displayProjects();">
<div id="entirenav">
<div id="navbarlogo">
<img src="img/LAX18.jpeg" width=64><span id="logofont" style="font-size: 68pt;">LAX18's Homepage</span>
@@ -28,60 +28,8 @@
</div>
</div>
<h2 id="titles">Projects</h2>
<table>
<tr>
<tr>
<td><div id="titles">Hex Editor</h4><div class="active">Active Development</div></td></tr>
<tr class="spacing">
<td>This is a basic hex editor that allows the user to edit programs, appvars and raw memory. It also allows the user to enter decimals or hexidecimals into memory. <br> Uses the drawing canvas, ICE, and NOS Graphics Library.</td>
</tr>
<tr class="separator"></tr>
<td><div id="titles"><a href="libraries/nosgraphics.html">NOS Graphics Library</a></h4><div class="active">Active Development</div></td></tr>
<tr class="spacing">
<td>This is an ICE Graphics library to aid users in creating simple, beautiful programs using that canvas screen.</td>
</tr>
<tr class="separator"></tr>
<td><div id="titles"><a href="https://github.com/LAX18/lax18.github.io">lax18.github.io</a></h4><div class="active">Active Development</div></td></tr>
<tr class="spacing">
<td>This is my personal website to showcase all of my projects and such.</td>
</tr>
<tr class="separator"></tr>
<tr>
<td><div id="titles"><a href="https://github.com/LAX18/NOS">NOS</a></h4><div class="inactive">Idle</div></td></tr>
<tr class="spacing">
<td>NOS Is an alternative shell offered to those who use a TI84+CE Calculator. Written in ICE, this shell is one of the first of its kind.</td>
</tr>
<tr class="separator"></tr>
<tr>
<td><div id="titles"><a href="https://github.com/LAX18/LAXLOGS">LAXLOG IRC BOT</a></h4><div class="inactive">Idle</div></td></tr>
<tr>
<td>This is an IRC bot that takes logs of channels. Code not provided</td>
</tr>
<tr class="separator"></tr>
<tr>
<td><div id="titles"><a href="https://github.com/LAX18/LAXBOT">LAX18's IRC BOT</a></h4><div class="inactive">Idle</div></td></tr>
<tr>
<td>This is my personal IRC bot.</td>
</tr>
<tr class="separator"></tr>
<tr>
<td><div id="titles"><a href="https://github.com/LAX18/Orbit84-Improvement">Orbit84 Improvement</a></h4><div class="inactive">Idle</div></td></tr>
<tr>
<td>Orbit84 is an already released TIBASIC program that I have decided to remake in an ASM language (<a href="https://www.cemetech.net/programs/index.php?mode=file&id=1562" style="text-decoration: underline;">Original Program</a>).</td>
</tr>
<tr class="separator"></tr>
<tr>
<td><div id="titles">ICE Syntax Viewer</h4><div class="inactive">Idle</div></td><td></td>
</tr>
<tr>
<td>ICE Syntax Viewer shows you the commands and syntax availble for ICE, on calc.</td>
</tr>
<tr>
<tr class="separator"></tr>
<td><div id="titles"><a href="https://github.com/LAX18/Markup-Language">LAX18's Markup Language</a></h4><div class="inactive">Idle</div></td></tr>
<tr>
<td>This language would make it easier for beginners to code in HTML.</td>
</tr>
</table>
<div id="projects">
</div>
</body>
</html>