feat: add iframe support
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Kazhnuz 2023-11-15 19:04:22 +01:00
parent 7c69e1c1b6
commit 5595ab76a3
4 changed files with 132 additions and 7 deletions

43
iframe-sega.php Normal file
View file

@ -0,0 +1,43 @@
<?php
header('Content-Type: text/html; charset=utf-8');
if (!ini_get('date.timezone')) {
date_default_timezone_set('Europe/Paris');
}
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once 'feed.php';
$rssSonic = Feed::loadRss('https://shaarli.kazhnuz.space/feed/rss?&searchtags=Sonic');
$rssSEGA = Feed::loadRss('https://shaarli.kazhnuz.space/feed/rss?&searchtags=SEGA');
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Press Garden Zone</title>
<link rel="stylesheet" href="./iframe.css">
<link rel="icon" href="./favicon.png">
</head>
<body>
<main>
<?php $i = 1; ?>
<?php foreach ($rssSEGA->item as $item): ?>
<?php if ($i <= 6) { ?>
<article>
<div><a href="/?show=sega#news-sega-<?php echo $i ?>" target="_blank"><?php echo htmlspecialchars($item->title) ?></a></div>
<div><small><?php echo date('j.n.Y H:i', (int) $item->timestamp) ?></small></div>
</article>
<?php $i++; ?>
<?php } ?>
<?php endforeach ?>
</main>
</body>
</html>

43
iframe-sonic.php Normal file
View file

@ -0,0 +1,43 @@
<?php
header('Content-Type: text/html; charset=utf-8');
if (!ini_get('date.timezone')) {
date_default_timezone_set('Europe/Paris');
}
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once 'feed.php';
$rssSonic = Feed::loadRss('https://shaarli.kazhnuz.space/feed/rss?&searchtags=Sonic');
$rssSEGA = Feed::loadRss('https://shaarli.kazhnuz.space/feed/rss?&searchtags=SEGA');
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Press Garden Zone</title>
<link rel="stylesheet" href="./iframe.css">
<link rel="icon" href="./favicon.png">
</head>
<body>
<main>
<?php $i = 1; ?>
<?php foreach ($rssSonic->item as $item): ?>
<?php if ($i <= 6) { ?>
<article>
<div><a href="/#news-sonic-<?php echo $i ?>" target="_blank"><?php echo htmlspecialchars($item->title) ?></a></div>
<div><small><?php echo date('j.n.Y H:i', (int) $item->timestamp) ?></small></div>
</article>
<?php $i++; ?>
<?php } ?>
<?php endforeach ?>
</main>
</body>
</html>

29
iframe.css Normal file
View file

@ -0,0 +1,29 @@
body {
font-family: Inter, Cantarell, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
margin:0;
padding:0;
}
article {
display: flex;
justify-content: space-between;
padding: 3px;
background-color: rgba(0,0,255,0.08);
border-radius: 4px;
}
article:not(:first-child) {
margin-top: 3px;
}
article div:first-child {
text-overflow: ellipsis;
overflow: hidden;
white-space:nowrap;
}
article div:last-child {
width:120px;
min-width: 120px;
text-align: right;
}

View file

@ -14,6 +14,11 @@
$rssSonic = Feed::loadRss('https://shaarli.kazhnuz.space/feed/rss?&searchtags=Sonic'); $rssSonic = Feed::loadRss('https://shaarli.kazhnuz.space/feed/rss?&searchtags=Sonic');
$rssSEGA = Feed::loadRss('https://shaarli.kazhnuz.space/feed/rss?&searchtags=SEGA'); $rssSEGA = Feed::loadRss('https://shaarli.kazhnuz.space/feed/rss?&searchtags=SEGA');
$showSEGA = false;
if ($_GET != null && $_GET["show"] == "sega") {
$showSEGA = true;
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@ -30,33 +35,38 @@
<header> <header>
<nav> <nav>
<ul> <ul>
<li><a href="#" class="active" id="link-sonic">Sonic</a></li> <li><a href="#" <?php if ($showSEGA == false) { ?> class="active" <?php } ?> id="link-sonic">Sonic</a></li>
<li><a href="#" id="link-sega">SEGA</a></li> <li><a href="#" <?php if ($showSEGA == true ) { ?> class="active" <?php } ?> id="link-sega">SEGA</a></li>
</ul> </ul>
</nav> </nav>
</header> </header>
<main> <main>
<h1 id="head">Press Garden Zone</h1> <h1 id="head">Press Garden Zone</h1>
<section class="shown" id="section-sonic"> <section <?php if ($showSEGA == false) { ?> class="shown" <?php } ?> id="section-sonic">
<?php $i = 1; ?> <?php $i = 1; ?>
<?php foreach ($rssSonic->item as $item): ?> <?php foreach ($rssSonic->item as $item): ?>
<?php if ($i <= 8) { ?> <?php if ($i <= 12) { ?>
<article> <article id="news-sonic-<?php echo $i; ?>">
<h2><a href="<?php echo htmlspecialchars($item->url) ?>"><?php echo htmlspecialchars($item->title) ?></a> <h2><a href="<?php echo htmlspecialchars($item->url) ?>"><?php echo htmlspecialchars($item->title) ?></a>
<small><?php echo date('j.n.Y H:i', (int) $item->timestamp) ?></small></h2> <small><?php echo date('j.n.Y H:i', (int) $item->timestamp) ?></small></h2>
<div><?php echo $item->description ?></div> <div><?php echo $item->description ?></div>
</article> </article>
<?php $i++; ?>
<?php } ?> <?php } ?>
<?php endforeach ?> <?php endforeach ?>
<div class="btn-area"><a class="btn" href="https://shaarli.kazhnuz.space/?searchtags=Sonic"> Plus ancien articles </a></div> <div class="btn-area"><a class="btn" href="https://shaarli.kazhnuz.space/?searchtags=Sonic"> Plus ancien articles </a></div>
</section> </section>
<section id="section-sega"> <section <?php if ($showSEGA == true ) { ?> class="shown" <?php } ?> id="section-sega">
<?php $i = 1; ?>
<?php foreach ($rssSEGA->item as $item): ?> <?php foreach ($rssSEGA->item as $item): ?>
<article> <?php if ($i <= 12) { ?>
<article id="news-sega-<?php echo $i; ?>">
<h2><a href="<?php echo htmlspecialchars($item->url) ?>"><?php echo htmlspecialchars($item->title) ?></a> <h2><a href="<?php echo htmlspecialchars($item->url) ?>"><?php echo htmlspecialchars($item->title) ?></a>
<small><?php echo date('j.n.Y H:i', (int) $item->timestamp) ?></small></h2> <small><?php echo date('j.n.Y H:i', (int) $item->timestamp) ?></small></h2>
<div><?php echo $item->description ?></div> <div><?php echo $item->description ?></div>
</article> </article>
<?php $i++; ?>
<?php } ?>
<?php endforeach ?> <?php endforeach ?>
<div class="btn-area"><a class="btn" href="https://shaarli.kazhnuz.space/?searchtags=SEGA"> Plus ancien articles </a></div> <div class="btn-area"><a class="btn" href="https://shaarli.kazhnuz.space/?searchtags=SEGA"> Plus ancien articles </a></div>
</section> </section>