Added in the 'latest' command and display latest post in terminal boot
This commit is contained in:
parent
99e89f7e84
commit
e58896cc52
5 changed files with 40 additions and 2 deletions
|
|
@ -46,6 +46,15 @@ window.terminal.registerCommand("reload", "Reload the current page", () => {
|
|||
|
||||
// PAGE NAVIGATION
|
||||
|
||||
window.terminal.registerCommand(
|
||||
"latest",
|
||||
"View the latest post, regardles of section",
|
||||
() => {
|
||||
let latestPostLink = document.getElementById("latest-post-link");
|
||||
window.location.href = latestPostLink.textContent;
|
||||
},
|
||||
);
|
||||
|
||||
// About command
|
||||
window.terminal.registerCommand("about", "About this site", () => {
|
||||
window.location.href = "/about/";
|
||||
|
|
|
|||
|
|
@ -46,12 +46,29 @@ class TerminalShell {
|
|||
this.scrollToBottom();
|
||||
}
|
||||
|
||||
this.printHTML(" ");
|
||||
|
||||
// Get latest post info
|
||||
let latestPostTitle = document.getElementById("latest-post-title");
|
||||
let latestPostDate = document.getElementById("latest-post-date");
|
||||
this.printHTML(
|
||||
"<span class='info'>Latest Post: </span>" +
|
||||
latestPostTitle.innerText +
|
||||
" (" +
|
||||
latestPostDate.innerText +
|
||||
")",
|
||||
);
|
||||
this.printHTML(
|
||||
"<span class='info'> - Type \"latest\" to view it.</span>",
|
||||
);
|
||||
this.printHTML(" ");
|
||||
|
||||
this.printHTML(
|
||||
'<span class="info">Type "help" for available commands.</span>',
|
||||
);
|
||||
|
||||
this.printHTML(
|
||||
'<span class="warning">This site is under contstruction. There\'s nothing of interest here yet.</span>',
|
||||
'<span class="warning">This site is under construction. There\'s nothing of interest here yet.</span>',
|
||||
);
|
||||
|
||||
this.inputContainer.classList.remove("hidden");
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
border-radius: 5px;
|
||||
background-color: black;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
|
||||
.music:hover .music-text {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@ body {
|
|||
position: relative;
|
||||
}
|
||||
|
||||
.latest-post {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@keyframes flicker {
|
||||
0% {
|
||||
opacity: 0.27861;
|
||||
|
|
|
|||
|
|
@ -420,4 +420,11 @@ unix 3 [ ] STREAM CONNECTED 50896 /run/user/1000/bus
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ range first 1 (where .Site.RegularPages "Type" "posts") }}
|
||||
<div id="latest-post">
|
||||
<div id="latest-post-link">{{ .Permalink }}</div>
|
||||
<div id="latest-post-title">{{ .Title }}</div>
|
||||
<div id="latest-post-date">{{ .Date.Format "Jan 2, 2006" }}</div>
|
||||
</div>
|
||||
{{ end }} {{ end }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue