-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
104 lines (95 loc) · 3.28 KB
/
index.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
git ststu<!DOCTYPE html>
<html>
<head>
<title>Ice Sheet Calculator</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="../../assets/js/html5shiv.js"></script>
<script src="../../assets/js/respond.min.js"></script>
<![endif]-->
<style type="text/css">
body {
padding-top: 50px;
}
</style>
</head>
<body ng-app>
<div class="navbar">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand">Ice Sheet Calculator</a>
</div>
</div>
</div>
<div class="container" ng-controller="iceCalcCtrl">
<div class="jumbotron">
<table>
<tr>
<td>
Length Of Ice Sheet:
<td>
<td>
<input type="number" ng-model="sheetLength"/> km
<td>
<tr>
<tr>
<td>
Width Of Ice Sheet:
<td>
<td>
<input type="number" ng-model="sheetWidth"/> km
<td>
<tr>
<tr>
<td>
Depth Of Ice Sheet:
<td>
<td>
<input type="number" ng-model="sheetDepth"/> km
<td>
<tr>
</table>
</div>
<div class="jumbotron">
<p>Total weight of ice sheet: {{totalWeightTons | number}} tonnes </p>
<p>Total weight of ice sheet: {{totalWeightGigaTons | number}} gigatonnes </p>
</div>
<div class="jumbotron">
<p>See the code Github - <a href="https://github.com/theboxfactory/icesheetcalc">here</a></p>
<p>Send questions, cash or cat pictures to: <a href="https://twitter.com/theboxfactory">@theboxfactory</a></p>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="//code.jquery.com/jquery.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<!-- Latest compiled and minified JavaScript -->
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>
<script>
var iceCalcCtrl = function($scope) {
// Set initial ice sheet dimensions
$scope.sheetLength = 2700;
$scope.sheetWidth = 900;
$scope.sheetDepth = 3;
// Populate percentage dropdown
$scope.items = function() {
var percentages = [];
for(var i = 1; i <= 100; i++) {
percentages.push(i);
}
return percentages;
}();
// Call this function if any input values change
var recalc = function() {
$scope.totalWeightGigaTons = $scope.sheetLength * $scope.sheetWidth * $scope.sheetDepth;
$scope.totalWeightTons = $scope.totalWeightGigaTons * 1000000000;
}
//
$scope.$watch('sheetLength + sheetWidth + sheetDepth', recalc);
}
</script>
</body>
</html>