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