JLarsen
Premium Member
- Joined
- Sep 30, 2008
- Messages
- 1,880
- Location
- Dover, New Hampshire, USA
- WCA ID
- 2009LARS03
- YouTube
- Visit Channel
Can anybody fill me in on the details of this? I actually find myself decent now and a little friendly competition sounds like fun. Does anybody know how I go about this? Who runs it? I clicked on my 10/12 and I saw the Sunday Contest button, and I submitted my info, and it gave me this as a response;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Sunday Contest Submission Page</title>
<link href="images/cube1011.css" rel="stylesheet" />
<style type="text/css">
body { font-family:arial, verdana, sans-serif; }
h1 { font-family: Trebuchet MS; color: #006699; text-align: center; }
select { border: 1px solid #000000; width: 100%; }
textarea { border: 1px solid #000000; width: 100%; }
input.text { width: 100%; border: 1px solid #000000; }
td { padding: 0px 0px 6px 5px; }
</style>
<script type="text/javascript">
<!--
var locked = false;
function validateAll() {
if(document.getElementById("name") == null)
return;
if(locked) return; //this is to keep ie from infinite looping when setting border's colors
locked = true;
var valid = validateEmail();
valid = validateName() && valid;
valid = validateAverage() && valid;
valid = validateTimes() && valid;
valid = validateQuote() && valid;
document.getElementById("submit").disabled = !valid;
locked = false;
}
function validateName() {
var name = document.getElementById("name");
var empty = (name.value == "");
document.getElementById("nameresult").innerHTML = empty ? "Please enter your name." : "";
name.style.border = getBorder(!empty);
return !empty;
}
function validateEmail() {
var email = document.getElementById("email");
var empty = (email.value == "");
document.getElementById("emailresult").innerHTML = empty ? "Please enter your email address." : "";
email.style.border = getBorder(!empty);
return !empty;
}
function validateQuote() {
var quote = document.getElementById("quote");
var empty = (quote.value == "");
document.getElementById("quoteresult").innerHTML = empty ? "Please enter a quote." : "";
quote.style.border = getBorder(!empty);
return !empty;
}
function validateAverage() {
var average = document.getElementById("average");
var div = document.getElementById("averageresult");
div.innerHTML = "";
var valid = true;
if(average.value == "") {
div.innerHTML = "Please enter an average.";
valid = false;
} else if(!isTime(average.value)) {
div.innerHTML = "Average must be a positive number!";
valid = false;
}
average.style.border = getBorder(valid);
return valid;
}
function getBorder(valid) {
return valid ? "1px solid #000000" : "1px solid #ff0000";
}
function isTime(time) {
return time.match(/^\d+(\.\d+)?$/) != null;
}
function validateTimes() {
var times = document.getElementById("times");
var div = document.getElementById("timesresult");
var timeArray = times.value.split(/, /);
var i;
for(i = 0; i < timeArray.length; i++) {
var time = timeArray.replace(/\(|\)|\+/g,""); //remove all parens
if(!isTime(time) && time != "POP" && time != "DNF" && time != "DNS") {
break;
}
}
var valid = false;
if(i == timeArray.length) { //all the times were valid
if(i < 12) {
div.innerHTML = "Too few times!";
} else if(i > 13) {
div.innerHTML = "Too many times!";
} else { //perfect
valid = true;
div.innerHTML = "";
}
} else if(timeArray.length == 1 && timeArray[0] == "") {
div.innerHTML = "Please enter your times.";
} else {
div.innerHTML = timeArray + " is not a valid time!";
}
times.style.border = getBorder(valid);
return valid;
}
function countrySelected() {
var country = document.getElementById("country");
if(country == null)
return;
var other = document.getElementById("othercountry");
if(country.value == "Other") {
other.innerHTML = "<input type='text' class='text' value='' id='ocountry' name='ocountry' style='width: 150px' title='Enter your country' />";
} else {
other.innerHTML = "";
}
}
function changeInputs() {
var els = document.getElementsByTagName('input');
var elsLen = els.length;
var i = 0;
for(i=0; i<elsLen; i++) {
if(els.getAttribute('type')) {
if ( els.getAttribute('type') == "text" )
els.className = 'text';
else
els.className = 'button';
}
}
}
-->
</script>
</head>
<body onload="validateAll(); countrySelected(); changeInputs();">
<h1>
<img src="images/cubecoolsmall.gif" alt="cube" border="0" height="47" width="43" />The Sunday Contest<img src="images/cubecoolsmall.gif" alt="cube" border="0" height="47" width="43" />
</h1>
<div id="results"> <!-- This div with id="results" is what CCT looks for to inform the user of the results of their submission. Please don't remove it! -Jeremy Fleischman -->
<br />2008-11-30<br />submitted successfully!</div></body></html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Sunday Contest Submission Page</title>
<link href="images/cube1011.css" rel="stylesheet" />
<style type="text/css">
body { font-family:arial, verdana, sans-serif; }
h1 { font-family: Trebuchet MS; color: #006699; text-align: center; }
select { border: 1px solid #000000; width: 100%; }
textarea { border: 1px solid #000000; width: 100%; }
input.text { width: 100%; border: 1px solid #000000; }
td { padding: 0px 0px 6px 5px; }
</style>
<script type="text/javascript">
<!--
var locked = false;
function validateAll() {
if(document.getElementById("name") == null)
return;
if(locked) return; //this is to keep ie from infinite looping when setting border's colors
locked = true;
var valid = validateEmail();
valid = validateName() && valid;
valid = validateAverage() && valid;
valid = validateTimes() && valid;
valid = validateQuote() && valid;
document.getElementById("submit").disabled = !valid;
locked = false;
}
function validateName() {
var name = document.getElementById("name");
var empty = (name.value == "");
document.getElementById("nameresult").innerHTML = empty ? "Please enter your name." : "";
name.style.border = getBorder(!empty);
return !empty;
}
function validateEmail() {
var email = document.getElementById("email");
var empty = (email.value == "");
document.getElementById("emailresult").innerHTML = empty ? "Please enter your email address." : "";
email.style.border = getBorder(!empty);
return !empty;
}
function validateQuote() {
var quote = document.getElementById("quote");
var empty = (quote.value == "");
document.getElementById("quoteresult").innerHTML = empty ? "Please enter a quote." : "";
quote.style.border = getBorder(!empty);
return !empty;
}
function validateAverage() {
var average = document.getElementById("average");
var div = document.getElementById("averageresult");
div.innerHTML = "";
var valid = true;
if(average.value == "") {
div.innerHTML = "Please enter an average.";
valid = false;
} else if(!isTime(average.value)) {
div.innerHTML = "Average must be a positive number!";
valid = false;
}
average.style.border = getBorder(valid);
return valid;
}
function getBorder(valid) {
return valid ? "1px solid #000000" : "1px solid #ff0000";
}
function isTime(time) {
return time.match(/^\d+(\.\d+)?$/) != null;
}
function validateTimes() {
var times = document.getElementById("times");
var div = document.getElementById("timesresult");
var timeArray = times.value.split(/, /);
var i;
for(i = 0; i < timeArray.length; i++) {
var time = timeArray.replace(/\(|\)|\+/g,""); //remove all parens
if(!isTime(time) && time != "POP" && time != "DNF" && time != "DNS") {
break;
}
}
var valid = false;
if(i == timeArray.length) { //all the times were valid
if(i < 12) {
div.innerHTML = "Too few times!";
} else if(i > 13) {
div.innerHTML = "Too many times!";
} else { //perfect
valid = true;
div.innerHTML = "";
}
} else if(timeArray.length == 1 && timeArray[0] == "") {
div.innerHTML = "Please enter your times.";
} else {
div.innerHTML = timeArray + " is not a valid time!";
}
times.style.border = getBorder(valid);
return valid;
}
function countrySelected() {
var country = document.getElementById("country");
if(country == null)
return;
var other = document.getElementById("othercountry");
if(country.value == "Other") {
other.innerHTML = "<input type='text' class='text' value='' id='ocountry' name='ocountry' style='width: 150px' title='Enter your country' />";
} else {
other.innerHTML = "";
}
}
function changeInputs() {
var els = document.getElementsByTagName('input');
var elsLen = els.length;
var i = 0;
for(i=0; i<elsLen; i++) {
if(els.getAttribute('type')) {
if ( els.getAttribute('type') == "text" )
els.className = 'text';
else
els.className = 'button';
}
}
}
-->
</script>
</head>
<body onload="validateAll(); countrySelected(); changeInputs();">
<h1>
<img src="images/cubecoolsmall.gif" alt="cube" border="0" height="47" width="43" />The Sunday Contest<img src="images/cubecoolsmall.gif" alt="cube" border="0" height="47" width="43" />
</h1>
<div id="results"> <!-- This div with id="results" is what CCT looks for to inform the user of the results of their submission. Please don't remove it! -Jeremy Fleischman -->
<br />2008-11-30<br />submitted successfully!</div></body></html>