]> git.saurik.com Git - cydget.git/blob - PhotoExample.cydget/index.html
Support iPad-oriented LCD bars.
[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: 100%;
37 }
38
39 #lcd h1 {
40 font-family: "LockClock-Light";
41 padding: 0px 0px 0px 1px;
42 position: relative;
43 text-align: center;
44 text-shadow: -0.5px -1px 1px black;
45 }
46
47 #lcd h2 {
48 font-family: "Helvetica";
49 position: relative;
50 text-align: center;
51 text-shadow: -0.5px -1px 1px black;
52 }
53
54 @media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
55 #lcd h1 {
56 font-size: 65px;
57 top: -6px;
58 }
59
60 #lcd h2 {
61 font-size: 17px;
62 top: -16px;
63 }
64 }
65
66 @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) {
67 #lcd h1 {
68 font-size: 69px;
69 top: -8px;
70 }
71
72 #lcd h2 {
73 font-size: 16px;
74 top: -18px;
75 }
76 }
77
78 @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) {
79 #lcd {
80 height: 107px;
81 }
82
83 #lcd h1 {
84 font-size: 69px;
85 top: -1px;
86 }
87
88 #lcd h2 {
89 font-size: 16px;
90 top: -8px;
91 }
92 }
93
94 #content {
95 font-family: "Helvetica";
96 min-height: 268px;
97 text-align:center;
98 }
99
100 #content h3 {
101 font-size: 20px;
102 text-align: center;
103 margin-bottom: 10px;
104 }
105
106 #content p {
107 font-size: 14px;
108 text-align: justify;
109 margin: 10px 12px;
110 }
111
112 sup {
113 font-size: smaller;
114 position: relative;
115 top: -5px;
116 }
117
118 #content img {
119 margin: auto;
120 max-height: 268px;
121 max-width: 320px;
122 vertical-align:middle;
123 }
124 </style></head><body>
125 <div id="content">
126 <script type="text/cycript" src="lcd.cy"></script>
127 <script type="text/cycript">
128 dlopen("/System/Library/PrivateFrameworks/PhotoLibrary.framework/PhotoLibrary", RTLD_GLOBAL);
129
130 var old = [PLCameraAlbum respondsToSelector:@selector(sharedInstance)];
131
132 var album;
133 if (old)
134 album = [[PLCameraAlbum sharedInstance] images];
135 else
136 album = [[[PLPhotoLibrary sharedPhotoLibrary] albums][0] contents];
137
138 var jpeg = null, length = album.length;
139 for (var i = 0; i != 5; ++i) {
140 var object = album[Math.floor(Math.random() * length)];
141 if (old)
142 jpeg = [[object fileGroup] pathForFullSizeImage];
143 else
144 jpeg = '/var/mobile/Media/' + [object directory].toString() + '/' + [object filename].toString();
145 if (jpeg != null)
146 break;
147 }
148
149 if (jpeg == null)
150 for (var i = 0; i != length; ++i) {
151 jpeg = [[album[Math.floor(i)] fileGroup] pathForFullSizeImage];
152 if (jpeg != null)
153 break;
154 }
155
156 document.write('<img src="' + jpeg.toString() + '"/>');
157 </script></div>
158 </body></html>