<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Seri-o-meter</title>
<link rel="stylesheet" href="style.css" type="text/css">
<script type="text/javascript">
/*
function setStyle(obj, style)
{
var styleProperties = Object.getOwnPropertyNames(style);
for (var i = styleProperties.length; i--;)
{
var prop = styleProperties[i];
obj.style[prop] = style[prop];
}
}
function editor()
{
var div = document.createElement("div");
setStyle(div, {
position: "fixed",
right: "0",
top: "0",
width: "200px",
bottom: "0",
backgroundColor: "#ccc"
});
document.body.appendChild(div);
function findRules(selectorText)
{
var slice = Array.prototype.slice;
function toArray(obj)
{
return slice.call(obj);
}
var rx = new RegExp("(^|\\s)" + selectorText.replace(/[^$.(){}\[\]]/, "\\$&") + "\\s*$");
var hits = toArray(document.styleSheets).map(function (styleSheet) {
return toArray(styleSheet.cssRules || styleSheet.rules).filter(function (rule) {
return rx.test(rule.selectorText);
});
}).filter(function (hit) {
return hit.length > 0;
});
return Array.prototype.concat.apply([], hits);
}
var afterRule = findRules(".heroes .o::after");
var rxBgImage = new RegExp(
"{RADIALGRADIENT}\\(\\s*({POSITION}\\s*,\\s*)?({SHAPE}\\s*,\\s*)?{COLORSTOP}(\\s*,\\s*{COLORSTOP})+\\s*\\)"
.replace(/\{RADIALGRADIENT\}/g, "(-(webkit|moz|o|ms)-)?radial-gradient")
.replace(/\{POSITION\}/g, "{LENGTH}(\\s+{LENGTH})?")
.replace(/\{SHAPE\}/g, "\\s*((circle|ellipse)(\\s+({EDGE}))?|{LENGTH}(\\s+{LENGTH}))")
.replace(/\{EDGE\}/g, "cover|closest-corner|closest-side|farthest-corner|farthest-side")
.replace(/\{COLORSTOP\}/g, "{COLOR}(\\s*{PERCENTAGE})?")
.replace(/\{LENGTH\}/g, "{NUMBER}{UNIT}")
.replace(/\{COLOR\}/g, "({COLORNAME}|{RGB}|{RGBA})")
.replace(/\{RGB\}/g, "rgb\\s*\\(\\s*{COLORCOMP}(\\s*,\\s*{COLORCOMP}){2}\\s*\\)")
.replace(/\{RGBA\}/g, "rgba\\s*\\(\\s*{COLORCOMP}(\\s*,\\s*{COLORCOMP}){2}\\s*,\\s*{PERCENTAGE}\\s*\\)")
.replace(/\{COLORCOMP\}/g, "{NUMBER}%?")
.replace(/\{COLORNAME\}/g, "black|transparent")
.replace(/\{PERCENTAGE\}/g, "{NUMBER}%?")
.replace(/\{NUMBER\}/g, "\\d+")
.replace(/\{UNIT\}/g, "(px|%|em|ex|pt)")
, "g");
console.log(rxBgImage);
var value = afterRule[0].style.getPropertyValue("background-image");
console.log(value);
var backgroundImages = value.match(rxBgImage);
console.log(backgroundImages);
}
*/
function net()
{
var map = {
"gene-roddenberry's-andromeda": "andromeda",
"battlestar-galactica-2004": "battlestar-galactica",
"battlestar-galactica-2004-de": "battlestar-galactica",
"buffy-the-vampire-slayer": "buffy",
get: function (key) {
return this.hasOwnProperty(key) ? this[key] : key;
}
};
var f = function (e) {
if (e && e.shiftKey && e.ctrlKey)
{
var key = map.get(this.textContent.toLowerCase()
.replace(/[,()–]/g, "").replace(/\s+/g, "-").replace("-de", ""));
window.open("http://serienjunkies.org/serie/" + encodeURIComponent(key));
e.preventDefault();
}
};
try
{
for (var a = document.links, i = a.length; i--;)
{
var e = a[i];
e.addEventListener("click", f, false);
}
}
catch (e) {}
}
</script>
</head>
<body onload="net() // editor()">
<h1 class="hidden">Seri-o-meter</h1>
<?php // var_dump($serien); ?>
<table
>
<?php
setlocale(LC_ALL
, 'de_CH.UTF-8');
foreach ($serien as $name => &$serie)
{
?>
<tr>
<td style="text-align: center">
<?php
$recommended = ($name === $min_series);
if ($recommended) { ?>→
<?php }
if (isset($serie['ignore']) && $serie['ignore'])
{
?>→<span style="color: red; font-weight: bold">⃠</span>
<?php
}
?></td>
<th
<?php if ($recommended) { ?> class="recommended"
<?php } ?>>
<?php
$ep_list = isset($serie['episode_list']);
if ($ep_list)
{
?><a href="
<?php
echo htmlspecialchars($serie['episode_list']);
?>" title="Episodenliste">
<?php
}
echo $name;
if ($ep_list) { ?></a>
<?php }
?><br>
<span style="font-weight: normal">
<?php
if (array_key_exists('channel', $serie)) echo $serie['channel'];
if (array_key_exists('showtimes', $serie))
{
echo ', ' . $serie['showtimes'];
}
?></span></th>
<td
<?php if ($recommended) { ?> class="recommended"
<?php } ?>>
<div>Gesehen:
<?php
echo implode(', ', $serie['coverage']) . ' ('. $serie['count'];
?> von
<?php $total = $serie['total']; echo $total; ?> Episoden)
<?php
if (isset($serie['last_seen']))
{
?>; zuletzt am
<?php
echo strftime('%A, %e. %B %Y %H:%M %z', $serie['last_seen']);
}
?></div>
<div class="box">
<div class="meter"
style="width:
<?php
$percentage = $serie['percentage'];
echo $percentage; ?>%"
></div>
<?php
if (array_key_exists('seasons', $serie))
{
$offset = 0;
foreach ($serie['seasons'] as $key => $season)
{
?>
<div class="season"
<?php
if (!is_numeric($key))
{
?> title="
<?php echo htmlspecialchars($key); ?>"
<?php
}
?>
style="
<?php
if ($key === 0)
{
?>border-left: none;
<?php
}
?>left:
<?php echo $offset; ?>%;
width:
<?php echo $season / $total * 100; ?>%"
>
<?php
if (is_numeric($key))
{
echo ($key + 1);
}
else
{
echo $key;
}
?></div>
<?php
$offset += round($season / $total * 100, 1);
}
}
if (isset($serie['episodes']))
{
$prevNumber = null;
foreach ($serie['episodes'] as $episode => $description)
{
$episode_str = $episode;
if (isset($serie['season_ranges']) && is_array($serie['season_ranges']))
{
foreach ($serie['season_ranges'] as $season_key => $season_range)
{
if ($episode >= $season_range[0] && $episode <= $season_range[1])
{
$episode_str = sprintf("%u (%ux%02u)", $episode, $season_key, $episode - $season_range[0] + 1);
}
}
}
?>
<div class="coverage"
style="
<?php
if (is_null($prevNumber) || $prevNumber !== $episode - 1)
{
?>border-left: 1px solid rgba(0, 218, 0, 0.5);
<?php
}
?>
border-right: 1px solid rgba(0, 218, 0, 0.5);
background-color: transparent;
left:
<?php echo ($episode - 1) / $total * 100; ?>%;
width:
<?php echo 1 / $total * 100; ?>%"
title="
<?php
echo "{$episode_str}: " . htmlspecialchars($description);
?>"></div>
<?php
$prevNumber = $episode;
}
}
if (isset($serie['seen']))
{
foreach ($serie['seen'] as $range)
{
if (!is_array($range))
{
$range = array($range, $range);
}
/*
for ($i = $episode[0]; $i < $episode[1]; ++$i)
{
?>
<div class="coverage"
style="left: <?php echo ($episode[0] - 1) / $total * 100; ?>%;
width: <?php echo ($episode[1] - $episode[0] + 1) / $total * 100; ?>%"
></div>
<?php
}
}
else
*/
for ($episode = $range[0]; $episode <= $range[1]; ++$episode)
{
$episode_str = $episode;
if (isset($serie['season_ranges']) && is_array($serie['season_ranges']))
{
foreach ($serie['season_ranges'] as $season_key => $season_range)
{
if ($episode >= $season_range[0] && $episode <= $season_range[1])
{
$episode_str = sprintf("%u (%ux%02u)", $episode, $season_key, $episode - $season_range[0] + 1);
}
}
}
?>
<div class="coverage"
style="left:
<?php echo ($episode - 1) / $total * 100; ?>%;
width:
<?php echo 1 / $total * 100; ?>%"
<?php
if (isset($serie['episodes']) && array_key_exists($episode, $serie['episodes']))
{
?>title="
<?php
echo "{$episode_str}: " . htmlspecialchars($serie['episodes'][$episode]);
?>"
<?php
}
?>></div>
<?php
}
}
}
?>
<span class="percentage">
<?php echo round($percentage, 1); ?>%</span>
</div>
</td>
</tr>
<?php
}
?>
</table>
</body>
</html>