mirror of
https://github.com/sorenpeter/timeline.git
synced 2025-12-13 01:47:01 +00:00
Added Time-ago column to following-page
This commit is contained in:
parent
34a52988e0
commit
a65727ccd4
7 changed files with 34 additions and 11 deletions
|
|
@ -1,3 +1,5 @@
|
|||
/* Copy this file to custom.css and edit the styling as you like */
|
||||
|
||||
/* === Custom CSS based on: https://github.com/ilyadzh/plain-css */
|
||||
|
||||
:root {
|
||||
|
|
|
|||
|
|
@ -396,6 +396,7 @@ function getTwtsFromTwtxtString($url) {
|
|||
|
||||
$twt->originalTwtStr = $currentLine;
|
||||
$twt->hash = getHashFromTwt($currentLine, $twtxtData->mainURL);
|
||||
$twt->timestamp = $timestamp;
|
||||
$twt->fullDate = date('j F Y h:i:s A', $timestamp) . ' (UTC)';
|
||||
$twt->displayDate = $displayDate;
|
||||
$twt->content = $twtContent;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ $title = "Timeline"; // Fallback, should be set in all views
|
|||
|
||||
// HACKED by sp@darch.dk
|
||||
if(!empty($_GET['list'])) {
|
||||
$url = "https://darch.dk/twtxt-lists/".$_GET['list'];
|
||||
$url = $baseURL.$_GET['list'];
|
||||
//$url = "https://darch.dk/".$_GET['list'];
|
||||
}
|
||||
else {
|
||||
$url = $config['public_txt_url'];
|
||||
|
|
|
|||
|
|
@ -21,15 +21,15 @@ $profile = getTwtsFromTwtxtString($config['public_txt_url']);
|
|||
<header>
|
||||
<p>
|
||||
<a href="/">
|
||||
<!-- <img class="logo" src="<?= $baseURL ?>/media/logo.png"> -->
|
||||
<img class="logo" src="<?= $baseURL ?>/media/logo.png">
|
||||
<?= $config['site_title']; ?>
|
||||
</a>
|
||||
<!-- <a href="/">
|
||||
<img class="avatar" src="<?= $profile->avatar ?>" alt="" loading="lazy">
|
||||
<img class="logo" src="<?= $profile->avatar ?>" alt="" loading="lazy">
|
||||
<?= parse_url($profile->mainURL, PHP_URL_HOST); ?>
|
||||
</a>
|
||||
<a href="/">
|
||||
<img class="avatar" src="<?= $profile->avatar ?>" alt="" loading="lazy">
|
||||
<img class="logo" src="<?= $profile->avatar ?>" alt="" loading="lazy">
|
||||
<?= $profile->nick ?>@<?= parse_url($profile->mainURL, PHP_URL_HOST); ?>
|
||||
</a> -->
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@
|
|||
$listName = str_replace("twtxt-", "", $listName);
|
||||
$listName = str_replace("_", " ", $listName);
|
||||
$listName = str_replace(".txt", "", $listName);
|
||||
//$filename = "TODO".$baseURL."/".$filename;
|
||||
echo "<option value='{$filename}' {$attr}>$listName</option>";
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<noscript><button type="submit">View list</button></noscript>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ $profileURL = $baseURL . '/?profile=' . $profile->mainURL;
|
|||
|
||||
<div class="profile">
|
||||
|
||||
<a href="<?=$profileURL?>">
|
||||
<a href="<?=$profile->avatar?>">
|
||||
<img class="avatar" src="<?=$profile->avatar?>" onerror="this.onerror=null;this.src='<?= $baseURL ?>/media/default.png';">
|
||||
</a>
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@ include 'partials/header.php';
|
|||
<tr>
|
||||
<!-- <th></th> -->
|
||||
<th>Nick</th>
|
||||
<th>URL</th></tr>
|
||||
<th>URL</th>
|
||||
<th>Time ago</th>
|
||||
</tr>
|
||||
|
||||
<?php foreach ($twtFollowingList as $currentFollower) { ?>
|
||||
<tr>
|
||||
|
|
@ -22,9 +24,26 @@ include 'partials/header.php';
|
|||
<td><a href="<?= $baseURL ?>/?profile=<?= $currentFollower[1] ?>"><?= $currentFollower[0] ?></a></td>
|
||||
<!-- <td><a href="/?twt=<?= $currentFollower[1] ?>"><?= $currentFollower[0] ?></a></td> -->
|
||||
<td><?= $currentFollower[1] ?>
|
||||
<!-- <?php if ($validSession) { ?> -->
|
||||
<!-- <a href="?remove_url=<?= $currentFollower[1] ?>">Remove</a> -->
|
||||
<!-- <?php } ?> -->
|
||||
<!-- <?php //if ($validSession) { ?> -->
|
||||
<!-- <a href="?remove_url=<?= $currentFollower[1] ?>">Remove</a> -->
|
||||
<!-- <?php // } ?> -->
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
// Test first if URL is a valid feed:
|
||||
if (is_array(getTwtsFromTwtxtString($currentFollower[1])->twts)) {
|
||||
|
||||
// Then test if latest twt is at top or bottom of file:
|
||||
$resetVar = reset(getTwtsFromTwtxtString($currentFollower[1])->twts);
|
||||
$endVar = end(getTwtsFromTwtxtString($currentFollower[1])->twts);
|
||||
if ($resetVar->timestamp < $endVar->timestamp) { // TODO: this can be swapped to get time of first twt
|
||||
echo $endVar->displayDate;
|
||||
} else {
|
||||
echo $resetVar->displayDate;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
|
|
|||
Loading…
Reference in a new issue