Browse Source

new column layout for users on homepage

- users are now listed in columns below news and projects
- vary columns by screen width
- add #fragment offset to all headers
master
Ben Harris 11 months ago
parent
commit
148cd27ba4
  1. 7
      footer.php
  2. 11
      header.php
  3. 92
      index.php
  4. 12
      services.php
  5. 8
      wiki/index.php

7
footer.php

@ -2,16 +2,13 @@
<footer class="text-center">
<pre>ECDSA fingerprint: SHA256:R3qNfKIF3IiXhKCbFX6rCKl73yzexi9Wodsow6XFres</pre>
<a href="https://tildegit.org/team/site">site source</a>
&mdash;
~
<a href="https://tildegit.org/team/site/src/branch/master/<?=str_ireplace("/var/www/tilde.team/", "", $filepath)?>">page source</a>
&mdash;
~
<a href="https://bhh.sh/donate/">donate</a>
</footer>
</div>
<br>
<br>
<script src="/js/jquery.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
</body>

11
header.php

@ -17,12 +17,21 @@
<link rel="stylesheet" href="/css/hacker.css">
<link rel="stylesheet" href="/css/fork-awesome.min.css">
<style>
/* offset #fragments */
:target:before {
content: "";
display: block;
height: 70px;
margin: -70px 0 0;
}
</style>
<?=$additional_head ?? ""?>
<?php unset($title); unset($additional_head); ?>
</head>
<body style="padding-top: 70px;">
<body style="padding-top: 70px; padding-bottom: 30px;">
<div class="container">
<nav class="navbar navbar-default navbar-fixed-top">

92
index.php

@ -63,8 +63,8 @@ $parser = Tildeverse\Wiki\Parser::factory();
<hr>
<div class="row">
<div class="col-md-7">
<h1>~news~</h1>
<div class="col-md-6">
<h1 id="news">~news~</h1>
<?php foreach (array_slice(array_reverse(glob("news/pages/*.md")), 0, 4) as $page):
$parsed = $parser->parse(file_get_contents($page));
@ -89,8 +89,10 @@ $parser = Tildeverse\Wiki\Parser::factory();
<p class="list-group-item-text"><a href="/news/">news archive...</a></p>
</div>
</div>
</div>
<h1>~current projects~</h1>
<div class="col-md-6">
<h1 id="projects">~current projects~</h1>
<h4>on our <a href="https://tildegit.org/team">gitea</a></h4>
<hr>
<div class="list-group">
@ -111,52 +113,46 @@ $parser = Tildeverse\Wiki\Parser::factory();
</div>
</div>
</div>
<hr>
<div class="col-md-5">
<h1>~users~</h1>
<p><em><a href="/tilde.24h.html"><i class="fa fa-clock-o"></i> recent updates</a></em></p>
<p>if you're not listed here, make some changes to your page</p>
<p><a href="/users/">all users</a></p>
<div class="list-group">
<ul>
<?php
$usercount = 0;
foreach (glob("/home/*/public_html", GLOB_ONLYDIR) as $user):
if (
(
// make sure we have an index page
!is_file("$user/index.html")
&& !is_file("$user/index.htm")
&& !is_file("$user/index.cgi")
&& !is_file("$user/index.php")
)
|| (
// if it's php, compare the hash to the default page
is_file("$user/index.php")
&& in_array(
sha1_file("$user/index.php"),
[
// these are the sha1s of two previous pages
"ca32714c33abb57430583ad07efec6097ae1a044",
"f190ba3a1ed796a20bea83304e45e799420c0716"
]
)
<div class="clearfix">
<h1 id="users">~users~</h1>
<p><em><a href="/tilde.24h.html"><i class="fa fa-clock-o"></i> recent updates</a></em> | <a href="/users/">all users</a></p>
<p>if you're not listed here, make some changes to your page</p>
<ul class="list-unstyled">
<?php
$usercount = 0;
foreach (glob("/home/*/public_html", GLOB_ONLYDIR) as $user):
if (
(
// make sure we have an index page
!is_file("$user/index.html")
&& !is_file("$user/index.htm")
&& !is_file("$user/index.cgi")
&& !is_file("$user/index.php")
)
|| (
// if it's php, compare the hash to the default page
is_file("$user/index.php")
&& in_array(
sha1_file("$user/index.php"),
[
// these are the sha1s of two previous pages
"ca32714c33abb57430583ad07efec6097ae1a044",
"f190ba3a1ed796a20bea83304e45e799420c0716"
]
)
) continue;
$user = basename(dirname($user));
$usercount++; ?>
<li style="list-style: none; margin-left: -40px;">
<a href="/~<?=$user?>/" class="list-group-item">
<h6 class="list-group-item-heading">~<?=$user?></h6>
</a>
</li>
<?php endforeach; ?>
</ul>
<p>users who have updated their homepages: <?=$usercount?></p>
</div>
</div>
)
) continue;
$user = basename(dirname($user));
$usercount++; ?>
<li><a href="/~<?=$user?>/" class="list-group-item col-xs-6 col-sm-4 col-md-2">~<?=$user?></a></li>
<?php endforeach; ?>
</ul>
</div>
<br>
<p>users who have updated their homepages: <?=$usercount?></p>
<?php include 'footer.php'; ?>

12
services.php

@ -16,9 +16,11 @@ $services = [
$nav = isset($navbar) && $navbar;
unset($navbar);
foreach ($services as $name => $service) { ?>
<?php if ($nav) echo '<li>'; ?>
<a href="<?=$service['url']?>" <?php if (!$nav) echo 'class="btn btn-default"'; ?>><i class="fa fa-<?=$service['fa']?>"></i> <?=$name?></a>
<?php if ($nav) echo '</li>' . PHP_EOL; ?>
<?php }
foreach ($services as $name => $service) {
if ($nav) { ?>
<li><a href="<?=$service["url"]?>"><i class="fa fa-<?=$service["fa"]?>"></i> <?=$name?></a></li>
<?php } else { ?>
<a href="<?=$service["url"]?>" class="btn btn-default"><i class="fa fa-<?=$service["fa"]?>"></i> <?=$name?></a>
<?php }
}

8
wiki/index.php

@ -3,14 +3,6 @@ $filepath = __FILE__;
require __DIR__.'/../vendor/autoload.php';
$additional_head = "
<style>
:target:before {
content:\"\";
display:block;
height:50px; /* fixed header height*/
margin:-50px 0 0; /* negative fixed header height */
}
</style>
<meta property='og:type' content='website'>
<meta property='og:image' content='https://tilde.team/apple-icon.png'>
<meta property='og:site_name' content='tilde.team wiki'>

Loading…
Cancel
Save