Support iPad-oriented PhotoExample sizing.
[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-width: 100%;
121 vertical-align:middle;
122 }
123
124 @media only screen and (min-device-width: 320px) and (max-device-width: 480px) {
125 #content img {
126 max-height: 268px;
127 }
128 }
129
130 @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: landscape) {
131 #content img {
132 max-height: 556px;
133 }
134 }
135
136 @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation: portrait) {
137 #content img {
138 max-height: 769px;
139 }
140 }
141 </style></head><body>
142 <div id="content">
143 <script type="text/cycript" src="lcd.cy"></script>
144 <script type="text/cycript">
145 dlopen("/System/Library/PrivateFrameworks/PhotoLibrary.framework/PhotoLibrary", RTLD_GLOBAL);
146
147 var old = [PLCameraAlbum respondsToSelector:@selector(sharedInstance)];
148
149 var album;
150 if (old)
151 album = [[PLCameraAlbum sharedInstance] images];
152 else
153 album = [[[PLPhotoLibrary sharedPhotoLibrary] albums][0] contents];
154
155 var jpeg = null, length = album.length;
156 for (var i = 0; i != 5; ++i) {
157 var object = album[Math.floor(Math.random() * length)];
158 if (old)
159 jpeg = [[object fileGroup] pathForFullSizeImage];
160 else
161 jpeg = '/var/mobile/Media/' + [object directory].toString() + '/' + [object filename].toString();
162 if (jpeg != null)
163 break;
164 }
165
166 if (jpeg == null)
167 for (var i = 0; i != length; ++i) {
168 jpeg = [[album[Math.floor(i)] fileGroup] pathForFullSizeImage];
169 if (jpeg != null)
170 break;
171 }
172
173 document.write('<img src="' + jpeg.toString() + '"/>');
174 </script></div>
175 </body></html>