-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtwsatimg.gadget.xml
201 lines (172 loc) · 6.38 KB
/
twsatimg.gadget.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="__MSG_title__" description="__MSG_description__"
author="wctang" author_photo="http://farm1.static.flickr.com/219/buddyicons/81718017@N00.jpg" author_email="wctang+twsatimgfeedback@gmail.com"
author_link="http://blog.wctang.info/" author_location="Kaohsiung, Taiwan" author_affiliation="wctang.info"
title_url="http://code.google.com/p/taiwan-satimg-gadget/" screenshot="http://taiwan-satimg-gadget.googlecode.com/svn/trunk/twsatimg_gadget_preview.png"
thumbnail="http://taiwan-satimg-gadget.googlecode.com/svn/trunk/twsatimg_gadget_thumb.png" height="450" category="tools">
<Locale messages="http://taiwan-satimg-gadget.googlecode.com/svn/trunk/msg-en.xml"/>
<Locale lang="zh-TW" messages="http://taiwan-satimg-gadget.googlecode.com/svn/trunk/msg-zh-tw.xml"/>
<Require feature="setprefs"/>
<Require feature="minimessage"/>
</ModulePrefs>
<UserPref name="area" display_name="__MSG_area__" datatype="enum" default_value="1">
<EnumValue value="0" display_value="__MSG_area0__"/>
<EnumValue value="1" display_value="__MSG_area1__"/>
<EnumValue value="2" display_value="__MSG_area2__"/>
</UserPref>
<UserPref name="type" display_name="__MSG_type__" datatype="enum" default_value="1">
<EnumValue value="0" display_value="__MSG_type0__"/>
<EnumValue value="1" display_value="__MSG_type1__"/>
<EnumValue value="2" display_value="__MSG_type2__"/>
<EnumValue value="3" display_value="__MSG_type3__"/>
</UserPref>
<UserPref name="time" display_name="__MSG_time__" datatype="enum" default_value="12">
<EnumValue value="12" display_value="__MSG_time12__"/>
<EnumValue value="24" display_value="__MSG_time24__"/>
<EnumValue value="36" display_value="__MSG_time36__"/>
<EnumValue value="48" display_value="__MSG_time48__"/>
</UserPref>
<Content type="html"><![CDATA[
<style type="text/css">
#overlay__MODULE_ID__ {
position:absolute;
top:0px;
left:0px;
width:100%;
height:430px;
background:black;
opacity:0;
-moz-opacity:0;
filter:alpha(opacity=0);
}
#overlay__MODULE_ID__ div {
background:white;
position:absolute;
width:100px;
height:30px;
cursor:pointer;
text-align:center;
}
#loading__MODULE_ID__ {
position:absolute;
top:0px;
left:0px;
width:100px;
height:100px;
background:url(http://taiwan-satimg-gadget.googlecode.com/svn/trunk/loading.gif) no-repeat;
}
#wrap__MODULE_ID__ {
width:100%;
height:450px;
overflow:auto;
}
</style>
<div id="overlay__MODULE_ID__"><div id="pause">Pause</div></div>
<div id="loading__MODULE_ID__"></div>
<div id="wrap__MODULE_ID__">
<div id="content__MODULE_ID__"><img id="img__MODULE_ID__" style="width:0px;height:0px;"/></div>
</div>
<script src="http://yui.yahooapis.com/2.2.2/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script src="http://yui.yahooapis.com/2.2.2/build/animation/animation-min.js"></script>
<script type="text/javascript">
var msg = new _IG_MiniMessage(__MODULE_ID__);
var prefs = new _IG_Prefs(__MODULE_ID__);
var overlay = _gel('overlay__MODULE_ID__');
var loading = _gel('loading__MODULE_ID__');
var content = _gel('content__MODULE_ID__');
var btnPause = _gel('pause');
var img = _gel('img__MODULE_ID__');
var urlpath = 'http://www.cwb.gov.tw/V5/observe/satellite/Data/';
var paths = [
[urlpath + 's0o/s0o-',urlpath + 's0p/s0p-',urlpath + 's0q/s0q-',urlpath + 'sco/sco-'],
[urlpath + 's1o/s1o-',urlpath + 's1p/s1p-',urlpath + 's1q/s1q-',urlpath + 'sao/sao-'],
[urlpath + 's3o/s3o-',urlpath + 's3p/s3p-',urlpath + 's3q/s3q-',urlpath + 'sbo/sbo-']];
var checkindelay = 10;
var start = prefs.getInt('time');
var diff = prefs.getInt('time');
var ispaused = false;
var stopped = false;
var mousein_anim = new YAHOO.util.Anim(overlay, { opacity: { to: .6 } }, .5);
var mouseout_anim = new YAHOO.util.Anim(overlay, { opacity: { to: 0 } }, .25);
overlay.curr_in = false;
function checkoverlay() {
if(overlay.curr_in != overlay.req_in) {
overlay.curr_in = overlay.req_in;
if( overlay.curr_in) {
btnPause.style.left = ((overlay.clientWidth - 100)/2)+'px';
btnPause.style.top = '20px';
if(mouseout_anim.isAnimated())
mouseout_anim.stop(true);
mousein_anim.animate();
} else {
if(mousein_anim.isAnimated())
mousein_anim.stop(true);
mouseout_anim.animate();
}
}
};
overlay.onmouseover=function() {
overlay.req_in = true;
self.setTimeout("checkoverlay()", 200);
};
overlay.onmouseout=function() {
overlay.req_in = false;
self.setTimeout("checkoverlay()", 200);
};
btnPause.onclick=function() {
if(!ispaused) {
ispaused = true;
} else {
ispaused = false;
if(stopped) {
stopped = false;
tick__MODULE_ID__();
}
}
};
function restart__MODULE_ID__() {
diff = 0;
self.setTimeout("tick__MODULE_ID__()", 4000);
};
function check_loading() {
if(loading.loading != img.src) {
loading.style.display="block";
}
};
var preload__MODULE_ID__ = new Image();
preload__MODULE_ID__.onload = function() {
loading.style.display="none";
img.src = this.src;
content.style.width=img.style.width=this.width+'px';
content.style.height=img.style.height=this.height+'px';
if(ispaused) { stopped = true; return; }
self.setTimeout("tick__MODULE_ID__()", 1000);
};
preload__MODULE_ID__.onerror = function() {
self.setTimeout("tick__MODULE_ID__()", 0);
};
function tick__MODULE_ID__() {
if(ispaused) { stopped = true; return; }
if((start-diff) < 0) return restart__MODULE_ID__();
var curr = new Date();
var mm = curr.getTime();
mm -= (checkindelay*60000 + (start-diff)*3600000);
curr.setTime(mm);
var y = curr.getFullYear();
var m = curr.getMonth()+1;
if(m < 10) m = '0' + m;
var d = curr.getDate();
if(d < 10) d = '0' + d;
var h = curr.getHours();
if(h < 10) h = '0' + h;
if(ispaused) { stopped = true; return; }
diff++;
preload__MODULE_ID__.src = paths[prefs.getInt('area')][prefs.getInt('type')] + y + '-' + m + '-' + d + '-' + h + '.jpg';
loading.loading = preload__MODULE_ID__.src;
self.setTimeout("check_loading()", 300);
};
_IG_RegisterOnloadHandler(tick__MODULE_ID__());
</script>
]]></Content>
</Module>