home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 117
/
FreelogNo117-OctobreNovembre2013.iso
/
Theme
/
8GadgetPack
/
8GadgetPackSetup.msi
/
Gadgets.7z
/
Gadgets
/
MyWeather.gadget
/
de
/
js
/
flyout.js
< prev
next >
Wrap
Text File
|
2012-09-30
|
5KB
|
98 lines
var txtcolor = "Color(255, 255, 255, 255)";
var font = "Calibri";
var fontsizeBIG = 21;
var fontsizeMEDIUM = 16;
var fontsizeSMALL = 12;
function onload() {
var oBackground = document.getElementById("bg");
oBackground.src = "url(img/flyout.png)";
var req = new XMLHttpRequest();
req.open('GET', 'http://wetter.msn.com/tenday.aspx?wealocations='+System.Gadget.Settings.read("ort")+'&weadegreetype='+System.Gadget.Settings.read("grad")+'', false);
req.send(null);
if(req.status == 200)
{
var tendays = req.responseText;
var cutStart = tendays.indexOf("<div class=\"weadetailed\"><ul>");
var cutEnd = tendays.lastIndexOf("</span></div></div></li></ul></div></div></div></div>");
tendays = tendays.substring(cutStart, cutEnd);
tendays = tendays.replace(/ class="wealast"/g, "");
tendays = tendays.replace(/ class="weafirst"/g, "");
tendays = tendays.replace(/<div class="forecast"><div class="row r1"><div class="dayDate"><span class="dfbold">/g, "-||");
tendays = tendays.replace(/<\/span><\/div><div>/g, "||");
tendays = tendays.replace(/law\//g, ">||");
tendays = tendays.replace(/.gif/g, "<img ");
tendays = tendays.replace(/Max : /g, "||");
tendays = tendays.replace(/Min : /g, "");
tendays = tendays.replace(/<span class="temptext">/g, "||");
tendays = tendays.replace(/<div class="row r3">/g, "||");
tendays = tendays.replace(/Feuchtigk. /g, "||");
tendays = tendays.replace(/<\/div><div class="row r5">/g, "||");
tendays = tendays.replace(/<span>/g, "||");
tendays = tendays.replace(/<\/span><\/div><\/div><\/li>/g, "||");
tendays = trim(tendays);
tendays = stripHTML(tendays);
tendays = tendays.split("||-||");
}
var req2 = new XMLHttpRequest();
req2.open('GET', 'http://wetter.msn.com/hourly.aspx?wealocations='+System.Gadget.Settings.read("ort")+'&weadegreetype='+System.Gadget.Settings.read("grad")+'', false);
req2.send(null);
if(req2.status == 200)
{
var hourly = req2.responseText;
var cutStart = hourly.indexOf("hf_outline");
var cutEnd = hourly.lastIndexOf("</div></div></div></div><div id=\"MehrUeber\"");
hourly = hourly.substring(cutStart-12, cutEnd+6);
hourly = hourly.replace(/hf_day">/g, "");
hourly = hourly.replace(/<\/span><span>/g, "");
hourly = hourly.replace(/<\/span><\/div>/g, "\">");
hourly = hourly.replace(/<li class="hf_time">/g, "-||");
hourly = hourly.replace(/<li class="hf_image">/g, "||");
hourly = hourly.replace(/law\//g, ">");
hourly = hourly.replace(/.gif/g, "<img ");
hourly = hourly.replace(/<li class="hf_forecast">/g, "||");
hourly = hourly.replace(/<li class="hf_temp">/g, "||");
hourly = hourly.replace(/<li class="hf_weaparam">/g, "||");
hourly = hourly.replace(/<li class="hf_ppt">/g, "||");
hourly = hourly.replace(/<\/li><\/ul>/g, "||");
hourly = hourly.replace(/<a href="/g, "||");
hourly = trim(hourly);
hourly = stripHTML(hourly);
hourly = hourly.split("||-||");
}
// Heute
var t = tendays[0].split("||");
document.getElementById("bg").removeObjects();
bg.addImageObject("img/w"+System.Gadget.Settings.read("styley")+"/"+t[3]+".png", 5, 5);
var txtAlign = bg.addTextObject(t[1], font, fontsizeBIG, txtcolor, 67,2);
txtAlign.align = 0; txtAlign.addShadow("black", 1, 100, 1, 1);
var txtAlign = bg.addTextObject("mind. "+t[5]+" / max. "+t[4], font, fontsizeSMALL, txtcolor, 70,27);
txtAlign.align = 0; txtAlign.addShadow("black", 1, 100, 1, 1);
var txtAlign = bg.addTextObject(t[6], font, fontsizeSMALL, txtcolor, 70,39);
txtAlign.align = 0; txtAlign.addShadow("black", 1, 100, 1, 1);
var h = hourly[0].split("||");
var txtAlign = bg.addTextObject(h[1], font, fontsizeMEDIUM, txtcolor, 5,70);
txtAlign.align = 0; txtAlign.addShadow("black", 1, 100, 1, 1);
bg.addImageObject("img/m"+System.Gadget.Settings.read("styley")+"/"+h[2]+".png", 5, 92);
var txtAlign = bg.addTextObject(h[5]+"┬░ / "+h[4]+"┬░", font, fontsizeSMALL, txtcolor, 37,90);
txtAlign.align = 0; txtAlign.addShadow("black", 1, 100, 1, 1);
var txtAlign = bg.addTextObject(h[3], font, fontsizeSMALL, txtcolor, 37,102);
txtAlign.align = 0; txtAlign.addShadow("black", 1, 100, 1, 1);
var txtAlign = bg.addTextObject(tendays[0], font, fontsizeSMALL, txtcolor, 0,330);
txtAlign.align = 0; txtAlign.addShadow("black", 1, 100, 1, 1);
}
function stripHTML(str){var tmp = str.replace(/(<.*['"])([^'"]*)(['"]>)/g, function(x, p1, p2, p3) { return p1 + p3;}); return tmp.replace(/<\/?[^>]+>/gi, ''); }
function trim(str){return str.replace(/[\n\r]/g, '').replace(/ +/g, ' ').replace(/^\s+/g, '').replace(/\s+$/g, '');}