Files
GridTV/src/tpl/topbar.php
T

67 lines
3.3 KiB
PHP

<div class="topbar">
<div class="logo"><?= $group_name ?> <span>/</span><span class="logo-sub"> GridTV</span></div>
<div class="date-label" id="dateLabel"></div>
<div class="clock" id="clock">00:00:00</div>
<div class="nav-btns" id="navBtns">
<button class="nav-btn" onclick="shiftView(-60)"><?= htmlspecialchars($L["shift_back"]) ?></button>
<button class="nav-btn active" onclick="centerNow()"><?= htmlspecialchars($L["now"]) ?></button>
<button class="nav-btn" onclick="shiftView(60)"><?= htmlspecialchars($L["shift_fwd"]) ?></button>
</div>
<div class="copy-btns">
<button class="copy-btn" onclick="copyUrl('epg')" title="<?= htmlspecialchars($L["copy_epg"]) ?>"><?= htmlspecialchars($L["copy_epg"]) ?></button>
<?php if (!empty($m3u_url)): ?>
<button class="copy-btn" onclick="copyUrl('m3u')" title="<?= htmlspecialchars($L["copy_m3u"]) ?>"><?= htmlspecialchars($L["copy_m3u"]) ?></button>
<?php endif; ?>
</div>
<?php if (count($epg_sources) > 1 || $allow_personal_epg): ?>
<div class="source-dropdown" id="sourceDropdown">
<button class="source-dropdown-btn" onclick="toggleSourceDropdown()" id="sourceDropdownBtn">
<span id="sourceDropdownLabel"><?= htmlspecialchars($epg_sources[0]['name'] ?? 'EPG') ?></span>
<span class="source-dropdown-arrow">&#9660;</span>
</button>
<div class="source-dropdown-menu" id="sourceDropdownMenu">
<?php foreach ($epg_sources as $i => $src): ?>
<button class="source-dropdown-item<?= $i === 0 ? ' active' : '' ?>" onclick="switchSource(<?= $i ?>); closeSourceDropdown()">
<?= htmlspecialchars($src['name']) ?>
</button>
<?php endforeach; ?>
<?php if ($allow_personal_epg): ?>
<button class="source-dropdown-item source-dropdown-personal" onclick="switchSource('personal'); closeSourceDropdown()">
&#9998; Personal EPG
</button>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<select class="theme-select" id="themeSelect" onchange="setTheme(this.value)" title="Thème">
<?php
$theme_dir = __DIR__ . '/../../themes';
$theme_files = glob($theme_dir . '/*.css');
// Put the default theme first, then sort the rest alphabetically.
usort($theme_files, function($a, $b) {
$a_base = basename($a, '.css');
$b_base = basename($b, '.css');
if ($a_base === 'default') return -1;
if ($b_base === 'default') return 1;
return strcmp($a_base, $b_base);
});
foreach ($theme_files as $file) {
$slug = basename($file, '.css');
$css = file_get_contents($file);
// Read @name and @emoji from the first comment block.
preg_match('/@name\s+(.+)/u', $css, $m_name);
preg_match('/@emoji\s+(\S+)/u', $css, $m_emoji);
$name = isset($m_name[1]) ? trim($m_name[1]) : ucfirst($slug);
$emoji = isset($m_emoji[1]) ? trim($m_emoji[1]) : '🎨';
echo ' <option value="' . htmlspecialchars($slug) . '">' . $emoji . ' ' . $name . '</option>' . "\n";
}
?>
</select>
<button class="search-btn" onclick="toggleSearch()" title="Search">&#128269;</button>
<div class="live-dot"><?= htmlspecialchars($L["live"]) ?></div>
</div>
<div class="search-bar" id="searchBar">
<input class="search-input" id="searchInput" type="text" placeholder="<?= htmlspecialchars($L["search_placeholder"]) ?>" oninput="onSearchInput(this.value)" />
<button class="search-clear" onclick="clearSearch()">&#10005;</button>
</div>