-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfms.html
221 lines (189 loc) · 7.82 KB
/
fms.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!-- InstanceBeginEditable name="doctitle" -->
<title>FMS - Brunswick Eruption</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<link href="buttons/buttons.css" rel="stylesheet" type="text/css"/>
<script src="jquery1.6.2.js" type="text/javascript"></script>
<link rel="icon" type="image/png" href="images/favicon.png" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-6958956-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<script type="text/javascript">
var teams = ["25","41","103","224", "293", "303", "341", "369", "371",
"613", "806", "869", "888", "1075", "1089", "1143", "1279",
"1626", "1807", "1923", "2458", "2495", "2554", "2590", "2606", "2607",
"3637", "4067", "5303"];
$("document").ready( function() {
$("#MC").val('');
$("#red1").val('');
$("#red2").val('');
$("#red3").val('');
$("#blue1").val('');
$("#blue2").val('');
$("#blue3").val('');
$("#RHS").val('');
$("#RTS").val('');
$("#RB").val('');
$("#RFP").val('');
$("#BHS").val('');
$("#BTS").val('');
$("#BB").val('');
$("#BFP").val('');
$("#tweetScoreForm").submit( function() {
// TODO: Error checking
var TY = $("#TY").val();
var MC = $("#MC").val();
var RHS = $("#RHS").val() || 0;
var BHS = $("#BHS").val() || 0;
var RTS = $("#RTS").val() || 0;
var BTS = $("#BTS").val() || 0;
var RB = $("#RB").val() || 0;
var BB = $("#BB").val() || 0;
var RFP = $("#RFP").val() || 0;
var BFP = $("#BFP").val() || 0;
var CP = $("#CP").val() || 0;
var RF = parseInt(RHS) + parseInt(RTS) + parseInt(RB) + parseInt(RFP);
var BF = parseInt(BHS) + parseInt(BTS) + parseInt(BB) + parseInt(BFP);
var r1 = $("#red1").val();
var r2 = $("#red2").val();
var r3 = $("#red3").val();
var b1 = $("#blue1").val();
var b2 = $("#blue2").val();
var b3 = $("#blue3").val();
function validateTeam(team) {
var r;
if (teams.indexOf(team) === -1) {
return false;
}
return true;
}
if(!validateTeam(r1) || !validateTeam(r2) || !validateTeam(r3) ||
!validateTeam(b1) || !validateTeam(b2) || !validateTeam(b3)) {
alert("Invalid team entered.");
return false;
}
var tweetText = '#FRCBE TY ' + TY + ' MC ' + MC + ' ';
tweetText += 'RF ' + RF + ' BF ' + BF + ' ';
tweetText += 'RA ' + r1 + ' ' + r2 + ' ' + r3 + ' ';
tweetText += 'BA ' + b1 + ' ' + b2 + ' ' + b3 + ' ';
tweetText += 'RB ' + RB + ' ';
tweetText += 'BB ' + BB + ' ';
tweetText += 'RFP ' + RFP + ' ';
tweetText += 'BFP ' + BFP + ' ';
tweetText += 'RHS ' + RHS + ' ';
tweetText += 'BHS ' + BHS + ' ';
tweetText += 'RTS ' + RTS + ' ';
tweetText += 'BTS ' + BTS + ' ';
tweetText += 'CP ' + CP;
$.ajax( {
url: "post_tweet.php",
type: "POST",
data: "tweetText=" + tweetText,
success: function( msg ) {
console.log('Tweeted and received result status: ' + msg);
$("#ajaxresult").html( msg +'</br>If the response code is 200 - great success! Refresh the page to enter the data for the next round.');
$("#ajaxresult").show();
}
});
if (TY === 'Q' || TY === 'E') {
// Write the match record to a file
$.ajax( {
url: "writeMatchRecord.php",
type: "POST",
data: 'MC=' + MC + '&TY=' + TY +'&RF=' + RF + '&BF=' + BF + '&R1=' + r1 + '&R2=' + r2 + '&R3=' + r3 + '&B1=' + b1 + '&B2=' + b2 + '&B3=' + b3 + '&RB=' + RB + '&BB=' + BB + '&RFP=' + RFP + '&BFP=' + BFP + '&RHS=' + RHS + '&BHS=' + BHS + '&RTS=' + RTS + '&BTS=' + BTS + '&CP=' + CP,
success: function( msg ) {
console.log(msg);
console.log('Successfully wrote match record to file.');
}
});
}
return false;
});
});
</script>
</head>
<body>
<!-- Facebook and Twitter scripts -->
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "http://connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="http://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
<!-- End Facebook and Twitter scripts -->
<div id="headerBackground">
<div id="header">
<img id="headerImage" src="./images/header.png" alt="" onDragStart="return false;"/>
</div>
</div>
<div class="mainContent">
<br/>
<form id="tweetScoreForm">
<div class="row centered">Match Type:
<select id="TY">
<option value="Q">Q</option>
<option value="E">E</option>
<option value="P">P</option>
</select>
<br/></div>
<div class="row centered">Match Number: <input id="MC" type="text"/> <br/></div>
<div id="blueScoreInfo">
<div class="row">Team 1: <input id="blue1" type="text"/> <br/></div>
<div class="row">Team 2: <input id="blue2" type="text"/> <br/></div>
<div class="row">Team 3: <input id="blue3" type="text"/> <br/></div>
<br/>
<div class="row">Hybrid: <input id="BHS" type="text"/> <br/></div>
<div class="row">Teleoperated: <input id="BTS" type="text"/> <br/></div>
<div class="row">Bridge Points: <input id="BB" type="text"/> <br/></div>
<div class="row">Foul Points: <input id="BFP" type="text"/> <br/></div>
</div>
<div id="redScoreInfo">
<div class="row">Team 1: <input id="red1" type="text"/> <br/></div>
<div class="row">Team 2: <input id="red2" type="text"/> <br/></div>
<div class="row">Team 3: <input id="red3" type="text"/> <br/></div>
<br/>
<div class="row">Hybrid: <input id="RHS" type="text"/> <br/></div>
<div class="row">Teleoperated: <input id="RTS" type="text"/> <br/></div>
<div class="row">Bridge Points: <input id="RB" type="text"/> <br/></div>
<div class="row">Foul Points: <input id="RFP" type="text"/> <br/></div>
</div>
<div class="row centered">Coopertition Points:
<select id="CP">
<option value="0">0</option>
<option value="2">2</option>
<option value="1">1</option>
</select><br/></div>
<input type="submit" value="Submit Score" class="button blue big" id="submitTweet"/>
</form>
<div id="ajaxresult" style="display: none">
</div>
</div>
<img id="floral" src="./images/flower.png" alt=""/>
<div id="social">
<div class="fb-like" data-href="http://www.facebook.com/BrunswickEruption" data-send="false" data-layout="box_count" data-width="50" data-show-faces="false" data-font="lucida grande"></div>
<a href="https://twitter.com/BrunsEruption" class="twitter-follow-button" data-show-count="false" data-size="large" data-show-screen-name="false">Follow @BrunsEruption</a>
</div>
<div id="footer">
<div id="footerContent">
<a href="http://www.usfirst.org" target="_blank"> <img id="FIRSTlogo" src="images/FIRST_vert.gif" alt=""/></a>
<a href="http://www.raiderrobotix.org" target="_blank"> <img id="RaiderRobotixLogo" src="images/Team25Logo.png" alt=""/></a>
</div>
<div id="copyright">
Copyright Raider Robotix / Brunswick Eruption 2012
</div>
</div>
</body>
</html>