]> git.saurik.com Git - cydget.git/blame - PhotoExample.cydget/index.html
Added a PhotoExample.cydget and renamed Cycript= to CycriptURLs=.
[cydget.git] / PhotoExample.cydget / index.html
CommitLineData
17854c1a
JF
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"><script type="text/cycript">
84 document.write('<div id="lcd">');
85
86 var locale = CFLocaleCopyCurrent();
87 var now = CFDateCreate(NULL, CFAbsoluteTimeGetCurrent());
88 var formatter = CFDateFormatterCreate(NULL, locale, kCFDateFormatterNoStyle, kCFDateFormatterNoStyle);
89 CFRelease(locale);
90
91 CFDateFormatterSetFormat(formatter, UIDateFormatStringForFormatType(UINoAMPMTimeFormat));
92 var time = CFDateFormatterCreateStringWithDate(NULL, formatter, now);
93 document.write('<h1>');
94 document.write(time);
95 document.write('</h1>');
96 CFRelease(time);
97
98 CFDateFormatterSetFormat(formatter, UIDateFormatStringForFormatType(UIWeekdayNoYearDateFormat));
99 var date = CFDateFormatterCreateStringWithDate(NULL, formatter, now);
100 document.write('<h2>');
101 document.write(date);
102 document.write('</h2>');
103 CFRelease(date);
104
105 CFRelease(formatter);
106 CFRelease(now);
107
108 document.write('</div>');
109
110 dlopen("/System/Library/PrivateFrameworks/PhotoLibrary.framework/PhotoLibrary", RTLD_GLOBAL);
111 var album = PLCameraAlbum.sharedInstance.images;
112
113 var jpeg = null, length = album.length;
114 for (var i = 0; i != 5; ++i) {
115 jpeg = album[Math.floor(Math.random() * length)].fileGroup.pathForFullSizeImage;
116 if (jpeg != null)
117 break;
118 }
119
120 if (jpeg == null)
121 for (var i = 0; i != length; ++i) {
122 jpeg = album[Math.floor(i)].fileGroup.pathForFullSizeImage;
123 if (jpeg != null)
124 break;
125 }
126
127 document.write('<img src="' + jpeg + '"/>');
128 </script></div>
129</body></html>