pub / tw2html

Checks online status of streams on twitch.tv and lets you watch them
git clone https://src.jayvii.de/pub/tw2html.git
Home | Log | Files | Exports | Refs | README | RSS

commit fa2e089e6c5645d770cb91a284aa6df2db8d09f9
parent 0da750cc64e4edf0c8c2236e423e49451dc0763d
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Sat, 20 Apr 2024 16:02:54 +0200

Layout improvements

Diffstat:
Massets/css/custom.css | 9+++++++--
Mindex.php | 80++++++++++++-------------------------------------------------------------------
2 files changed, 19 insertions(+), 70 deletions(-)

diff --git a/assets/css/custom.css b/assets/css/custom.css @@ -8,7 +8,13 @@ html, body { /* Navigation Bar */ #nav { font-size: 1.5em !important; - position: absolute!important; + /* position: absolute!important; */ + z-index: 1 !important; +} + +/* Article container */ +article { + padding-top: 2em !important; } /* External Player */ @@ -33,7 +39,6 @@ html, body { } } - /* Stream Preview Image */ .preview { display: block; diff --git a/index.php b/index.php @@ -177,8 +177,7 @@ if (!$loading_screen) { "class='button' " . // "target='_blank' " . "href='/?stream=" . rawurlencode($streams["stream"][$i]) . - "&game=" . rawurlencode($streams["game"][$i]) . - "#player' " . + "' " . "title='External Player'>" . "<img " . "class='button-img' " . @@ -292,8 +291,7 @@ if (!$loading_screen) { "1000);" . "</script>"; } else if ($extplayer) { - - $menu_items = "<li>" . rawurldecode($_GET["stream"]) . " - " . rawurldecode($_GET["game"]); + $menu_items = "<li>Playing stream of " . $_GET["stream"] . "</li>"; $content = "<div id='player'>" . "<div id='stream-window'>" . "<iframe id='stream' allowfullscreen scrolling='no' " . @@ -310,12 +308,8 @@ if (!$loading_screen) { "</iframe>" . "</div>" . "</div>" . - // FIXME: make full width on desktop - "<script>setTimeout(function() { document.querySelector('div.container').style.width='100%'; }, 500);</script>" . // FIXME: make chat full height - "<script>setTimeout(function() { document.querySelector('#chat-window').style.height=document.querySelector('#stream-window').offsetHeight + 'px'; }, 1000);</script>" . - // FIXME: scroll to player after load - "<script>setTimeout(function() { location.hash = '#player'; }, 1500);</script>"; + "<script>setTimeout(function() { document.querySelector('#chat-window').style.height=document.querySelector('#stream-window').offsetHeight + 'px'; }, 1000);</script>"; } else { @@ -356,10 +350,9 @@ if (!$loading_screen) { "<li>" . // Reoad Button "<a " . - "href=\"javascript:" . - "window.location='/?streams=" . + "href=\"./?streams=" . implode(",", $streams["stream"]) . - "';\"" . + "\"" . "title='Reload' " . "id='button-reload'>" . "&#8635;" . @@ -371,72 +364,23 @@ if (!$loading_screen) { </ul> </nav> - <article id="top" class="wrapper"> + <article class="wrapper"> <!-- SITE CONTENT --> - <div class="container"> - <?php - echo $content; -?> - - </div> - - <!-- DEVELOPER INFORMATION --> - - <div class="container"> - <details> - <summary>Developer Information</summary> -<?php - // Loading time - echo "<p>&#9201; " . - ((time() -$time0) / sizeof($streams["stream"])) . - "s</p>"; -?> - - <table> - <thead> - <tr> - <th></th> - <th>Username</th> - <th>Online</th> - <th>Time</th> - <th>Desription</th> - </tr> - </thead> - <tbody> + if (!$extplayer) { + echo "<div class=\"container\">"; + } -<?php + echo $content; - // Streams Table - for ($i = 0; $i < sizeof($streams["stream"]); $i++) { - echo "<tr>" . - // ID - "<td>" . ($i + 1) . "</td>" . - // Name & URL - "<td>" . - "<a href='https://twitch.tv/" . $streams["stream"][$i] . "'>" . - $streams["stream"][$i] . - "</a>" . - "</td>" . - // Status - "<td>" . - array("&#10008;", "&#10003;")[$streams["status"][$i]] . - "</td>" . - // Time - "<td>" . $streams["time"][$i] . "</td>" . - // Description - "<td>" . $streams["desc"][$i] . "</td>" . - "</tr>"; + if (!$extplayer) { + echo "</div>"; } ?> - </tbody> - </table> - </details> - </div> </article> </body> </html>