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