Remove HTML overlay garbage.
[cydget.git] / PhotoExample.cydget / index.html
1 <html><head>
2 <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
3 <style>
4 * {
5 border: 0;
6 -moz-border-radius: 0;
7 -webkit-border-radius: 0;
8 box-sizing: border-box;
9 -moz-box-sizing: border-box;
10 -ms-box-sizing: border-box;
11 -webkit-box-sizing: border-box;
12 /*font-family: inherit;*/
13 font-size: 100%;
14 font-style: inherit;
15 font-weight: inherit;
16 margin: 0;
17 outline: 0;
18 padding: 0;
19 text-decoration: none;
20 vertical-align: baseline;
21 }
22
23 * {
24 -webkit-touch-callout: none;
25 -webkit-text-size-adjust: none;
26 -webkit-user-select: none;
27 }
28
29 body {
30 color: white;
31 }
32
33 #lcd {
34 background: url(cydget://_UIImageWithName/UILCDBackground.png);
35 height: 96px;
36 width: 320px;
37 }
38
39 #lcd h1 {
40 font-family: "LockClock-Light";
41 font-size: 65px;
42 left: 1px;
43 position: relative;
44 text-align: center;
45 text-shadow: -0.5px -1px 1px black;
46 top: -6px;
47 width: 319px;
48 }
49
50 #lcd h2 {
51 font-family: "Helvetica";
52 font-size: 17px;
53 position: relative;
54 text-align: center;
55 text-shadow: -0.5px -1px 1px black;
56 top: -16px;
57 }
58
59 #content {
60 font-family: "Helvetica";
61 min-height: 268px;
62 text-align:center;
63 }
64
65 #content h3 {
66 font-size: 20px;
67 text-align: center;
68 margin-bottom: 10px;
69 }
70
71 #content p {
72 font-size: 14px;
73 text-align: justify;
74 margin: 10px 12px;
75 }
76
77 sup {
78 font-size: smaller;
79 position: relative;
80 top: -5px;
81 }
82
83 #content img {
84 margin: auto;
85 max-height: 268px;
86 max-width: 320px;
87 vertical-align:middle;
88 }
89 </style></head><body>
90 <div id="content">
91 <script type="text/cycript" src="lcd.cy"></script>
92 <script type="text/cycript">
93 dlopen("/System/Library/PrivateFrameworks/PhotoLibrary.framework/PhotoLibrary", RTLD_GLOBAL);
94
95 var old = [PLCameraAlbum respondsToSelector:@selector(sharedInstance)];
96
97 var album;
98 if (old)
99 album = [[PLCameraAlbum sharedInstance] images];
100 else
101 album = [[[PLPhotoLibrary sharedPhotoLibrary] albums][0] contents];
102
103 var jpeg = null, length = album.length;
104 for (var i = 0; i != 5; ++i) {
105 var object = album[Math.floor(Math.random() * length)];
106 if (old)
107 jpeg = [[object fileGroup] pathForFullSizeImage];
108 else
109 jpeg = '/var/mobile/Media/' + [object directory].toString() + '/' + [object filename].toString();
110 if (jpeg != null)
111 break;
112 }
113
114 if (jpeg == null)
115 for (var i = 0; i != length; ++i) {
116 jpeg = [[album[Math.floor(i)] fileGroup] pathForFullSizeImage];
117 if (jpeg != null)
118 break;
119 }
120
121 document.write('<img src="' + jpeg.toString() + '"/>');
122 </script></div>
123 </body></html>