Closed GoogleCodeExporter closed 9 years ago
It appears, that the date/time generation depends on the language used.
Needs more investigation (source code of english version of the page).
It would be also nice to poll the page with meteogram image and check whether it
contains the new image. In such a case method for generating the image URL may
be
useful to determining if page fetching is needed.
Original comment by pkryger
on 29 Aug 2007 at 12:38
Another approach:
1. try to get cached image as described in comment #1
(http://code.google.com/p/meteo-icm-gadget/issues/detail?id=9#c1)
2. if 1. didn't work try to get cached image as in original algorithm
3. if 2. didn't work try to get previously successfully cached image (as per
gadget
instance)
1. & 2. shall update the cached image name
Cache shall be longer (like +6h or even more)
Original comment by pkryger
on 29 May 2008 at 11:34
The following code extracts values used by meteo-script:
function response(obj) {
var sStartTime = obj.substr(obj.indexOf("var Start_time=") + 15, 2);
document.writeln("StartTime = " + sStartTime);
var sDay = obj.substr(obj.indexOf("var Day=") + 8, 2);
document.writeln("Day = " + sDay);
var sMonth = obj.substr(obj.indexOf("var Month=") + 10, 2);
document.writeln("Month = " + sMonth);
var sYear = obj.substr(obj.indexOf("var Year=") + 9, 4);
document.writeln("Year = " + sYear);
}
var url = 'http://umold.meteo.pl/java/mgram.php?x=17&y=8&lang=0&ver=&ikonka=1';
_IG_FetchContent(url, response);
Values are used in the following way in meteo-script:
if (st<10) st="0"+st;
if (Day<10) dd="0"+Day; else dd=Day;
nazwa =
Year+mm2ang[Month]+dd+"_"+st+"_row"+mgy_i+"_col"+mgx_i+"_"+language+".png";
wyn = "/gpp/data/"+nazwa;
Original comment by pkryger
on 1 Jun 2008 at 2:44
The following code works with Google caching mechanizm:
<div id="main"></div>
<script>
var url = "http://umold.meteo.pl/gpp/data/2008Jun01_06_row35_col17_pl.png";
var img = _IG_GetImage(url, {refreshInterval:1000});
var mainDiv = _gel("main");
if (true == img.complete) {
mainDiv.innerHTML = "";
mainDiv.appendChild(img);
} else {
mainDiv.innerHTML = "Cannot load image!";
}
</script>
Original comment by pkryger
on 1 Jun 2008 at 2:57
First create a flag that is set to true when your callback function is
called. Next, create a timer with setTimeout that checks the status of
the flag after a few seconds (10 should work well). If the callback
was successful, the flag will be set to true. If it failed, the flag
will still be false and you will know you had an error.
Original comment by pkryger
on 1 Jun 2008 at 3:30
Progress bar implementation as in GMail:
<style type="text/css">
.lpb{margin: 2px 0;border:1px solid #949dad;width:200px;height:0.5em}
#lpt{background:#d4e4ff;width:0;height:100%}
</style>
<div class="lpb">
<div id="lpt" style=""></div>
</div>
<script>
var progress = 0;
function increment() {
if (progress < 100) {
progress += 5;
_gel("lpt").setAttribute("style", "width:" + progress + "%");
setTimeout("increment()", 1000);
}
}
setTimeout("increment()", 1000);
</script>
Original comment by pkryger
on 2 Jun 2008 at 7:48
Original comment by pkryger
on 7 Jun 2008 at 2:21
Original issue reported on code.google.com by
pkryger
on 19 Aug 2007 at 8:46