-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweatherPractice.html
53 lines (47 loc) · 1.8 KB
/
weatherPractice.html
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
<html>
<head>
<!-- Include all scripts and references here -->
<script type="text/javascript" src="http://d3js.org/d3.v2.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script src="main.js"></script>
<link type="text/css" rel="stylesheet" href="style.css">
<!-- Include all scripts and references here -->
</head>
<body style="background:#CCC">
<div id="info" class="infobox" style="display:none">
<p>Here is where we will say something.</p>
</div>
<div id="loading-image">
<img src="ajax-loader.gif">
</div>
<div id="search">
City: <input type="text" value="FL/Tampa" id="city" />
<button onClick="main()">Try it</button>
<p>We also suggest: India/Kolkata or CA/San_Francisco</p>
</div>
<div id="graph" class="center">
<!-- Location for graphs to go -->
</div>
<!-- Reference to custom code-->
<script>
//Call main on page load
$(document).ready(function() {
$('#loading-image').hide();
main();
});
//This is vulnerable to injection attacks
function main(){
$('svg').remove();
city = document.getElementById('city').value;
if(city === ""){
city = "CA/San_Francisco";
}
var curr_width = document.body.clientWidth-20;
var url_temp = "http://api.wunderground.com/api/9da96fc7939df769/conditions/tide/hourly10day/q/"+ city + ".json";
var url_tide = "http://api.wunderground.com/api/9da96fc7939df769/conditions/tide/hourly10day/q/"+ city + ".json";
showTideData(curr_width, curr_width/8, url_tide);
showTempData(curr_width, curr_width/4, url_temp);
}
</script>
</body>
</html>