52 lines
2.3 KiB
PHP
Executable File
52 lines
2.3 KiB
PHP
Executable File
<?php $user = posix_getpwuid(fileowner(__FILE__))["name"]; ?>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="description" content="tilde.team unix group">
|
|
<meta name="author" content="<?=$user?>">
|
|
<meta name="theme-color" content="#00cc00">
|
|
<title>~<?=$user?></title>
|
|
<link rel="stylesheet" type="text/css" href="/css/hacker.css">
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="page-header">
|
|
<div class="pull-right">
|
|
<p><a href="/"><- 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>
|
|
<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 + "\" target=\"_blank\">" + data.title + "</a>";
|
|
}
|
|
function hn_onclick() {
|
|
index++;
|
|
hacknews(index);
|
|
}
|
|
hacknews(index);
|
|
</script>
|
|
</html>
|