Skip to content

Commit

Permalink
Restricted to show only last two most recent versions (fixed formatting)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdk1616 committed Jan 5, 2021
1 parent e79f89f commit a1104ae
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 32 deletions.
32 changes: 13 additions & 19 deletions public/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -416,26 +416,20 @@ <h2 class="info-header">GPA Type and Switching Quarters</h2>
GPA for each quarter, which when clicked allows you to see your grades and
assignments for that quarter.
</p>


<style>

.info-header a {
font-size: 100%;
text-decoration: none;

}


</style>


<style>
.info-header a {
font-size: 100%;
text-decoration: none;
}
</style>
<br>
<br>
<p class="info-text"><span id="updates"></span></p>
</div>
</div>
<center><a href="https://github.com/Aspine/aspine/blob/master/CHANGELOG.md">&lt&lt See Older Versions of Aspine &gt&gt</a>
<br>
<br>
</div>
</div>
<p>Aspine version: <span id="version">(loading&hellip;)</span></p>
<script>
window.addEventListener('DOMContentLoaded', () => {
Expand Down
23 changes: 15 additions & 8 deletions public/js/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ function closeSideNav() {
sidenavOverlay.classList.remove("fade-in")
}
sidenavOverlay.classList.add("fade-out")

}

// Allows exiting sidenav by clicking anywhere outside
Expand Down Expand Up @@ -1266,22 +1266,29 @@ document.getElementById("default_open").click();
$.ajax("/version").then(ver => $("#version").text(ver));

$.ajax("/updates").then(upt => {

$("#updates").html(upt);
document.getElementById("changelog").outerHTML = "<h2 class='info-header'>Version History/What's New:</h2>";


var h2s = document.getElementsByTagName('h2');
for(var i = 0, length = h2s.length; i < length; i++){
// Do something with
h2s[i].className = "info-header";
var items = document.getElementById("updates").getElementsByTagName("h2");
for (var i = 0; i < items.length; i++) {
items[i].className = "info-header";
}
//Hide Everything but first and second versions
for(var i = 3; i < items.length; i ++) {
items[i].style = "display: none";
}
items = document.getElementById("updates").getElementsByTagName("ul");
for(var i = 3; i < items.length; i ++) {
items[i].style = "display: none";
}


});






//#endif

//#ifdef lite
Expand Down
7 changes: 2 additions & 5 deletions serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,8 @@ app.get('/version', (req, res) => res.send(version));


app.get('/updates', async (req, res) => {

const changelog = await fs.promises.readFile(__dirname + '/CHANGELOG.md');

res.send(marked("" + changelog));

const changelog = await fs.promises.readFile(__dirname + '/CHANGELOG.md');
res.send(marked("" + changelog));
});

app.use(function(req, res, next) { // enable cors
Expand Down

0 comments on commit a1104ae

Please sign in to comment.