OMG this finally works.
[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 }
42
43 #lcd h2 {
44 font-family: "Helvetica";
45 font-size: 17px;
46 position: relative;
47 text-align: center;
48 text-shadow: -0.5px -1px 1px black;
49 top: -16px;
50 }
51
52 #content {
53 font-family: "Helvetica";
54 min-height: 268px;
55 text-align:center;
56 }
57
58 #content h3 {
59 font-size: 20px;
60 text-align: center;
61 margin-bottom: 10px;
62 }
63
64 #content p {
65 font-size: 14px;
66 text-align: justify;
67 margin: 10px 12px;
68 }
69
70 sup {
71 font-size: smaller;
72 position: relative;
73 top: -5px;
74 }
75
76 #content img {
77 margin: auto;
78 max-height: 268px;
79 max-width: 320px;
80 vertical-align:middle;
81 }
82 </style></head><body>
83 <div id="content">
84 <script type="text/cycript" src="lcd.cy"></script>
85 <script type="text/cycript">
86 document.write([NSString stringWithString:'A'].toString());
87 </script>
88 <script type="text/cycript">
89 document.write([NSString stringWithString:'B'].toString());
90 </script>
91 <script type="text/cycript">
92 document.write([NSString stringWithString:'C'].toString());
93 </script>
94 <script type="text/cycript" src="lcd.cy"></script>
95 P
96 <script type="text/cycript">
97 document.write([NSString stringWithString:'D'].toString());
98 </script>
99 <script type="text/cycript">
100 document.write([NSString stringWithString:'E'].toString());
101 </script>
102 <script type="text/cycript">
103 dlopen("/System/Library/PrivateFrameworks/PhotoLibrary.framework/PhotoLibrary", RTLD_GLOBAL);
104
105 var old = [PLCameraAlbum respondsToSelector:@selector(sharedInstance)];
106
107 var album;
108 if (old)
109 album = [[PLCameraAlbum sharedInstance] images];
110 else
111 album = [[[PLPhotoLibrary sharedPhotoLibrary] albums][0] contents];
112
113 var jpeg = null, length = album.length;
114 for (var i = 0; i != 5; ++i) {
115 var object = album[Math.floor(Math.random() * length)];
116 if (old)
117 jpeg = [[object fileGroup] pathForFullSizeImage];
118 else
119 jpeg = '/var/mobile/Media/' + [object directory].toString() + '/' + [object filename].toString();
120 if (jpeg != null)
121 break;
122 }
123
124 if (jpeg == null)
125 for (var i = 0; i != length; ++i) {
126 jpeg = [[album[Math.floor(i)] fileGroup] pathForFullSizeImage];
127 if (jpeg != null)
128 break;
129 }
130
131 document.write('<img src="' + jpeg.toString() + '"/>');
132 </script></div>
133 </body></html>