PluginProbe
wp-forecast / 2.8
wp-forecast v2.8
10.0 trunk 1.4 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3..5 3..8 3.0 3.1 3.2 3.3 3.4 3.6 All 86 releases
wp-forecast / wpf_update.js

wpf_update.js in wp-forecast 2.8, at wpf_update.js

52 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*
2
3 javascript for ajax like request to update the weather location
4 and corresponding data on the fly
5
6 */
7
8
9 /* get the data for the new location */
10 function wpf_update()
11 {
12 var newloc = document.getElementById("wpf_selector").value;
13 var siteuri = document.getElementById("wpf_selector_site").value;
14
15 jQuery.get(siteuri + "/wp-forecast-show.php",
16 { wpfcid: newloc, header: "0" , selector: "1" },
17 function(data){
18 var b = data.indexOf(">");
19 var e = data.lastIndexOf("<");
20 data = data.substring(b + 1, e - 1);
21 jQuery("div#wp-forecastA").html(data);
22 });
23 }
24
25 /* javascript to rebuild the onLoad event for triggering
26 the first wpf_update call */
27
28 //create onDomReady Event
29 window.onDomReady = initReady;
30
31 // Initialize event depending on browser
32 function initReady(fn)
33 {
34 //W3C-compliant browser
35 if(document.addEventListener) {
36 document.addEventListener("DOMContentLoaded", fn, false);
37 }
38 //IE
39 else {
40 document.onreadystatechange = function(){readyState(fn)}
41 }
42 }
43
44 //IE execute function
45 function readyState(func)
46 {
47 // DOM is ready
48 if(document.readyState == "interactive" || document.readyState == "complete")
49 {
50 func();
51 }
52 }