Remove PhotoExample debugging 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 body {
24 color: white;
25 }
26
27 #lcd {
28 background: url(cydget://_UIImageWithName/UILCDBackground.png);
29 height: 96px;
30 width: 320px;
31 }
32
33 #lcd h1 {
34 font-family: "LockClock-Light";
35 font-size: 65px;
36 left: 1px;
37 position: relative;
38 text-align: center;
39 text-shadow: -0.5px -1px 1px black;
40 top: -6px;
41 width: 319px;
42 }
43
44 #lcd h2 {
45 font-family: "Helvetica";
46 font-size: 17px;
47 position: relative;
48 text-align: center;
49 text-shadow: -0.5px -1px 1px black;
50 top: -16px;
51 }
52
53 #content {
54 font-family: "Helvetica";
55 min-height: 268px;
56 text-align:center;
57 }
58
59 #content h3 {
60 font-size: 20px;
61 text-align: center;
62 margin-bottom: 10px;
63 }
64
65 #content p {
66 font-size: 14px;
67 text-align: justify;
68 margin: 10px 12px;
69 }
70
71 sup {
72 font-size: smaller;
73 position: relative;
74 top: -5px;
75 }
76
77 #content img {
78 margin: auto;
79 max-height: 268px;
80 max-width: 320px;
81 vertical-align:middle;
82 }
83 </style></head><body>
84 <div id="content">
85 <script type="text/cycript" src="lcd.cy"></script>
86 <script type="text/cycript">
87 dlopen("/System/Library/PrivateFrameworks/PhotoLibrary.framework/PhotoLibrary", RTLD_GLOBAL);
88
89 var old = [PLCameraAlbum respondsToSelector:@selector(sharedInstance)];
90
91 var album;
92 if (old)
93 album = [[PLCameraAlbum sharedInstance] images];
94 else
95 album = [[[PLPhotoLibrary sharedPhotoLibrary] albums][0] contents];
96
97 var jpeg = null, length = album.length;
98 for (var i = 0; i != 5; ++i) {
99 var object = album[Math.floor(Math.random() * length)];
100 if (old)
101 jpeg = [[object fileGroup] pathForFullSizeImage];
102 else
103 jpeg = '/var/mobile/Media/' + [object directory].toString() + '/' + [object filename].toString();
104 if (jpeg != null)
105 break;
106 }
107
108 if (jpeg == null)
109 for (var i = 0; i != length; ++i) {
110 jpeg = [[album[Math.floor(i)] fileGroup] pathForFullSizeImage];
111 if (jpeg != null)
112 break;
113 }
114
115 document.write('<img src="' + jpeg.toString() + '"/>');
116 </script></div>
117 </body></html>