Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
1 <!DOCTYPE>
2 <head>
3 <style>
4 body {
5 border: 0px;
6 margin: 0px;
7 padding: 0px;
8 }
9 table {
10 border-spacing: 0px;
11 }
12 </style>
13 </head>
14 <body>
15 <div>
16 <table>
17 <tr>
18 <td id="ul"></td>
19 <td id="ur"></td>
20 </tr>
21 <tr>
22 <td id="ll"></td>
23 <td id="lr"></td>
24 </tr>
25 </table>
26 </div>
28 <script>
29 var orientation = location.search.substring(1).split("&");
30 var angle = parseInt(orientation[0]);
31 var flip = orientation[1] == "flip" ? true : false;
33 // Each id corresponds to a color.
34 var ids = ["ul", "ur", "lr", "ll"];
35 var colors = [
36 "rgb(0, 191, 0)",
37 "rgb(0, 255, 1)",
38 "rgb(254, 0, 122)",
39 "rgb(191, 0, 93)",
40 ];
42 // 'Rotate' the colors according to the angle.
43 colors.unshift.apply(colors, colors.splice((360 - angle) / 90, colors.length));
45 // 'Flip' the colors if requested.
46 if (flip) {
47 var tmp = colors[0];
48 colors[0] = colors[1];
49 colors[1] = tmp;
50 tmp = colors[2];
51 colors[2] = colors[3];
52 colors[3] = tmp;
53 }
55 // Construct a style.
56 var style = "";
58 if (angle == 90 || angle == 270) {
59 style += "div { width: 200px; height: 100px; }\n";
60 style += "td { width: 100px; height: 50px; }\n";
61 } else {
62 style += "div { width: 100px; height: 200px; }\n";
63 style += "td { width: 50px; height: 100px; }\n";
64 }
66 for (var i = 0 ; i < 4 ; ++i) {
67 style += "#" + ids[i] + " { background-color: " + colors[i] + "; }\n";
68 }
70 // Apply the style to the document.
71 var sheet = document.createElement('style');
72 sheet.innerHTML = style;
73 document.body.appendChild(sheet);
74 </script>
75 </body>