Port Cydget to UIWebView.
[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 document.write([NSString stringWithString:'A'].toString());
88 </script>
89 <script type="text/cycript">
90 document.write([NSString stringWithString:'B'].toString());
91 </script>
92 <script type="text/cycript">
93 document.write([NSString stringWithString:'C'].toString());
94 </script>
95 <script type="text/cycript" src="lcd.cy"></script>
96 P
97 <script type="text/cycript">
98 document.write([NSString stringWithString:'D'].toString());
99 </script>
100 <script type="text/cycript">
101 document.write([NSString stringWithString:'E'].toString());
102 </script>
103 <script type="text/cycript">
104 dlopen("/System/Library/PrivateFrameworks/PhotoLibrary.framework/PhotoLibrary", RTLD_GLOBAL);
105
106 var old = [PLCameraAlbum respondsToSelector:@selector(sharedInstance)];
107
108 var album;
109 if (old)
110 album = [[PLCameraAlbum sharedInstance] images];
111 else
112 album = [[[PLPhotoLibrary sharedPhotoLibrary] albums][0] contents];
113
114 var jpeg = null, length = album.length;
115 for (var i = 0; i != 5; ++i) {
116 var object = album[Math.floor(Math.random() * length)];
117 if (old)
118 jpeg = [[object fileGroup] pathForFullSizeImage];
119 else
120 jpeg = '/var/mobile/Media/' + [object directory].toString() + '/' + [object filename].toString();
121 if (jpeg != null)
122 break;
123 }
124
125 if (jpeg == null)
126 for (var i = 0; i != length; ++i) {
127 jpeg = [[album[Math.floor(i)] fileGroup] pathForFullSizeImage];
128 if (jpeg != null)
129 break;
130 }
131
132 document.write('<img src="' + jpeg.toString() + '"/>');
133 </script></div>
134 </body></html>