Rev 64 | Rev 193 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 172 | PointedEar | 1 | <?php header('Content-Type: text/html; charset=UTF-8'); ?> |
| 26 | PointedEar | 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 3 | "http://www.w3.org/TR/html4/strict.dtd"> |
||
| 4 | <html lang="de"> |
||
| 5 | <head> |
||
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
||
| 7 | <title>Seri-o-meter</title> |
||
| 32 | PointedEar | 8 | <?php |
| 9 | // require_once 'css/lessphp/lessc.inc.php'; |
||
| 10 | // lessc::ccompile('style.less', 'style-less.css'); |
||
| 64 | PointedEar | 11 | // require_once 'css/least/LEAST.php'; |
| 12 | // de\pointedears\css\least\LEAST::compile('style.css', 'style-least.css'); |
||
| 32 | PointedEar | 13 | ?> |
| 26 | PointedEar | 14 | <link rel="stylesheet" href="style.css" type="text/css"> |
| 15 | <script type="text/javascript"> |
||
| 16 | /* |
||
| 17 | function setStyle(obj, style) |
||
| 18 | { |
||
| 19 | var styleProperties = Object.getOwnPropertyNames(style); |
||
| 20 | for (var i = styleProperties.length; i--;) |
||
| 21 | { |
||
| 22 | var prop = styleProperties[i]; |
||
| 23 | obj.style[prop] = style[prop]; |
||
| 24 | } |
||
| 25 | } |
||
| 172 | PointedEar | 26 | |
| 26 | PointedEar | 27 | function editor() |
| 28 | { |
||
| 29 | var div = document.createElement("div"); |
||
| 30 | setStyle(div, { |
||
| 31 | position: "fixed", |
||
| 32 | right: "0", |
||
| 33 | top: "0", |
||
| 34 | width: "200px", |
||
| 35 | bottom: "0", |
||
| 36 | backgroundColor: "#ccc" |
||
| 37 | }); |
||
| 38 | document.body.appendChild(div); |
||
| 39 | |||
| 40 | function findRules(selectorText) |
||
| 41 | { |
||
| 42 | var slice = Array.prototype.slice; |
||
| 43 | function toArray(obj) |
||
| 44 | { |
||
| 45 | return slice.call(obj); |
||
| 46 | } |
||
| 47 | |||
| 48 | var rx = new RegExp("(^|\\s)" + selectorText.replace(/[^$.(){}\[\]]/, "\\$&") + "\\s*$"); |
||
| 49 | var hits = toArray(document.styleSheets).map(function (styleSheet) { |
||
| 50 | return toArray(styleSheet.cssRules || styleSheet.rules).filter(function (rule) { |
||
| 51 | return rx.test(rule.selectorText); |
||
| 52 | }); |
||
| 53 | }).filter(function (hit) { |
||
| 54 | return hit.length > 0; |
||
| 55 | }); |
||
| 56 | |||
| 57 | return Array.prototype.concat.apply([], hits); |
||
| 58 | } |
||
| 59 | |||
| 60 | var afterRule = findRules(".heroes .o::after"); |
||
| 61 | var rxBgImage = new RegExp( |
||
| 62 | "{RADIALGRADIENT}\\(\\s*({POSITION}\\s*,\\s*)?({SHAPE}\\s*,\\s*)?{COLORSTOP}(\\s*,\\s*{COLORSTOP})+\\s*\\)" |
||
| 63 | .replace(/\{RADIALGRADIENT\}/g, "(-(webkit|moz|o|ms)-)?radial-gradient") |
||
| 64 | .replace(/\{POSITION\}/g, "{LENGTH}(\\s+{LENGTH})?") |
||
| 65 | .replace(/\{SHAPE\}/g, "\\s*((circle|ellipse)(\\s+({EDGE}))?|{LENGTH}(\\s+{LENGTH}))") |
||
| 66 | .replace(/\{EDGE\}/g, "cover|closest-corner|closest-side|farthest-corner|farthest-side") |
||
| 67 | .replace(/\{COLORSTOP\}/g, "{COLOR}(\\s*{PERCENTAGE})?") |
||
| 68 | .replace(/\{LENGTH\}/g, "{NUMBER}{UNIT}") |
||
| 69 | .replace(/\{COLOR\}/g, "({COLORNAME}|{RGB}|{RGBA})") |
||
| 70 | .replace(/\{RGB\}/g, "rgb\\s*\\(\\s*{COLORCOMP}(\\s*,\\s*{COLORCOMP}){2}\\s*\\)") |
||
| 71 | .replace(/\{RGBA\}/g, "rgba\\s*\\(\\s*{COLORCOMP}(\\s*,\\s*{COLORCOMP}){2}\\s*,\\s*{PERCENTAGE}\\s*\\)") |
||
| 72 | .replace(/\{COLORCOMP\}/g, "{NUMBER}%?") |
||
| 73 | .replace(/\{COLORNAME\}/g, "black|transparent") |
||
| 74 | .replace(/\{PERCENTAGE\}/g, "{NUMBER}%?") |
||
| 75 | .replace(/\{NUMBER\}/g, "\\d+") |
||
| 76 | .replace(/\{UNIT\}/g, "(px|%|em|ex|pt)") |
||
| 77 | , "g"); |
||
| 78 | console.log(rxBgImage); |
||
| 79 | var value = afterRule[0].style.getPropertyValue("background-image"); |
||
| 80 | console.log(value); |
||
| 81 | var backgroundImages = value.match(rxBgImage); |
||
| 82 | console.log(backgroundImages); |
||
| 83 | } |
||
| 84 | */ |
||
| 85 | function net() |
||
| 86 | { |
||
| 87 | var map = { |
||
| 88 | "gene-roddenberry's-andromeda": "andromeda", |
||
| 89 | "battlestar-galactica-2004": "battlestar-galactica", |
||
| 90 | "battlestar-galactica-2004-de": "battlestar-galactica", |
||
| 91 | "buffy-the-vampire-slayer": "buffy", |
||
| 32 | PointedEar | 92 | "lois-clark-the-new-adventures-of-superman": "lois-clark-the-new-adventures-of-superman-1993", |
| 26 | PointedEar | 93 | get: function (key) { |
| 94 | return this.hasOwnProperty(key) ? this[key] : key; |
||
| 95 | } |
||
| 96 | }; |
||
| 172 | PointedEar | 97 | |
| 26 | PointedEar | 98 | var f = function (e) { |
| 99 | if (e && e.shiftKey && e.ctrlKey) |
||
| 100 | { |
||
| 101 | var key = map.get(this.textContent.toLowerCase() |
||
| 32 | PointedEar | 102 | .replace(/[&:.,()–]/g, "").replace(/\s+/g, "-").replace("-de", "")); |
| 26 | PointedEar | 103 | window.open("http://serienjunkies.org/serie/" + encodeURIComponent(key)); |
| 104 | e.preventDefault(); |
||
| 105 | } |
||
| 106 | }; |
||
| 107 | |||
| 108 | try |
||
| 109 | { |
||
| 110 | for (var a = document.links, i = a.length; i--;) |
||
| 111 | { |
||
| 112 | var e = a[i]; |
||
| 113 | e.addEventListener("click", f, false); |
||
| 114 | } |
||
| 115 | } |
||
| 116 | catch (e) {} |
||
| 117 | } |
||
| 118 | </script> |
||
| 119 | </head> |
||
| 120 | |||
| 121 | <body onload="net() // editor()"> |
||
| 122 | <h1 class="hidden">Seri-o-meter</h1> |
||
| 123 | <?php // var_dump($serien); ?> |
||
| 124 | <table> |
||
| 125 | <?php |
||
| 32 | PointedEar | 126 | if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') |
| 127 | { |
||
| 128 | function strftime_portable ($format, $timestamp = null) |
||
| 129 | { |
||
| 130 | if ($timestamp === null) |
||
| 131 | { |
||
| 132 | $timestamp = time(); |
||
| 133 | } |
||
| 172 | PointedEar | 134 | |
| 32 | PointedEar | 135 | $format = preg_replace('#(?<!%)((?:%%)*)%e#', '\1%#d', $format); |
| 136 | return strftime($format, $timestamp); |
||
| 137 | } |
||
| 138 | } |
||
| 139 | else |
||
| 140 | { |
||
| 141 | function strftime_portable ($format, $timestamp = null) |
||
| 142 | { |
||
| 143 | if ($timestamp === null) |
||
| 144 | { |
||
| 145 | $timestamp = time(); |
||
| 146 | } |
||
| 172 | PointedEar | 147 | |
| 32 | PointedEar | 148 | return strftime($format, $timestamp); |
| 149 | } |
||
| 150 | } |
||
| 172 | PointedEar | 151 | |
| 26 | PointedEar | 152 | setlocale(LC_ALL, 'de_CH.UTF-8'); |
| 172 | PointedEar | 153 | |
| 154 | $min_series = $this->min_series; |
||
| 155 | foreach ($this->serien as $name => $serie) |
||
| 26 | PointedEar | 156 | { |
| 157 | ?> |
||
| 158 | <tr> |
||
| 159 | <td style="text-align: center"><?php |
||
| 160 | $recommended = ($name === $min_series); |
||
| 161 | if ($recommended) { ?>→<?php } |
||
| 162 | if (isset($serie['ignore']) && $serie['ignore']) |
||
| 163 | { |
||
| 29 | PointedEar | 164 | ?>→<span style="color: red; font-weight: bold">⃠</span><?php |
| 26 | PointedEar | 165 | } |
| 166 | ?></td> |
||
| 167 | <th<?php if ($recommended) { ?> class="recommended"<?php } ?>><?php |
||
| 168 | $ep_list = isset($serie['episode_list']); |
||
| 169 | if ($ep_list) |
||
| 170 | { |
||
| 171 | ?><a href="<?php |
||
| 172 | echo htmlspecialchars($serie['episode_list']); |
||
| 173 | ?>" title="Episodenliste"><?php |
||
| 174 | } |
||
| 175 | echo $name; |
||
| 176 | if ($ep_list) { ?></a><?php } |
||
| 177 | ?><br> |
||
| 178 | <span style="font-weight: normal"><?php |
||
| 179 | if (array_key_exists('channel', $serie)) echo $serie['channel']; |
||
| 180 | |||
| 181 | if (array_key_exists('showtimes', $serie)) |
||
| 182 | { |
||
| 183 | echo ', ' . $serie['showtimes']; |
||
| 184 | } |
||
| 185 | ?></span></th> |
||
| 186 | <td<?php if ($recommended) { ?> class="recommended"<?php } ?>> |
||
| 187 | <div>Gesehen: <?php |
||
| 188 | echo implode(', ', $serie['coverage']) . ' ('. $serie['count']; |
||
| 189 | ?> von <?php $total = $serie['total']; echo $total; ?> Episoden)<?php |
||
| 190 | if (isset($serie['last_seen'])) |
||
| 191 | { |
||
| 192 | ?>; zuletzt am <?php |
||
| 172 | PointedEar | 193 | echo utf8_encode(strftime_portable('%A, %e. %B %Y %H:%M %z', $serie['last_seen'])); |
| 26 | PointedEar | 194 | } |
| 195 | ?></div> |
||
| 196 | <div class="box"> |
||
| 197 | <div class="meter" |
||
| 198 | style="width: <?php |
||
| 199 | $percentage = $serie['percentage']; |
||
| 200 | echo $percentage; ?>%" |
||
| 201 | ></div> |
||
| 202 | <?php |
||
| 203 | if (array_key_exists('seasons', $serie)) |
||
| 204 | { |
||
| 205 | $offset = 0; |
||
| 206 | foreach ($serie['seasons'] as $key => $season) |
||
| 207 | { |
||
| 208 | ?> |
||
| 209 | <div class="season" |
||
| 210 | <?php |
||
| 211 | if (!is_numeric($key)) |
||
| 212 | { |
||
| 213 | ?> title="<?php echo htmlspecialchars($key); ?>"<?php |
||
| 214 | } |
||
| 215 | ?> |
||
| 216 | style="<?php |
||
| 217 | if ($key === 0) |
||
| 218 | { |
||
| 219 | ?>border-left: none; <?php |
||
| 220 | } |
||
| 221 | ?>left: <?php echo $offset; ?>%; |
||
| 222 | width: <?php echo $season / $total * 100; ?>%" |
||
| 223 | ><?php |
||
| 224 | if (is_numeric($key)) |
||
| 225 | { |
||
| 226 | echo ($key + 1); |
||
| 227 | } |
||
| 228 | else |
||
| 229 | { |
||
| 230 | echo $key; |
||
| 231 | } |
||
| 232 | ?></div> |
||
| 233 | <?php |
||
| 234 | $offset += round($season / $total * 100, 1); |
||
| 235 | } |
||
| 236 | } |
||
| 172 | PointedEar | 237 | |
| 26 | PointedEar | 238 | if (isset($serie['episodes'])) |
| 239 | { |
||
| 240 | $prevNumber = null; |
||
| 241 | foreach ($serie['episodes'] as $episode => $description) |
||
| 242 | { |
||
| 243 | $episode_str = $episode; |
||
| 244 | if (isset($serie['season_ranges']) && is_array($serie['season_ranges'])) |
||
| 245 | { |
||
| 246 | foreach ($serie['season_ranges'] as $season_key => $season_range) |
||
| 247 | { |
||
| 248 | if ($episode >= $season_range[0] && $episode <= $season_range[1]) |
||
| 249 | { |
||
| 250 | $episode_str = sprintf("%u (%ux%02u)", $episode, $season_key, $episode - $season_range[0] + 1); |
||
| 251 | } |
||
| 252 | } |
||
| 253 | } |
||
| 254 | ?> |
||
| 255 | <div class="coverage" |
||
| 256 | style="<?php |
||
| 257 | if (is_null($prevNumber) || $prevNumber !== $episode - 1) |
||
| 258 | { |
||
| 259 | ?>border-left: 1px solid rgba(0, 218, 0, 0.5); <?php |
||
| 260 | } |
||
| 261 | ?> |
||
| 262 | border-right: 1px solid rgba(0, 218, 0, 0.5); |
||
| 263 | background-color: transparent; |
||
| 264 | left: <?php echo ($episode - 1) / $total * 100; ?>%; |
||
| 265 | width: <?php echo 1 / $total * 100; ?>%" |
||
| 266 | title="<?php |
||
| 267 | echo "{$episode_str}: " . htmlspecialchars($description); |
||
| 268 | ?>"></div><?php |
||
| 269 | $prevNumber = $episode; |
||
| 270 | } |
||
| 271 | } |
||
| 172 | PointedEar | 272 | |
| 26 | PointedEar | 273 | if (isset($serie['seen'])) |
| 274 | { |
||
| 275 | foreach ($serie['seen'] as $range) |
||
| 276 | { |
||
| 277 | if (!is_array($range)) |
||
| 278 | { |
||
| 279 | $range = array($range, $range); |
||
| 280 | } |
||
| 281 | /* |
||
| 282 | for ($i = $episode[0]; $i < $episode[1]; ++$i) |
||
| 283 | { |
||
| 284 | ?> |
||
| 285 | <div class="coverage" |
||
| 286 | style="left: <?php echo ($episode[0] - 1) / $total * 100; ?>%; |
||
| 287 | width: <?php echo ($episode[1] - $episode[0] + 1) / $total * 100; ?>%" |
||
| 288 | ></div> |
||
| 289 | <?php |
||
| 290 | } |
||
| 291 | } |
||
| 292 | else |
||
| 293 | */ |
||
| 172 | PointedEar | 294 | |
| 26 | PointedEar | 295 | for ($episode = $range[0]; $episode <= $range[1]; ++$episode) |
| 296 | { |
||
| 297 | $episode_str = $episode; |
||
| 298 | if (isset($serie['season_ranges']) && is_array($serie['season_ranges'])) |
||
| 299 | { |
||
| 300 | foreach ($serie['season_ranges'] as $season_key => $season_range) |
||
| 301 | { |
||
| 302 | if ($episode >= $season_range[0] && $episode <= $season_range[1]) |
||
| 303 | { |
||
| 304 | $episode_str = sprintf("%u (%ux%02u)", $episode, $season_key, $episode - $season_range[0] + 1); |
||
| 305 | } |
||
| 306 | } |
||
| 307 | } |
||
| 308 | ?> |
||
| 309 | <div class="coverage" |
||
| 310 | style="left: <?php echo ($episode - 1) / $total * 100; ?>%; |
||
| 311 | width: <?php echo 1 / $total * 100; ?>%" |
||
| 312 | <?php |
||
| 313 | if (isset($serie['episodes']) && array_key_exists($episode, $serie['episodes'])) |
||
| 314 | { |
||
| 315 | ?>title="<?php |
||
| 316 | echo "{$episode_str}: " . htmlspecialchars($serie['episodes'][$episode]); |
||
| 317 | ?>"<?php |
||
| 318 | } |
||
| 319 | ?>></div> |
||
| 320 | <?php |
||
| 321 | } |
||
| 322 | } |
||
| 323 | } |
||
| 324 | ?> |
||
| 325 | <span class="percentage"><?php echo round($percentage, 1); ?>%</span> |
||
| 326 | </div> |
||
| 327 | </td> |
||
| 328 | </tr> |
||
| 329 | <?php |
||
| 330 | } |
||
| 331 | ?> |
||
| 332 | </table> |
||
| 333 | </body> |
||
| 334 | </html> |