1
0
Fork 0
mirror of https://github.com/mwalbeck/twitchlite.git synced 2025-06-09 23:40:15 +00:00
twitchlite/index.php

64 lines
3.4 KiB
PHP
Raw Normal View History

2017-05-09 11:11:13 +02:00
<?php
2017-10-11 16:49:25 +02:00
require 'logic.php';
2017-05-09 11:11:13 +02:00
?>
<html>
<header>
<link rel=stylesheet href="style.css" type="text/css">
<title>twitchLite</title>
2017-05-09 11:11:13 +02:00
</header>
<body>
<nav>
2017-07-30 21:52:29 +02:00
<form class="input" method="get">
<label for="limit">Limit (1-100):</label>
<input id="limit" type="number" min="1" max="100" value="<?php echo $_GET['limit']; ?>" name="limit">
<label for="game">Game:</label>
<input id="game" type="text" autocomplete="off" name="game" value="<?php echo $_GET['game']; ?>" list="games">
<?php if (isset($user_id) && !empty($user_id)) : ?>
<label for="only_followed">Only followed:</label>
<input id="only_followed" type="checkbox" name="only_followed" value="1"
2020-06-20 21:59:23 +02:00
<?php echo $_GET['only_followed'] === "1" ? "checked" : ""; ?> >
<input type="hidden" name="ofh" value="0">
<?php endif; ?>
<input type="submit" value="Submit">
2017-05-09 11:11:13 +02:00
</form>
2017-10-11 16:49:25 +02:00
<form class="input-prev-next" method="get">
<input type="hidden" name="limit" value="<?php echo $_GET['limit']; ?>">
<button type="submit" name="" value="">To begining</button>
<button type="submit" name="after" value="<?php echo array_key_exists("pagination", $content) ? $content["pagination"]["cursor"] : ""; ?>">Next</button>
2020-06-20 21:59:23 +02:00
<input type="hidden" name="game" value="<?php echo $_GET['game']; ?>">
<input type="hidden" name="only_followed" value="<?php echo $_GET['only_followed'] ? "1" : "0"; ?>">
2017-10-11 16:49:25 +02:00
</form>
2017-10-10 16:55:11 +02:00
<?php if (isset($get_top_games) && $get_top_games === true) : ?>
<datalist id="games">
<?php foreach ($games["data"] as $game) : ?>
<option value="<?php echo $game["id"]; ?>"><?php echo $game["name"]; ?></option>
<?php endforeach; ?>
</datalist>
<?php endif; ?>
</nav>
2017-05-09 11:11:13 +02:00
<div id="content">
<div class="container">
<?php foreach ($content["data"] as $stream) : ?>
<?php if (isset($_GET['only_followed']) && !empty($_GET['game']) && $_GET['game'] !== $stream["game_id"]) {
continue;
} ?>
2017-05-09 11:11:13 +02:00
<div class="stream">
<a href="https://twitch.tv/<?php echo $stream["user_login"]; ?>">
<img src="<?php echo str_replace(["{width}", "{height}"], ["320", "180"], $stream["thumbnail_url"]); ?>">
2017-10-11 16:49:25 +02:00
</a>
<br>
<span class="user"><strong>User:</strong> <?php echo $stream["user_name"]; ?></span><br>
<span class="game"><strong>Game:</strong> <?php echo $stream["game_name"]; ?></span><br>
<span class="viewers"><strong>Viewers:</strong> <?php echo $stream["viewer_count"]; ?></span><br>
<a href="<?php echo "https://twitch.tv/popout/" . $stream["user_login"] . "/chat" ?>">
2020-06-20 21:34:03 +02:00
<span class="chat">Link to chat</span>
</a>
2017-05-09 11:11:13 +02:00
<hr class="status-split">
<span class="status"><?php echo $stream["title"]; ?></span><br>
2017-05-09 11:11:13 +02:00
</div>
<?php endforeach; ?>
</div>
</div>
</body>
2017-05-13 14:56:48 +00:00
</html>