Translated to English

This commit is contained in:
Denis 2015-01-09 20:36:44 +02:00
parent 22074a14f5
commit 8718179db1
4 changed files with 253 additions and 22 deletions

131
src/en/index.html Normal file
View file

@ -0,0 +1,131 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Hagman</title>
<meta charset="utf-8">
<meta http-equiv="author" content="Niutenisu">
<meta name="description" content="Hangman!">
<meta name="keywords" content="hangman, game, free, online">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" type="text/css" href="../styles/normalize.css">
<link rel="stylesheet" type="text/css" href="../styles/styles.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="../sound/ion.sound.min.js"></script>
<script src="../js/words.js"></script>
<script src="../js/hangman.js"></script>
<script src="../js/main_en.js"></script>
</head>
<body>
<div id="content">
<h1>Hangman!</h1>
<div id="game" class="game" style="display: none;">
<div class="mobile">
<h3>Try to guess the word: <span class="word"></span></h3>
<h4>Type the letter here:</h4>
<input name="mobile" type="text">
<h4 class="litera_msg" style="display: none;">You pressed "<span class="litera" style="color: red;"></span>
<span class="litera_msg2"></span></h4>
<h4 class="litere" style="color: red;"></h4>
<select name="lista_cuvinte" class="change_words">
<option value="animale_eu">Animals from EU</option>
<option value="tari_eu">Country from EU</option>
<option value="firme">Companies</option>
<option value="ldp">Programming Languages</option>
</select>
<button class="">Switch</button>
</div>
<div id="left">
<h2>Try to guess the word: <span class="word"></span></h2>
<h3>Type a key, any key!</h3>
<br>
<h4 class="litera_msg" style="display: none;">You typed "<span class="litera red" style="color: red;"></span>"
<span class="litera_msg2"></span></h4>
<br>
<br>
<br>
<h4>Instructions:</h4>
<p>Try to guess the word, you have 6 tries before you lose.</p>
<br>
<br>
<h4 class="litere red"></h4>
<br>
<br>
<h4>Cuvinte:</h4>
<select name="lista_cuvinte" class="change_words">
<option value="animale_eu">Animals from EU</option>
<option value="tari_eu">Country from EU</option>
<option value="firme">Companies</option>
<option value="ldp">Programming Languages</option>
</select>
<button class="">Switch</button>
</div>
<div id="gamewon">
<p>Click the image to play again!</p>
<img src="../img/win.png" alt="Winner!" title="YOU'RE WINNER!">
</div>
<div id="gameover">
<p>Click the image to play again!</p>
<p>The word was: <span class="red" id="lose_word"></span>
</p>
<img src="../img/lose.png" alt="Loser!" title="YOU'RE LOSER!">
</div>
<div id="right">
<img id="hang" src="../img/hang.png">
<img id="human" src="../img/6.png">
<br>
<h3 id="incercari_msg">Life: <span id="incercari">6</span></h3>
</div>
</div>
</div>
<footer>
<div class="footer-content">
<p>
<span>Hangman</span>
<em>created by</em>
<span> @<a href="http://www.twitter.com/niutenisu">Niutenisu</a></span>
</p>
<p class="right">
<span><a href="https://github.com/niutenisu/ro-hangman/" alt="Github" title="Github Project Link">Github</a><span>
</p>
</div>
</footer>
<script>
// Sound initialization
ion.sound({
sounds: [{
name: "button_tiny",
volume: 0.8,
preload: true
}, {
name: "ta_da",
volume: 0.8,
preload: true
}, {
name: "sad_trombone",
volume: 0.8,
preload: true
}],
volume: 0.5,
path: "../sound/sounds/",
preload: true
});
</script>
<!--
<script type="text/javascript">
if (window.jQuery) {
// jQuery is loaded
alert("jQuery is loaded");
} else {
// jQuery is not loaded
alert("jQuery is not loaded");
</script>
}-->
</body>
</html>

View file

@ -7,7 +7,7 @@
<meta http-equiv="author" content="Niutenisu">
<meta name="description" content="Spanzuratoarea in limba romana!">
<meta name="keywords" content="spanzuratoarea, joc, gratuit, romana">
<meta name="viewport" content="width=device-width, initial-scale=0.9">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" type="text/css" href="styles/normalize.css">
<link rel="stylesheet" type="text/css" href="styles/styles.css">
@ -94,7 +94,27 @@
</p>
</div>
</footer>
<script>
// Sound initialization
ion.sound({
sounds: [{
name: "button_tiny",
volume: 0.8,
preload: true
}, {
name: "ta_da",
volume: 0.8,
preload: true
}, {
name: "sad_trombone",
volume: 0.8,
preload: true
}],
volume: 0.5,
path: "sound/sounds/",
preload: true
});
</script>
<!--
<script type="text/javascript">
if (window.jQuery) {

View file

@ -4,30 +4,11 @@
var MOBILE_WIDH = 930;
var WINDOW_W = $(window).width();
var mobileSiteUrl = "/m"; // relative path
var soundsFolder = "sound/sounds/";
//Redirect to MobileSite
if (WINDOW_W <= MOBILE_WIDH) {
window.location.replace(mobileSiteUrl);
}
// Sound initialization
ion.sound({
sounds: [{
name: "button_tiny",
volume: 0.8,
preload: true
}, {
name: "ta_da",
volume: 0.8,
preload: true
}, {
name: "sad_trombone",
volume: 0.8,
preload: true
}],
volume: 0.5,
path: soundsFolder,
preload: true
});
$(document).ready(function() {
var listaCuvinte = localStorage.getItem("listaCuvinte");
if (listaCuvinte != null) {

99
src/js/main_en.js Normal file
View file

@ -0,0 +1,99 @@
(function() {
//General
var h = new Hangman();
var MOBILE_WIDH = 930;
var WINDOW_W = $(window).width();
var mobileSiteUrl = "../m"; // relative path
//Redirect to MobileSite
if (WINDOW_W <= MOBILE_WIDH) {
window.location.replace(mobileSiteUrl);
}
$(document).ready(function() {
var listaCuvinte = localStorage.getItem("listaCuvinte");
if (listaCuvinte != null) {
$("select[name=lista_cuvinte]").val(listaCuvinte);
h.newGame(eval(listaCuvinte));
} else {
h.newGame(animale_eu);
}
// Update page info
$('.word').html(h.getWordArray());
$("#human").attr('src', "../img/" + h.getLife() + ".png");
$('#incercari').html(h.getLife());
$('.litera_msg2').html();
$("select[name=lista_cuvinte]").on("change", function() {
localStorage.setItem("listaCuvinte", $(this).val());
}).next().click(function() {
window.location.reload();
});
$('#game').fadeIn("slow");
});
$(document).on("keypress", function(e) {
var k = e.keyCode || e.which;
var key = String.fromCharCode(k).toLowerCase();
ion.sound.play("button_tiny");
$('.litera_msg').fadeIn('slow');
$('.litera').html(key);
if (h.check(key)) {
$('.litera_msg2').html("this letter is in the word.");
h.guessed(key);
$('.word').html(h.getWordArray());
} else {
$('.litera_msg2').html("this letter is not in the word.");
h.missed(key);
if (h.getLife() > -1) {
$("#human").attr('src', "../img/" + h.getLife() + ".png");
$('#incercari').html(h.getLife());
$('.litere').html(h.getMissedLetters() + "");
if (h.getLife() == 0)
gameOver();
}
}
if (h.gameIsFinished()) {
gameWon();
}
});
function gameWon() {
if (WINDOW_W <= MOBILE_WIDH) {
ion.sound.play("ta_da");
alert("Felicita e tenersi per mano")
window.location.reload(); // mobile
return;
}
//alert("You're winner!");
if (WINDOW_W > MOBILE_WIDH) $('#gamewon').fadeIn('slow');
$(document).off(); // Detach keypress handler
ion.sound.play("ta_da"); // Play victory sound
$('#gamewon img').click(function() {
window.location.reload();
});
$(document).on("keypress", function(e) {
var key = e.keyCode || e.which;
if (key == 13) window.location.reload(); // Reset handlers :-)
});
}
function gameOver() {
if (WINDOW_W <= MOBILE_WIDH) {
ion.sound.play("sad_trombone");
alert("You lost! Word: " + h.getWord());
window.location.reload(); // for mobile phones
return; // for slower mobile phones
}
$('#incercari_msg').html("Game Over!");
$('#lose_word').html(h.getWord());
if (WINDOW_W > MOBILE_WIDH) $('#gameover').fadeIn('slow');
$(document).off(); // Detach keypress handler
ion.sound.play("sad_trombone");
$('#gameover img').click(function() {
window.location.reload();
});
$(document).on("keypress", function(e) {
var key = e.keyCode || e.which;
if (key == 13) window.location.reload();
});
}
})();