|
@ -469,83 +469,98 @@ function WordEntryKeyPress(event) |
|
|
// Helper functions |
|
|
// Helper functions |
|
|
|
|
|
|
|
|
// Returns true if the string passed in contains any characters prone to evil. |
|
|
// Returns true if the string passed in contains any characters prone to evil. |
|
|
function ContainsBadChars(theirWord) |
|
|
function ContainsBadChars(theirWord) { |
|
|
{return false; |
|
|
return false; |
|
|
for (var i = 0; i < theirWord.length; i++) |
|
|
|
|
|
|
|
|
for (var i = 0; i < theirWord.length; i++) { |
|
|
if (BadChars.indexOf(theirWord.charAt(i)) >= 0) return true; |
|
|
if (BadChars.indexOf(theirWord.charAt(i)) >= 0) return true; |
|
|
|
|
|
} |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Pads a number out to three characters. |
|
|
// Pads a number out to three characters. |
|
|
function PadNumber(number) |
|
|
function PadNumber(number) { |
|
|
{ |
|
|
if (number < 10) } |
|
|
if (number < 10) |
|
|
|
|
|
return "00" + number; |
|
|
return "00" + number; |
|
|
else if (number < 100) |
|
|
} else if (number < 100) { |
|
|
return "0" + number; |
|
|
return "0" + number; |
|
|
else |
|
|
} else { |
|
|
return "" + number; |
|
|
return "" + number; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Returns the table cell at a particular pair of coordinates. |
|
|
// Returns the table cell at a particular pair of coordinates. |
|
|
function CellAt(x, y) |
|
|
function CellAt(x, y) { |
|
|
{ |
|
|
|
|
|
return document.getElementById("c" + PadNumber(x) + PadNumber(y)); |
|
|
return document.getElementById("c" + PadNumber(x) + PadNumber(y)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Deselects the current word, if there's a word selected. DOES not change the value of CurrentWord. |
|
|
// Deselects the current word, if there's a word selected. DOES not change the value of CurrentWord. |
|
|
function DeselectCurrentWord() |
|
|
function DeselectCurrentWord() { |
|
|
{ |
|
|
if (CurrentWord < 0) { |
|
|
if (CurrentWord < 0) return; |
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var x, y, i; |
|
|
var x, y, i; |
|
|
|
|
|
|
|
|
document.getElementById("answerbox").style.display = "none"; |
|
|
document.getElementById("answerbox").style.display = "none"; |
|
|
document.getElementById("answerbox2").style.display = "none"; |
|
|
document.getElementById("answerbox2").style.display = "none"; |
|
|
ChangeCurrentWordSelectedStyle( false); |
|
|
ChangeCurrentWordSelectedStyle( false); |
|
|
CurrentWord = -1; |
|
|
CurrentWord = -1; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Changes the style of the cells in the current word. |
|
|
// Changes the style of the cells in the current word. |
|
|
function ChangeWordStyle(WordNumber, NewStyle) |
|
|
function ChangeWordStyle(WordNumber, NewStyle) { |
|
|
{ |
|
|
if (WordNumber< 0) { |
|
|
if (WordNumber< 0) return; |
|
|
return; |
|
|
|
|
|
} |
|
|
var x = WordX[WordNumber]; |
|
|
var x = WordX[WordNumber]; |
|
|
var y = WordY[WordNumber]; |
|
|
var y = WordY[WordNumber]; |
|
|
|
|
|
|
|
|
if (WordNumber<= LastHorizontalWord) |
|
|
if (WordNumber<= LastHorizontalWord) { |
|
|
for (i = 0; i < WordLength[WordNumber]; i++) |
|
|
for (i = 0; i < WordLength[WordNumber]; i++) { |
|
|
CellAt(x + i, y).className = NewStyle; |
|
|
CellAt(x + i, y).className = NewStyle; |
|
|
else |
|
|
} |
|
|
for (i = 0; i < WordLength[WordNumber]; i++) |
|
|
} else { |
|
|
|
|
|
for (i = 0; i < WordLength[WordNumber]; i++) { |
|
|
CellAt(x, y + i).className = NewStyle; |
|
|
CellAt(x, y + i).className = NewStyle; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Changes the style of the cells in the current word between the selected/unselected form. |
|
|
// Changes the style of the cells in the current word between the selected/unselected form. |
|
|
function ChangeCurrentWordSelectedStyle(IsSelected) |
|
|
function ChangeCurrentWordSelectedStyle(IsSelected) { |
|
|
{ |
|
|
if (CurrentWord < 0) { |
|
|
if (CurrentWord < 0) return; |
|
|
return; |
|
|
|
|
|
} |
|
|
var x = WordX[CurrentWord]; |
|
|
var x = WordX[CurrentWord]; |
|
|
var y = WordY[CurrentWord]; |
|
|
var y = WordY[CurrentWord]; |
|
|
|
|
|
|
|
|
if (CurrentWord <= LastHorizontalWord) |
|
|
if (CurrentWord <= LastHorizontalWord) { |
|
|
for (i = 0; i < WordLength[CurrentWord]; i++) |
|
|
for (i = 0; i < WordLength[CurrentWord]; i++) { |
|
|
CellAt(x + i, y).className = CellAt(x + i, y).className.replace(IsSelected ? "_unsel" : "_sel", IsSelected ? "_sel" : "_unsel"); |
|
|
CellAt(x + i, y).className = CellAt(x + i, y).className. |
|
|
else |
|
|
replace(IsSelected ? "_unsel" : "_sel", IsSelected ? "_sel" : "_unsel"); |
|
|
for (i = 0; i < WordLength[CurrentWord]; i++) |
|
|
} |
|
|
CellAt(x, y + i).className = CellAt(x, y + i).className.replace(IsSelected ? "_unsel" : "_sel", IsSelected ? "_sel" : "_unsel"); |
|
|
} else { |
|
|
|
|
|
for (i = 0; i < WordLength[CurrentWord]; i++) { |
|
|
|
|
|
CellAt(x, y + i).className = CellAt(x, y + i).className. |
|
|
|
|
|
replace(IsSelected ? "_unsel" : "_sel", IsSelected ? "_sel" : "_unsel"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Selects the new word by parsing the name of the TD element referenced by the |
|
|
// Selects the new word by parsing the name of the TD element referenced by the |
|
|
// event object, and then applying styles as necessary. |
|
|
// event object, and then applying styles as necessary. |
|
|
function SelectThisWord(event) |
|
|
function SelectThisWord(event) { |
|
|
{ |
|
|
if (CrosswordFinished) { |
|
|
if (CrosswordFinished) return; |
|
|
return; |
|
|
|
|
|
} |
|
|
var x, y, i, TheirWord, TableCell; |
|
|
var x, y, i, TheirWord, TableCell; |
|
|
|
|
|
|
|
|
// Deselect the previous word if one was selected. |
|
|
// Deselect the previous word if one was selected. |
|
|
document.getElementById("welcomemessage").style.display = "none"; |
|
|
document.getElementById("welcomemessage").style.display = "none"; |
|
|
if (CurrentWord >= 0) OKClick(); |
|
|
if (CurrentWord >= 0) { |
|
|
|
|
|
OKClick(); |
|
|
|
|
|
} |
|
|
DeselectCurrentWord(); |
|
|
DeselectCurrentWord(); |
|
|
|
|
|
|
|
|
// Determine the coordinates of the cell they clicked, and then the word that |
|
|
// Determine the coordinates of the cell they clicked, and then the word that |
|
@ -555,12 +570,13 @@ function SelectThisWord(event) |
|
|
y = parseInt(target.id.substring(4, 7), 10); |
|
|
y = parseInt(target.id.substring(4, 7), 10); |
|
|
|
|
|
|
|
|
// If they clicked an intersection, choose the type of word that was NOT selected last time. |
|
|
// If they clicked an intersection, choose the type of word that was NOT selected last time. |
|
|
if (TableAcrossWord[x][y] >= 0 && TableDownWord[x][y] >= 0) |
|
|
if (TableAcrossWord[x][y] >= 0 && TableDownWord[x][y] >= 0) { |
|
|
CurrentWord = PrevWordHorizontal ? TableDownWord[x][y] : TableAcrossWord[x][y]; |
|
|
CurrentWord = PrevWordHorizontal ? TableDownWord[x][y] : TableAcrossWord[x][y]; |
|
|
else if (TableAcrossWord[x][y] >= 0) |
|
|
} else if (TableAcrossWord[x][y] >= 0) { |
|
|
CurrentWord = TableAcrossWord[x][y]; |
|
|
CurrentWord = TableAcrossWord[x][y]; |
|
|
else if (TableDownWord[x][y] >= 0) |
|
|
} else if (TableDownWord[x][y] >= 0) { |
|
|
CurrentWord = TableDownWord[x][y]; |
|
|
CurrentWord = TableDownWord[x][y]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
PrevWordHorizontal = (CurrentWord <= LastHorizontalWord); |
|
|
PrevWordHorizontal = (CurrentWord <= LastHorizontalWord); |
|
|
|
|
|
|
|
@ -572,13 +588,13 @@ function SelectThisWord(event) |
|
|
y = WordY[CurrentWord]; |
|
|
y = WordY[CurrentWord]; |
|
|
TheirWord = ""; |
|
|
TheirWord = ""; |
|
|
var TheirWordLength = 0; |
|
|
var TheirWordLength = 0; |
|
|
for (i = 0; i < WordLength[CurrentWord]; i++) |
|
|
for (i = 0; i < WordLength[CurrentWord]; i++) { |
|
|
{ |
|
|
|
|
|
// Find the appropriate table cell. |
|
|
// Find the appropriate table cell. |
|
|
if (CurrentWord <= LastHorizontalWord) |
|
|
if (CurrentWord <= LastHorizontalWord) { |
|
|
TableCell = CellAt(x + i, y); |
|
|
TableCell = CellAt(x + i, y); |
|
|
else |
|
|
} else { |
|
|
TableCell = CellAt(x, y + i); |
|
|
TableCell = CellAt(x, y + i); |
|
|
|
|
|
} |
|
|
// Add its contents to the word we're building. |
|
|
// Add its contents to the word we're building. |
|
|
if (TableCell.innerHTML != null && TableCell.innerHTML.length > 0 && |
|
|
if (TableCell.innerHTML != null && TableCell.innerHTML.length > 0 && |
|
|
TableCell.innerHTML != " " && TableCell.innerHTML.toLowerCase() != " ") { |
|
|
TableCell.innerHTML != " " && TableCell.innerHTML.toLowerCase() != " ") { |
|
@ -591,10 +607,8 @@ function SelectThisWord(event) |
|
|
|
|
|
|
|
|
document.getElementById("wordlabel").innerHTML = TheirWord; |
|
|
document.getElementById("wordlabel").innerHTML = TheirWord; |
|
|
<?php |
|
|
<?php |
|
|
$msg = "\"".get_string( 'cross_across', 'game').", \" : \"". |
|
|
$msg = "\"".get_string( 'cross_across', 'game').", \" : \"".get_string( 'cross_down', 'game').", \""; |
|
|
get_string( 'cross_down', 'game').", \""; |
|
|
$letters = "\" ".get_string( 'letter', 'game').".\" : \" ".get_string( 'letters', 'game').".\""; |
|
|
$letters = "\" ".get_string( 'letter', 'game').".\" : \" ". |
|
|
|
|
|
get_string( 'letters', 'game').".\""; |
|
|
|
|
|
?> |
|
|
?> |
|
|
var s = ((CurrentWord <= LastHorizontalWord) ? <?php echo $msg ?>); |
|
|
var s = ((CurrentWord <= LastHorizontalWord) ? <?php echo $msg ?>); |
|
|
s = s + WordLength[CurrentWord] + (WordLength[CurrentWord] == 1 ? <?php echo $letters;?>); |
|
|
s = s + WordLength[CurrentWord] + (WordLength[CurrentWord] == 1 ? <?php echo $letters;?>); |
|
@ -602,56 +616,53 @@ function SelectThisWord(event) |
|
|
|
|
|
|
|
|
document.getElementById("wordclue").innerHTML = Clue[CurrentWord]; |
|
|
document.getElementById("wordclue").innerHTML = Clue[CurrentWord]; |
|
|
document.getElementById("worderror").style.display = "none"; |
|
|
document.getElementById("worderror").style.display = "none"; |
|
|
//document.getElementById("cheatbutton").style.display = (Word.length == 0) ? "none" : ""; |
|
|
|
|
|
if (TheirWordLength == WordLength[CurrentWord]) |
|
|
if (TheirWordLength == WordLength[CurrentWord]) { |
|
|
document.getElementById("wordentry").value = TheirWord; |
|
|
document.getElementById("wordentry").value = TheirWord; |
|
|
else |
|
|
} else { |
|
|
document.getElementById("wordentry").value = ""; |
|
|
document.getElementById("wordentry").value = ""; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Finally, show the answer box. |
|
|
// Finally, show the answer box. |
|
|
document.getElementById("answerbox").style.display = "block"; |
|
|
document.getElementById("answerbox").style.display = "block"; |
|
|
document.getElementById("answerbox2").style.display = "block"; |
|
|
document.getElementById("answerbox2").style.display = "block"; |
|
|
try |
|
|
try { |
|
|
{ |
|
|
|
|
|
document.getElementById("wordentry").focus(); |
|
|
document.getElementById("wordentry").focus(); |
|
|
document.getElementById("wordentry").select(); |
|
|
document.getElementById("wordentry").select(); |
|
|
} |
|
|
} |
|
|
catch (e) |
|
|
catch (e) { |
|
|
{ |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Called when the user clicks the OK link. |
|
|
// Called when the user clicks the OK link. |
|
|
function OKClick() |
|
|
function OKClick() { |
|
|
{ |
|
|
|
|
|
var TheirWord, x, y, i, TableCell; |
|
|
var TheirWord, x, y, i, TableCell; |
|
|
if (CrosswordFinished) return; |
|
|
if (CrosswordFinished) { |
|
|
if (document.getElementById("okbutton").disabled) return; |
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
if (document.getElementById("okbutton").disabled) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// First, validate the entry. |
|
|
// First, validate the entry. |
|
|
TheirWord = document.getElementById("wordentry").value.toUpperCase(); |
|
|
TheirWord = document.getElementById("wordentry").value.toUpperCase(); |
|
|
if (TheirWord.length == 0) |
|
|
if (TheirWord.length == 0) { |
|
|
{ |
|
|
|
|
|
DeselectCurrentWord(); |
|
|
DeselectCurrentWord(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (ContainsBadChars(TheirWord)) |
|
|
if (ContainsBadChars(TheirWord)) { |
|
|
{ |
|
|
|
|
|
document.getElementById("worderror").innerHTML = "<?php echo get_string( 'cross_error_containsbadchars', 'game');?>"; |
|
|
document.getElementById("worderror").innerHTML = "<?php echo get_string( 'cross_error_containsbadchars', 'game');?>"; |
|
|
document.getElementById("worderror").style.display = "block"; |
|
|
document.getElementById("worderror").style.display = "block"; |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (TheirWord.length < WordLength[CurrentWord]) |
|
|
if (TheirWord.length < WordLength[CurrentWord]) { |
|
|
{ |
|
|
|
|
|
var s = "<?php echo get_string( 'cross_error_wordlength1', 'game');?>"; |
|
|
var s = "<?php echo get_string( 'cross_error_wordlength1', 'game');?>"; |
|
|
s = s + WordLength[CurrentWord] + " <?php echo get_string( 'cross_error_wordlength2', 'game');?>"; |
|
|
s = s + WordLength[CurrentWord] + " <?php echo get_string( 'cross_error_wordlength2', 'game');?>"; |
|
|
document.getElementById("worderror").innerHTML = s; |
|
|
document.getElementById("worderror").innerHTML = s; |
|
|
document.getElementById("worderror").style.display = "block"; |
|
|
document.getElementById("worderror").style.display = "block"; |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (TheirWord.length > WordLength[CurrentWord]) |
|
|
if (TheirWord.length > WordLength[CurrentWord]) { |
|
|
{ |
|
|
|
|
|
var s = "<?php echo get_string( 'cross_error_wordlength1', 'game');?>"; |
|
|
var s = "<?php echo get_string( 'cross_error_wordlength1', 'game');?>"; |
|
|
s = s + WordLength[CurrentWord] + " <?php echo get_string( 'cross_error_wordlength2', 'game');?>"; |
|
|
s = s + WordLength[CurrentWord] + " <?php echo get_string( 'cross_error_wordlength2', 'game');?>"; |
|
|
document.getElementById("worderror").innerHTML = s; |
|
|
document.getElementById("worderror").innerHTML = s; |
|
@ -662,8 +673,7 @@ function OKClick() |
|
|
// If we made it this far, they typed an acceptable word, so add these letters to the puzzle and hide the entry box. |
|
|
// If we made it this far, they typed an acceptable word, so add these letters to the puzzle and hide the entry box. |
|
|
x = WordX[CurrentWord]; |
|
|
x = WordX[CurrentWord]; |
|
|
y = WordY[CurrentWord]; |
|
|
y = WordY[CurrentWord]; |
|
|
for (i = 0; i < TheirWord.length; i++) |
|
|
for (i = 0; i < TheirWord.length; i++) { |
|
|
{ |
|
|
|
|
|
TableCell = CellAt(x + (CurrentWord <= LastHorizontalWord ? i : 0), y + (CurrentWord > LastHorizontalWord ? i : 0)); |
|
|
TableCell = CellAt(x + (CurrentWord <= LastHorizontalWord ? i : 0), y + (CurrentWord > LastHorizontalWord ? i : 0)); |
|
|
TableCell.innerHTML = TheirWord.substring(i, i + 1); |
|
|
TableCell.innerHTML = TheirWord.substring(i, i + 1); |
|
|
} |
|
|
} |
|
@ -673,38 +683,31 @@ function OKClick() |
|
|
<?php |
|
|
<?php |
|
|
if ($showhtmlsolutions == false) { |
|
|
if ($showhtmlsolutions == false) { |
|
|
?> |
|
|
?> |
|
|
function PackPuzzle( sData) |
|
|
function PackPuzzle( sData) { |
|
|
{ |
|
|
var i, s, s2, n, j; |
|
|
var i; |
|
|
|
|
|
var s; |
|
|
|
|
|
var s2; |
|
|
|
|
|
var n; |
|
|
|
|
|
var j; |
|
|
|
|
|
|
|
|
|
|
|
s = ""; |
|
|
s = ""; |
|
|
len = sData.length; |
|
|
len = sData.length; |
|
|
for(i=0; i < len; i++) |
|
|
for(i=0; i < len; i++) { |
|
|
{ |
|
|
|
|
|
c = sData.charAt( i); |
|
|
c = sData.charAt( i); |
|
|
if( (c > "0") && (c <= "9")) |
|
|
if( (c > "0") && (c <= "9")) { |
|
|
{ |
|
|
|
|
|
s = s.concat( '/'); |
|
|
s = s.concat( '/'); |
|
|
} |
|
|
} |
|
|
s = s.concat( c); |
|
|
s = s.concat( c); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
for(;;) |
|
|
for(;;) { |
|
|
{ |
|
|
|
|
|
i = s.indexOf( "__"); |
|
|
i = s.indexOf( "__"); |
|
|
if( i == -1) |
|
|
if( i == -1) { |
|
|
break; |
|
|
break; |
|
|
|
|
|
} |
|
|
len = s.length; |
|
|
len = s.length; |
|
|
|
|
|
|
|
|
for( j=i ; j < len; j++) |
|
|
for( j=i ; j < len; j++) { |
|
|
{ |
|
|
if( s.charAt( j) != "_") { |
|
|
if( s.charAt( j) != "_") |
|
|
|
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
n = j - i; |
|
|
n = j - i; |
|
|
s2 = s.substr( 0, i); |
|
|
s2 = s.substr( 0, i); |
|
|
s2 = s2.concat( n); |
|
|
s2 = s2.concat( n); |
|
@ -715,49 +718,50 @@ function PackPuzzle( sData) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Called when the "check server" link is clicked. |
|
|
// Called when the "check server" link is clicked. |
|
|
function CheckServerClick( endofgame) |
|
|
function CheckServerClick( endofgame) { |
|
|
{ |
|
|
|
|
|
var i, j, x, y, UserEntry, ErrorsFound = 0, EmptyFound = 0, TableCell; |
|
|
var i, j, x, y, UserEntry, ErrorsFound = 0, EmptyFound = 0, TableCell; |
|
|
if (CrosswordFinished) |
|
|
if (CrosswordFinished) { |
|
|
return; |
|
|
return; |
|
|
|
|
|
} |
|
|
DeselectCurrentWord(); |
|
|
DeselectCurrentWord(); |
|
|
|
|
|
|
|
|
for (y = 0; y < CrosswordHeight; y++) |
|
|
for (y = 0; y < CrosswordHeight; y++) { |
|
|
for (x = 0; x < CrosswordWidth; x++) |
|
|
for (x = 0; x < CrosswordWidth; x++) { |
|
|
{ |
|
|
if (TableAcrossWord[x][y] >= 0 || TableDownWord[x][y] >= 0) { |
|
|
if (TableAcrossWord[x][y] >= 0 || TableDownWord[x][y] >= 0) |
|
|
|
|
|
{ |
|
|
|
|
|
TableCell = CellAt(x, y); |
|
|
TableCell = CellAt(x, y); |
|
|
if (TableCell.className == "box boxerror_unsel") |
|
|
if (TableCell.className == "box boxerror_unsel") { |
|
|
TableCell.className = "box boxnormal_unsel"; |
|
|
TableCell.className = "box boxnormal_unsel"; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
sData = ""; |
|
|
sData = ""; |
|
|
for (i = 0; i < Words; i++) |
|
|
for (i = 0; i < Words; i++) { |
|
|
{ |
|
|
|
|
|
// Get the user's entry for this word. |
|
|
// Get the user's entry for this word. |
|
|
UserEntry = ""; |
|
|
UserEntry = ""; |
|
|
for (j = 0; j < WordLength[i]; j++) |
|
|
for (j = 0; j < WordLength[i]; j++) { |
|
|
{ |
|
|
if (i <= LastHorizontalWord) { |
|
|
if (i <= LastHorizontalWord) |
|
|
|
|
|
TableCell = CellAt(WordX[i] + j, WordY[i]); |
|
|
TableCell = CellAt(WordX[i] + j, WordY[i]); |
|
|
else |
|
|
} else { |
|
|
TableCell = CellAt(WordX[i], WordY[i] + j); |
|
|
TableCell = CellAt(WordX[i], WordY[i] + j); |
|
|
if (TableCell.innerHTML.length > 0 && TableCell.innerHTML.toLowerCase() != " ") |
|
|
} |
|
|
|
|
|
if (TableCell.innerHTML.length > 0 && TableCell.innerHTML.toLowerCase() != " ") { |
|
|
UserEntry += TableCell.innerHTML.toUpperCase(); |
|
|
UserEntry += TableCell.innerHTML.toUpperCase(); |
|
|
else if( TableCell.innerHTML.toLowerCase() == " ") |
|
|
} else if( TableCell.innerHTML.toLowerCase() == " ") { |
|
|
UserEntry += " "; |
|
|
UserEntry += " "; |
|
|
else |
|
|
} else { |
|
|
UserEntry += "_"; |
|
|
UserEntry += "_"; |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
sData += UserEntry; |
|
|
sData += UserEntry; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
sData = PackPuzzle( sData); |
|
|
sData = PackPuzzle( sData); |
|
|
|
|
|
|
|
|
if( endofgame) |
|
|
if( endofgame) { |
|
|
sData += "&finishattempt=1"; |
|
|
sData += "&finishattempt=1"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
<?php |
|
|
<?php |
|
|
if ($onlyshow == false) { |
|
|
if ($onlyshow == false) { |
|
@ -783,8 +787,7 @@ function OnPrint() |
|
|
<?php |
|
|
<?php |
|
|
if ($showhtmlprintbutton) { |
|
|
if ($showhtmlprintbutton) { |
|
|
?> |
|
|
?> |
|
|
function PrintHtmlClick() |
|
|
function PrintHtmlClick() { |
|
|
{ |
|
|
|
|
|
document.getElementById("printhtmlbutton").style.display = "none"; |
|
|
document.getElementById("printhtmlbutton").style.display = "none"; |
|
|
|
|
|
|
|
|
<?php |
|
|
<?php |
|
@ -830,7 +833,6 @@ var Base64 = { |
|
|
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); |
|
|
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); |
|
|
|
|
|
|
|
|
while (i < input.length) { |
|
|
while (i < input.length) { |
|
|
|
|
|
|
|
|
enc1 = this._keyStr.indexOf(input.charAt(i++)); |
|
|
enc1 = this._keyStr.indexOf(input.charAt(i++)); |
|
|
enc2 = this._keyStr.indexOf(input.charAt(i++)); |
|
|
enc2 = this._keyStr.indexOf(input.charAt(i++)); |
|
|
enc3 = this._keyStr.indexOf(input.charAt(i++)); |
|
|
enc3 = this._keyStr.indexOf(input.charAt(i++)); |
|
@ -867,56 +869,49 @@ var Base64 = { |
|
|
if (c < 128) { |
|
|
if (c < 128) { |
|
|
string += String.fromCharCode(c); |
|
|
string += String.fromCharCode(c); |
|
|
i++; |
|
|
i++; |
|
|
} |
|
|
} else if((c > 191) && (c < 224)) { |
|
|
else if((c > 191) && (c < 224)) { |
|
|
|
|
|
c2 = utftext.charCodeAt(i+1); |
|
|
c2 = utftext.charCodeAt(i+1); |
|
|
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); |
|
|
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); |
|
|
i += 2; |
|
|
i += 2; |
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
c2 = utftext.charCodeAt(i+1); |
|
|
c2 = utftext.charCodeAt(i+1); |
|
|
c3 = utftext.charCodeAt(i+2); |
|
|
c3 = utftext.charCodeAt(i+2); |
|
|
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); |
|
|
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); |
|
|
i += 3; |
|
|
i += 3; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return string; |
|
|
return string; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Called when the "checkhtml" link is clicked. |
|
|
// Called when the "checkhtml" link is clicked. |
|
|
function CheckHtmlClick() |
|
|
function CheckHtmlClick() { |
|
|
{ |
|
|
|
|
|
var i, TableCell, UserEntry, sData, solution; |
|
|
var i, TableCell, UserEntry, sData, solution; |
|
|
|
|
|
|
|
|
sData = ""; |
|
|
sData = ""; |
|
|
for (i = 0; i < Words; i++) |
|
|
for (i = 0; i < Words; i++) { |
|
|
{ |
|
|
|
|
|
solution = Base64.decode( HtmlSolutions[ i]); |
|
|
solution = Base64.decode( HtmlSolutions[ i]); |
|
|
// Get the user's entry for this word. |
|
|
// Get the user's entry for this word. |
|
|
UserEntry = ""; |
|
|
UserEntry = ""; |
|
|
for (j = 0; j < WordLength[i]; j++) |
|
|
for (j = 0; j < WordLength[i]; j++) { |
|
|
{ |
|
|
if (i <= LastHorizontalWord) { |
|
|
if (i <= LastHorizontalWord) |
|
|
|
|
|
TableCell = CellAt(WordX[i] + j, WordY[i]); |
|
|
TableCell = CellAt(WordX[i] + j, WordY[i]); |
|
|
else |
|
|
} else { |
|
|
TableCell = CellAt(WordX[i], WordY[i] + j); |
|
|
TableCell = CellAt(WordX[i], WordY[i] + j); |
|
|
if (TableCell.innerHTML.length > 0 && TableCell.innerHTML.toLowerCase() != " ") |
|
|
} |
|
|
|
|
|
if (TableCell.innerHTML.length > 0 && TableCell.innerHTML.toLowerCase() != " ") { |
|
|
UserEntry += TableCell.innerHTML.toUpperCase(); |
|
|
UserEntry += TableCell.innerHTML.toUpperCase(); |
|
|
else if( TableCell.innerHTML.toLowerCase() == " ") |
|
|
} else if( TableCell.innerHTML.toLowerCase() == " ") { |
|
|
UserEntry += " "; |
|
|
UserEntry += " "; |
|
|
else |
|
|
} else { |
|
|
UserEntry += "_"; |
|
|
UserEntry += "_"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if( UserEntry[ j] != solution[ j]) |
|
|
if( UserEntry[ j] != solution[ j]) { |
|
|
{ |
|
|
|
|
|
TableCell.innerHTML = " "; |
|
|
TableCell.innerHTML = " "; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
<?php |
|
|
<?php |
|
@ -1027,8 +1022,7 @@ function CheckHtmlClick() |
|
|
if ($attempt->timefinish == 0 and $endofgame == 0) { |
|
|
if ($attempt->timefinish == 0 and $endofgame == 0) { |
|
|
?> |
|
|
?> |
|
|
<script language="JavaScript" type="text/javascript"><!-- |
|
|
<script language="JavaScript" type="text/javascript"><!-- |
|
|
if (Initialized) |
|
|
if (Initialized) { |
|
|
{ |
|
|
|
|
|
<?php |
|
|
<?php |
|
|
if ($print == false) { |
|
|
if ($print == false) { |
|
|
echo "document.getElementById(\"welcomemessage\").style.display = \"\";"; |
|
|
echo "document.getElementById(\"welcomemessage\").style.display = \"\";"; |
|
|