Rev 201 | 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() |
201 | 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 |
208 | PointedEar | 216 | $total = $serie->total; |
217 | echo $this->getCoverage($serie->seen) |
||
218 | . ' (' |
||
219 | . sprintf($this->_('%s of %s episodes'), $serie->count, $total) |
||
220 | . ')'; |
||
221 | |||
193 | PointedEar | 222 | if ($serie->last_seen) |
26 | PointedEar | 223 | { |
224 | ?>; zuletzt am <?php |
||
208 | PointedEar | 225 | $last_seen = strftime_portable('%A, %e. %B %Y %H:%M %z', $serie->last_seen); |
226 | // var_dump($serie); |
||
227 | echo mb_detect_encoding($last_seen) == 'UTF-8' ? $last_seen : utf8_encode($last_seen ); |
||
26 | PointedEar | 228 | } |
229 | ?></div> |
||
230 | <div class="box"> |
||
231 | <div class="meter" |
||
232 | style="width: <?php |
||
193 | PointedEar | 233 | $percentage = $serie->percentage; |
26 | PointedEar | 234 | echo $percentage; ?>%" |
235 | ></div> |
||
236 | <?php |
||
193 | PointedEar | 237 | if ($serie->seasons) |
26 | PointedEar | 238 | { |
239 | $offset = 0; |
||
193 | PointedEar | 240 | foreach ($serie->seasons as $key => $season) |
26 | PointedEar | 241 | { |
242 | ?> |
||
243 | <div class="season" |
||
244 | <?php |
||
245 | if (!is_numeric($key)) |
||
246 | { |
||
192 | PointedEar | 247 | ?> title="<?php echo $this->escape($key); ?>"<?php |
26 | PointedEar | 248 | } |
249 | ?> |
||
250 | style="<?php |
||
251 | if ($key === 0) |
||
252 | { |
||
253 | ?>border-left: none; <?php |
||
254 | } |
||
255 | ?>left: <?php echo $offset; ?>%; |
||
256 | width: <?php echo $season / $total * 100; ?>%" |
||
257 | ><?php |
||
258 | if (is_numeric($key)) |
||
259 | { |
||
260 | echo ($key + 1); |
||
261 | } |
||
262 | else |
||
263 | { |
||
264 | echo $key; |
||
265 | } |
||
266 | ?></div> |
||
267 | <?php |
||
268 | $offset += round($season / $total * 100, 1); |
||
269 | } |
||
270 | } |
||
172 | PointedEar | 271 | |
193 | PointedEar | 272 | if ($serie->episodes) |
26 | PointedEar | 273 | { |
274 | $prevNumber = null; |
||
193 | PointedEar | 275 | foreach ($serie->episodes as $episode => $description) |
26 | PointedEar | 276 | { |
277 | $episode_str = $episode; |
||
193 | PointedEar | 278 | if (is_array($serie->season_ranges)) |
26 | PointedEar | 279 | { |
193 | PointedEar | 280 | foreach ($serie->season_ranges as $season_key => $season_range) |
26 | PointedEar | 281 | { |
282 | if ($episode >= $season_range[0] && $episode <= $season_range[1]) |
||
283 | { |
||
284 | $episode_str = sprintf("%u (%ux%02u)", $episode, $season_key, $episode - $season_range[0] + 1); |
||
285 | } |
||
286 | } |
||
287 | } |
||
288 | ?> |
||
289 | <div class="coverage" |
||
290 | style="<?php |
||
291 | if (is_null($prevNumber) || $prevNumber !== $episode - 1) |
||
292 | { |
||
293 | ?>border-left: 1px solid rgba(0, 218, 0, 0.5); <?php |
||
294 | } |
||
295 | ?> |
||
296 | border-right: 1px solid rgba(0, 218, 0, 0.5); |
||
297 | background-color: transparent; |
||
298 | left: <?php echo ($episode - 1) / $total * 100; ?>%; |
||
299 | width: <?php echo 1 / $total * 100; ?>%" |
||
300 | title="<?php |
||
192 | PointedEar | 301 | echo "{$episode_str}: " . $this->escape($description); |
26 | PointedEar | 302 | ?>"></div><?php |
303 | $prevNumber = $episode; |
||
304 | } |
||
305 | } |
||
172 | PointedEar | 306 | |
193 | PointedEar | 307 | if ($serie->seen) |
26 | PointedEar | 308 | { |
193 | PointedEar | 309 | foreach ($serie->seen as $range) |
26 | PointedEar | 310 | { |
311 | if (!is_array($range)) |
||
312 | { |
||
313 | $range = array($range, $range); |
||
314 | } |
||
315 | /* |
||
316 | for ($i = $episode[0]; $i < $episode[1]; ++$i) |
||
317 | { |
||
318 | ?> |
||
319 | <div class="coverage" |
||
320 | style="left: <?php echo ($episode[0] - 1) / $total * 100; ?>%; |
||
321 | width: <?php echo ($episode[1] - $episode[0] + 1) / $total * 100; ?>%" |
||
322 | ></div> |
||
323 | <?php |
||
324 | } |
||
325 | } |
||
326 | else |
||
327 | */ |
||
172 | PointedEar | 328 | |
26 | PointedEar | 329 | for ($episode = $range[0]; $episode <= $range[1]; ++$episode) |
330 | { |
||
331 | $episode_str = $episode; |
||
193 | PointedEar | 332 | if ($serie->season_ranges) |
26 | PointedEar | 333 | { |
193 | PointedEar | 334 | foreach ($serie->season_ranges as $season_key => $season_range) |
26 | PointedEar | 335 | { |
336 | if ($episode >= $season_range[0] && $episode <= $season_range[1]) |
||
337 | { |
||
338 | $episode_str = sprintf("%u (%ux%02u)", $episode, $season_key, $episode - $season_range[0] + 1); |
||
339 | } |
||
340 | } |
||
341 | } |
||
342 | ?> |
||
343 | <div class="coverage" |
||
344 | style="left: <?php echo ($episode - 1) / $total * 100; ?>%; |
||
345 | width: <?php echo 1 / $total * 100; ?>%" |
||
346 | <?php |
||
193 | PointedEar | 347 | if ($serie->episodes && array_key_exists($episode, $serie->episodes)) |
26 | PointedEar | 348 | { |
349 | ?>title="<?php |
||
193 | PointedEar | 350 | echo "{$episode_str}: " . $this->escape($serie->episodes[$episode]); |
26 | PointedEar | 351 | ?>"<?php |
352 | } |
||
353 | ?>></div> |
||
354 | <?php |
||
355 | } |
||
356 | } |
||
357 | } |
||
358 | ?> |
||
359 | <span class="percentage"><?php echo round($percentage, 1); ?>%</span> |
||
360 | </div> |
||
361 | </td> |
||
362 | </tr> |
||
363 | <?php |
||
364 | } |
||
365 | ?> |
||
366 | </table> |
||
367 | </body> |
||
193 | PointedEar | 368 | </html> |