home *** CD-ROM | disk | FTP | other *** search
/ Freelog 117 / FreelogNo117-OctobreNovembre2013.iso / Theme / 8GadgetPack / 8GadgetPackSetup.msi / Gadgets.7z / Gadgets / MyWeather.gadget / de / js / settings.js < prev   
Text File  |  2012-09-30  |  16KB  |  293 lines

  1. function loading(){ 
  2.  
  3.  
  4. var tar = "";
  5. var userAgenty_var = "";
  6.     userAgenty_var = System.Gadget.Settings.read("userAgenty");
  7.     //confirm(userAgenty_var);
  8.  
  9. var win = System.Gadget.Settings.read("win");
  10. if(win == 'vista'){
  11. if(userAgenty_var == false)
  12. {
  13. document.body.style.height = "320px";
  14. tar="<div id='userAgenty1'><div id='userA1'><input type='checkbox' name='userAgenty' id='userAgenty' value='0'></div><div id='userA2'>"+lang.userAgent+"</div></div>";
  15. }else{
  16. document.body.style.height = "300px";
  17. tar="<div id='userAgenty1'><div id='userA1'><input type='checkbox' name='userAgenty' id='userAgenty' value='0' checked></div><div id='userA2'>"+lang.userAgent+"</div></div>";
  18. }
  19. }
  20.  
  21. var s = "";
  22. var styley_var = "";
  23.     styley_var = System.Gadget.Settings.read("styley");
  24. if(styley_var == '1')
  25. {
  26. s  = "<div id='styley1'><div id='sty1'><input type='radio' name='styley' onclick='styley(\"1\");' value='1' checked></div><div id='sty2'><img src='img/m1/28.png'></div>";
  27. s += "<div id='sty3'><input type='radio' name='styley' onclick='styley(\"2\");' value='2'></div><div id='sty4'><img src='img/m2/28.png'></div></div>";
  28. }else{
  29. s  = "<div id='styley1'><div id='sty1'><input type='radio' name='styley' onclick='styley(\"1\");' value='1'></div><div id='sty2'><img src='img/m1/28.png'></div>";
  30. s += "<div id='sty3'><input type='radio' name='styley' onclick='styley(\"2\");' value='2' checked></div><div id='sty4'><img src='img/m2/28.png'></div></div>";    
  31. }
  32.  
  33.  
  34. var gg = "";
  35. var confirmy_var = "";
  36.     confirmy_var = System.Gadget.Settings.read("confirmy");
  37. if(confirmy_var == false)
  38. {
  39. gg="<div id='alert' style='display:none'><div id='al1'><input type='checkbox' name='confirmy' id='confirmy' value='0'></div><div id='al2'>"+lang.alert+"</div></div>";
  40. }else{
  41. gg="<div id='alert' style='display:none'><div id='al1'><input type='checkbox' name='confirmy' id='confirmy' value='0' checked></div><div id='al2'>"+lang.alert+"</div></div>";
  42. }
  43.  
  44.  
  45. var e = "";
  46. var CF_var = "";
  47.     CF_var = System.Gadget.Settings.read("grad");
  48.  
  49. if(CF_var == 'F')
  50. {
  51. e = "<div id='cf1'><div id='cf_radio'><input type='radio' name='cf' onclick='CF(\"C\");' value='C'></div><div id='cf_image'>"+lang.cf+"</div></div>";
  52. e += "<div id='cf2'><div id='cf_radio'><input type='radio' name='cf' onclick='CF(\"F\");' value='F' checked></div><div id='cf_image'>"+lang.ff+"</div></div>";
  53. }else{
  54. e = "<div id='cf1'><div id='cf_radio'><input type='radio' name='cf' onclick='CF(\"C\");' value='C' checked></div><div id='cf_image'>"+lang.cf+"</div></div>";
  55. e += "<div id='cf2'><div id='cf_radio'><input type='radio' name='cf' onclick='CF(\"F\");' value='F'></div><div id='cf_image'>"+lang.ff+"</div></div>";
  56. }
  57.  
  58.  
  59. var d = "";
  60. var style_var = "";
  61.     style_var = System.Gadget.Settings.read("style");
  62.  
  63. d = style_var;
  64. if(style_var == 'c')
  65. {
  66. d = "<div style='padding-top: 8px;'><div id='c01'><div id='c_radio'><input type='radio' name='style' onclick='st(\"c\");' value='c' checked></div><div id='c_image'><img src='../img/c.png'></div></div>";
  67. d += "<div id='c02'><div id='c_radio'><input type='radio' name='style' onclick='st(\"w\");' value='w'></div><div id='c_image'><img src='../img/w.png'></div></div>";
  68. d += "<div id='c03'><div id='c_radio'><input type='radio' name='style' onclick='st(\"b\");' value='b' ></div><div id='c_image'><img src='../img/b.png'></div></div>";
  69. d += "<div id='c04'><div id='c_radio'><input type='radio' name='style' onclick='st(\"blue\");' value='blue' ></div><div id='c_image'><img src='../img/blue.png'></div></div>";
  70. d += "<div id='c05'><div id='c_radio'><input type='radio' name='style' onclick='st(\"r\");' value='r' ></div><div id='c_image'><img src='../img/r.png'></div></div>";
  71. d += "</div>";
  72. }
  73. else if(style_var == 'w')
  74. {
  75. d = "<div style='padding-top: 8px;'><div id='c01'><div id='c_radio'><input type='radio' name='style' onclick='st(\"c\");' value='c'></div><div id='c_image'><img src='../img/c.png'></div></div>";
  76. d += "<div id='c02'><div id='c_radio'><input type='radio' name='style' onclick='st(\"w\");' value='w' checked></div><div id='c_image'><img src='../img/w.png'></div></div>";
  77. d += "<div id='c03'><div id='c_radio'><input type='radio' name='style' onclick='st(\"b\");' value='b' ></div><div id='c_image'><img src='../img/b.png'></div></div>";
  78. d += "<div id='c04'><div id='c_radio'><input type='radio' name='style' onclick='st(\"blue\");' value='blue' ></div><div id='c_image'><img src='../img/blue.png'></div></div>";
  79. d += "<div id='c05'><div id='c_radio'><input type='radio' name='style' onclick='st(\"r\");' value='r' ></div><div id='c_image'><img src='../img/r.png'></div></div>";
  80. d += "</div>";
  81. }
  82. else if(style_var == 'blue')
  83. {
  84. d = "<div style='padding-top: 8px;'><div id='c01'><div id='c_radio'><input type='radio' name='style' onclick='st(\"c\");' value='c'></div><div id='c_image'><img src='../img/c.png'></div></div>";
  85. d += "<div id='c02'><div id='c_radio'><input type='radio' name='style' onclick='st(\"w\");' value='w'></div><div id='c_image'><img src='../img/w.png'></div></div>";
  86. d += "<div id='c03'><div id='c_radio'><input type='radio' name='style' onclick='st(\"b\");' value='b' ></div><div id='c_image'><img src='../img/b.png'></div></div>";
  87. d += "<div id='c04'><div id='c_radio'><input type='radio' name='style' onclick='st(\"blue\");' value='blue' checked></div><div id='c_image'><img src='../img/blue.png'></div></div>";
  88. d += "<div id='c05'><div id='c_radio'><input type='radio' name='style' onclick='st(\"r\");' value='r' ></div><div id='c_image'><img src='../img/r.png'></div></div>";
  89. d += "</div>";
  90. }
  91. else if(style_var == 'r')
  92. {
  93. d = "<div style='padding-top: 8px;'><div id='c01'><div id='c_radio'><input type='radio' name='style' onclick='st(\"c\");' value='c'></div><div id='c_image'><img src='../img/c.png'></div></div>";
  94. d += "<div id='c02'><div id='c_radio'><input type='radio' name='style' onclick='st(\"w\");' value='w'></div><div id='c_image'><img src='../img/w.png'></div></div>";
  95. d += "<div id='c03'><div id='c_radio'><input type='radio' name='style' onclick='st(\"b\");' value='b' ></div><div id='c_image'><img src='../img/b.png'></div></div>";
  96. d += "<div id='c04'><div id='c_radio'><input type='radio' name='style' onclick='st(\"blue\");' value='blue' ></div><div id='c_image'><img src='../img/blue.png'></div></div>";
  97. d += "<div id='c05'><div id='c_radio'><input type='radio' name='style' onclick='st(\"r\");' value='r' checked></div><div id='c_image'><img src='../img/r.png'></div></div>";
  98. d += "</div>";
  99. }
  100. else
  101. {
  102. d = "<div style='padding-top: 8px;'><div id='c01'><div id='c_radio'><input type='radio' name='style' onclick='st(\"c\");' value='c'></div><div id='c_image'><img src='../img/c.png'></div></div>";
  103. d += "<div id='c02'><div id='c_radio'><input type='radio' name='style' onclick='st(\"w\");' value='w'></div><div id='c_image'><img src='../img/w.png'></div></div>";
  104. d += "<div id='c03'><div id='c_radio'><input type='radio' name='style' onclick='st(\"b\");' value='b' checked></div><div id='c_image'><img src='../img/b.png'></div></div>";
  105. d += "<div id='c04'><div id='c_radio'><input type='radio' name='style' onclick='st(\"blue\");' value='blue' ></div><div id='c_image'><img src='../img/blue.png'></div></div>";
  106. d += "<div id='c05'><div id='c_radio'><input type='radio' name='style' onclick='st(\"r\");' value='r' ></div><div id='c_image'><img src='../img/r.png'></div></div>";
  107. d += "</div>";
  108. }
  109.  
  110.    var show  = "";
  111.        show  = System.Gadget.Settings.read("ortname");
  112.        show  = show.toString();
  113.    var hello = "";
  114.        if(show == ''){hello = lang.hello;}else{hello = lang.hello2;}
  115.  
  116. document.getElementById("txt1").innerHTML = '<div>';
  117.  
  118. document.getElementById("txt1").innerHTML += '<div id="ortaktuell" ><!--<b>'+lang.setstadt+':</b> --><span id="now">'+System.Gadget.Settings.read("shortort")+' ('+System.Gadget.Settings.read("ortname")+')</span> <a href="javascript:showstadt(\'\');">'+lang.setaendern+'</a></div>';
  119.  
  120.  
  121. document.getElementById("txt1").innerHTML += '<div id="ortinput" style="display:none;"><table border="0" cellpadding="1" cellspacing="1"><tr><td valign="top"><input id="show" class="box" type="text" name="show" value="'+show+'"></td><td valign="top"><a href="javascript:search();" class="btn black">'+lang.setsearch+'</a></td></tr></table></div>';
  122.  
  123.  
  124. document.getElementById("txt1").innerHTML += '<div id="erg" style="display:none;"></div>';
  125.  
  126. document.getElementById("txt1").innerHTML += '<div class="topic2" id="a1">'+lang.topic2_1+'</div>';
  127. document.getElementById("txt1").innerHTML += '<div id="a2">'+d+'</div>';
  128. document.getElementById("txt1").innerHTML += '<div id="a3">'+s+'</div>';
  129.  
  130. document.getElementById("txt1").innerHTML += '<div class="topic3" id="a4">'+lang.topic2_2+'</div>';
  131. document.getElementById("txt1").innerHTML += '<div id="a5">'+e+'</div>';
  132. document.getElementById("txt1").innerHTML += '<div id="a6">'+gg+'</div>';
  133. document.getElementById("txt1").innerHTML += '<div id="a7">'+tar+'</div>';
  134.  
  135.  
  136. document.getElementById("txt1").innerHTML += '<div class="top20 bottom-15" id="a8"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4149245" class="btn black">'+lang.donate+'</a></div>';document.getElementById("txt1").innerHTML += '</div>';
  137. }
  138.  
  139.  
  140. function navigation(id)
  141. {
  142.    document.getElementById('nav1').className = "deaktiv";
  143.    document.getElementById('nav2').className = "deaktiv";
  144.    document.getElementById('nav3').className = "deaktiv";
  145.    document.getElementById('nav'+id).className = "aktiv";
  146.    document.getElementById('content1').style.display   = "none";
  147.    document.getElementById('content2').style.display   = "none";
  148.    document.getElementById('content3').style.display   = "none";
  149.    document.getElementById('content'+id).style.display = "block";
  150. }
  151.  
  152.  
  153.  
  154.  
  155.  
  156. function close() {
  157.    closeAction();
  158. function CF(CF)
  159. {
  160. System.Gadget.Settings.write("grad", CF);
  161. }
  162. function st(CF)
  163. {
  164. System.Gadget.Settings.write("style", CF);
  165. }
  166. function styley(CF)
  167. {
  168. System.Gadget.Settings.write("styley", CF);
  169. }
  170.  
  171.  
  172.  
  173. System.Gadget.onSettingsClosing = SettingsClosing;
  174. function SettingsClosing(event)
  175.    {
  176.       if (event.closeAction == event.Action.commit)
  177.          {
  178.              /*tagsSave  = tags_feld.value;
  179.              speedSave = envVar.value;
  180.              timeSave  = envVar3.value;
  181.              langSave  = envVar4.value;
  182.              tagsSave  = tagsSave.replace(/ /gi,",");
  183.              var url   = tagsSave.replace(/ /gi,",");
  184.                  url   = encodeURI(url);
  185.              System.Gadget.Settings.write("tageString", tagsSave);
  186.              System.Gadget.Settings.write("speedString", speedSave);
  187.              System.Gadget.Settings.write("timeString", timeSave);
  188.              System.Gadget.Settings.write("langString", langSave);
  189.              System.Gadget.Settings.write("urlString", url);*/
  190.              var win        = System.Gadget.Settings.read("win");
  191.              if(win=='vista'){
  192.              var userAgenty = document.getElementById('userAgenty').checked;
  193.              System.Gadget.Settings.write("userAgenty", userAgenty);
  194.              }
  195.              var confirmy = document.getElementById('confirmy').checked;
  196.              System.Gadget.Settings.write("confirmy", confirmy);
  197.              
  198.          }
  199.       event.cancel = false;
  200.    }
  201.    
  202.    
  203.    
  204.    
  205.    
  206. function search()
  207. {
  208.  
  209. document.getElementById('erg').innerHTML = "<div>"+lang.wait+"</div>";
  210. var rssDoc2 = new ActiveXObject("MSXML2.DOMDocument.3.0");
  211. rssDoc2.onreadystatechange = popData2;
  212. var search=document.getElementById('show').value;
  213. search = encodeURI(search);
  214. if(search == ''){search="New York";}
  215.  
  216. rssDoc2.load("http://weather.service.msn.com/data.aspx?src=vista&weasearchstr="+search+"&weadegreetype=C&culture=de-DE");
  217.  
  218. function popData2()
  219. {
  220. if(rssDoc2.readyState!=4)return;
  221. var c2 = 0;
  222. var rssItems2 = rssDoc2.selectNodes("/weatherdata/weather");
  223. var max = 3;
  224. if(rssItems2.length < max){max = rssItems2.length;}
  225. document.getElementById('erg').innerHTML = "";
  226. if(rssItems2.length == 0){document.getElementById('erg').innerHTML += "<div style='padding-top:5px;'>"+lang.setnothing+"</div>";}else{document.getElementById('erg').innerHTML += "<div style='padding-top:5px;'><b>"+lang.setchose+"</b></div>";}
  227. for(var i=0;i<max;i++)
  228. {
  229. var icode  = rssItems2[i].selectSingleNode("./@weatherlocationcode").text;
  230. var iname  = rssItems2[i].selectSingleNode("./@weatherlocationname").text;
  231.  
  232. document.getElementById('erg').innerHTML += "<input type='radio' name='i' onclick='save(\""+icode+"\", \""+iname+"\");' value='"+icode+"'> "+iname+"<br>";
  233. }
  234. document.getElementById('erg').innerHTML += '<div style="padding-top:5px;"><a href="javascript:stopp();" class="btn black">'+lang.setstopp+'</a></div>';
  235. }
  236. document.getElementById('erg').style.display        = "block";
  237. document.getElementById('ortinput').style.display   = "none";
  238. }
  239.  
  240.  
  241.  
  242.  
  243. function save(code,name) {
  244.  
  245.  
  246. var arrLine = name.split(",");
  247. var finalName = arrLine[0];
  248.  
  249. if(finalName.indexOf(",") > -1){var s = finalName.split(",");finalName = s[0];}
  250. if(finalName.indexOf("/") > -1){var s = finalName.split("/");finalName = s[0];}
  251. if(finalName.indexOf(" ") > -1){var s = finalName.split(" ");finalName = s[0]+" "+s[1];}
  252. if(finalName.length == 0){var finalName=arrLine[0];}
  253.  
  254.  
  255. System.Gadget.Settings.write("ort", code);
  256. System.Gadget.Settings.write("shortort", finalName);
  257. System.Gadget.Settings.write("ortname", name);
  258. document.getElementById('now').innerHTML = finalName + ' ('+name+')';
  259. document.getElementById('show').value = name;
  260.  
  261. document.getElementById('erg').innerHTML = '<div style="padding-top:5px;"><b>'+lang.setchange+':</b></div>';
  262. document.getElementById('erg').innerHTML += '<div style="padding-top:5px;"><input type="text" value="'+finalName+'" onchange="saveshortname()" id="shortort" /></div>';
  263. document.getElementById('erg').innerHTML += '<div style="padding-top:5px;"><a href="javascript:document.getElementById(\'ortaktuell\').style.display = \'block\';document.getElementById(\'erg\').style.display = \'none\';document.getElementById(\'a1\').style.display = \'block\';document.getElementById(\'a2\').style.display = \'block\';document.getElementById(\'a3\').style.display = \'block\';document.getElementById(\'a4\').style.display = \'block\';document.getElementById(\'a5\').style.display = \'block\';document.getElementById(\'a6\').style.display = \'block\';document.getElementById(\'a7\').style.display = \'block\';document.getElementById(\'a8\').style.display = \'block\';" class="btn black">'+lang.setsave+'</a></div>';
  264.  
  265.  
  266.  
  267.  
  268. }  
  269. function saveshortname(){
  270.  
  271. System.Gadget.Settings.write("shortort", document.getElementById("shortort").value);  /**/
  272. document.getElementById('now').innerHTML = System.Gadget.Settings.read("shortort") + ' ('+System.Gadget.Settings.read("ortname")+')';
  273. document.getElementById('ortaktuell').style.display   = "block";
  274. document.getElementById('erg').style.display          = "none"; 
  275. }   
  276. function stopp(){
  277. document.getElementById('ortaktuell').style.display   = "block";
  278. document.getElementById('erg').style.display          = "none";
  279. }
  280.  
  281. function showstadt(){
  282. document.getElementById('a1').style.display   = "none";
  283. document.getElementById('a2').style.display   = "none";
  284. document.getElementById('a3').style.display   = "none";
  285. document.getElementById('a4').style.display   = "none";
  286. document.getElementById('a5').style.display   = "none";
  287. document.getElementById('a6').style.display   = "none";
  288. document.getElementById('a7').style.display   = "none";
  289. document.getElementById('a8').style.display   = "none";
  290. document.getElementById('ortaktuell').style.display   = "none";
  291. document.getElementById('ortinput').style.display   = "block";
  292. }