add horrible js code to get HN headlines, add links to blog drafts

This commit is contained in:
Tucker Boniface 2018-06-23 01:30:43 -04:00
parent 9af5b507fe
commit 8a8ac94a04
5 changed files with 36 additions and 8 deletions

View File

@ -1,5 +1,5 @@
global_title="~tab/blog/"
global_description="a blog about linux and programming, maybe?"
global_description="a blog about linux and programming, maybe? <a href=drafts>(drafts)</a>"
global_url="https://tilde.team/~tab/blog"
global_author="tab"
global_email="tab@tilde.team"

View File

@ -23,7 +23,7 @@
<div class="headerholder"><div class="header">
<div id="title">
<h1 class="nomargin"><a class="ablack" href="https://tilde.team/~tab/blog/index.html">~tab/blog/</a></h1>
<div id="description">a blog about linux and programming, maybe?</div>
<div id="description">a blog about linux and programming, maybe? <a href=drafts>(drafts)</a></div>
</div></div></div>
<div id="divbody"><div class="content">
<!-- entry begin -->
@ -43,6 +43,7 @@ tab
<p><a href="https://8values.github.io/">Click here to take the quiz</a></p>
<p>Tags: <a href='tag_politics.html'>politics</a></p>
<!-- text end -->
<!-- entry end -->
</div>

View File

@ -23,7 +23,7 @@
<div class="headerholder"><div class="header">
<div id="title">
<h1 class="nomargin"><a class="ablack" href="https://tilde.team/~tab/blog/index.html">~tab/blog/</a></h1>
<div id="description">a blog about linux and programming, maybe?</div>
<div id="description">a blog about linux and programming, maybe? <a href=drafts>(drafts)</a></div>
</div></div></div>
<div id="divbody"><div class="content">
<!-- entry begin -->
@ -45,6 +45,7 @@ tab
<p><a href="../files/.muttrc">Example .muttrc</a></p>
<p>Tags: <a href='tag_tilde.html'>tilde</a>, <a href='tag_linux.html'>linux</a></p>
<!-- text end -->
<!-- entry end -->
</div>

View File

@ -23,7 +23,7 @@
<div class="headerholder"><div class="header">
<div id="title">
<h1 class="nomargin"><a class="ablack" href="https://tilde.team/~tab/blog/index.html">~tab/blog/</a></h1>
<div id="description">a blog about linux and programming, maybe?</div>
<div id="description">a blog about linux and programming, maybe? <a href=drafts>(drafts)</a></div>
</div></div></div>
<div id="divbody"><div class="content">
<h3><a class="ablack" href="8values.html">
@ -42,6 +42,7 @@ tab
<p><a href="https://8values.github.io/">Click here to take the quiz</a></p>
<p>Tags: <a href='tag_politics.html'>politics</a></p>
<!-- text end -->
</div>
<div id="footer">CC by-nc-nd <a href="http://twitter.com/example">tab</a> &mdash; <a href="mailto:tab&#64;tilde&#46;team">tab&#64;tilde&#46;team</a><br/>

View File

@ -7,7 +7,7 @@
<meta name="description" content="tilde.team unix group">
<meta name="author" content="<?=$user?>">
<meta name="theme-color" content="#00cc00">
<title><?=$user?>~tilde.team</title>
<title>~<?=$user?></title>
<link rel="stylesheet" type="text/css" href="/css/hacker.css">
</head>
<body>
@ -17,10 +17,35 @@
<p><a href="/">&lt;- back to tilde.team</a></p>
</div>
<h1><strong>~<?=$user?></strong></h1>
<div style="display:inline-block;" id="hackernews"></div>
<button style="background-color:black;" class="btn-xs" onclick="hn_onclick()">Next</button><br>
<a href="blog">~ Blog</a> |
<a href="https://git.tilde.team/tab">~ Gitea</a> |
<a href="https://git.boniface.tech/lucyinthesky">Gogs</a> |
<a href="https://reddit.com/u/Sorry4StupidQuestion">Reddit</a>
</div>
<strong>// TODO</strong>
<a href="blog">Blog</a>
<br><p>I may add some more here later, but for now you can read the few posts on <a href="blog">my blog</a>. I also have <a href="blog/drafts">drafts</a> available that you can read, they're just my thoughts at the moment that I may or may not publish.</p>
</div>
</body>
<script>
var index = 0;
function get(whateverUrl){
var Httpreq = new XMLHttpRequest();
Httpreq.open("GET",whateverUrl,false);
Httpreq.send(null);
return JSON.parse(Httpreq.responseText);
}
function hacknews(index) {
let listurl = "https://hacker-news.firebaseio.com/v0/topstories.json"
var data = get(listurl);
let posturl = "https://hacker-news.firebaseio.com/v0/item/" + data[index] + ".json"
data = get(posturl);
document.getElementById("hackernews").innerHTML = "HN: <a href=\"" + data.url + "\">" + data.title + "</a>";
}
function hn_onclick() {
index++;
hacknews(index);
}
hacknews(index);
</script>
</html>