Deleting 'Old' Folder

This commit is contained in:
Denis 2015-01-10 15:52:09 +02:00
parent e6f82fcaa8
commit e1e2c37282
2 changed files with 0 additions and 318 deletions

View file

@ -1,208 +0,0 @@
//General
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);
}
// 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
});
// Get word
// words array located in words.js
var word;
var incercari;
var charArray1;
var charArray2;
var missArray;
function newGame(wordList) {
word = wordList[Math.floor(Math.random() * wordList.length)];
incercari = 6;
charArray1 = [];
charArray2 = [];
missArray = [];
// Create the arrays
for (var i = 0; i < word.length; i++) {
charArray1[i] = '*';
}
for (var i = 0; i < word.length; i++) {
charArray2[i] = word.charAt(i);
}
// Update page info
$('.word').html(charArray1);
$("#human").attr('src', "./img/" + incercari + ".png");
$('#incercari').html(incercari);
$('.litera_msg2').html();
}
// DOM Elements & Events
$(document).ready(function() {
//$('.footer-content').append("<p><span>Spanzuratoarea</span> <em>created by</em>" + "<span>@<a href=\"http://www.twitter.com/niutenisu\">Niutenisu</a></span><p>");
var listaCuvinte = localStorage.getItem("listaCuvinte");
if (listaCuvinte != null) {
$("select[name=lista_cuvinte]").val(listaCuvinte);
newGame(eval(listaCuvinte));
} else {
newGame(animale_eu);
}
$("select[name=lista_cuvinte]").on("change", function() {
localStorage.setItem("listaCuvinte", $(this).val());
}).next().click(function() {
// eval for transforming string into object ref!!!
newGame(eval($(this).prev().val())); // POSSIBLE EXPLOIT!!
// prev for mobile <3
/* On the page are two elements that have select[name=lista_cuvinte]
* We use next() for the button and prev() to get the value of the
* sellection. */
});
$('#game').fadeIn("slow");
});
$(document).on("keypress", function(e) {
var key = e.keyCode || e.which;
var key2 = String.fromCharCode(key).toLowerCase();
ion.sound.play("button_tiny");
$('.litera_msg').fadeIn('slow');
$('.litera').html(key2);
//already guessed, check,
if (check(key2)) {
$('.litera_msg2').html("aceasta litera se afla in cuvant.");
updateArray(key2);
$('.word').html(charArray1);
} else {
$('.litera_msg2').html("aceasta litera nu se afla in cuvant.");
incercari--;
if (incercari > -1) {
$("#human").attr('src', "./img/" + incercari + ".png");
$('#incercari').html(incercari);
updateLetters(key2);
if (incercari == 0)
gameOver();
}
}
// check if arrays are equal
if (arraysEqual(charArray1, charArray2)) {
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("Ai pierdut! CUVANT: " + word);
window.location.reload(); // for mobile phones
return; // for slower mobile phones
}
$('#incercari_msg').html("Game Over!");
$('#lose_word').html(word);
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();
});
}
function check(guess) {
return word.indexOf(guess) > -1;
}
function updateLetters(guess) {
var len = missArray.length;
if (!($.inArray(guess, missArray) > -1)) {
missArray[len] = guess;
}
$('.litere').html(missArray + " ");
}
function updateArray(guess) {
guess = guess.toLowerCase();
for (i = 0; i < charArray1.length; i++) {
if (charArray2[i] == guess) {
charArray1[i] = guess;
}
}
}
function arraysEqual(a, b) {
if (a === b) return true;
if (a == null || b == null) return false;
if (a.length != b.length) return false;
for (var i = 0; i < a.length; ++i) {
if (a[i] !== b[i]) return false;
}
return true;
}

View file

@ -1,110 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Spanzuratoarea</title>
<meta charset="utf-8">
<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">
<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="game.js"></script>
</head>
<body>
<div id="content">
<h1>Spanzuratoarea!</h1>
<div id="game" class="game" style="display: none;">
<div class="mobile">
<h3>Incearca sa ghicesti cuvantul: <span class="word"></span></h3>
<h4>Introdu aici litera:</h4>
<input name="mobile" type="text">
<h4 class="litera_msg" style="display: none;">Ai apasat pe "<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">Animale din Europa</option>
<option value="tari_eu">Tari din Europa</option>
<option value="firme">Companii</option>
<option value="ldp">Limbaje de programare</option>
</select>
<button class="">Schimba</button>
</div>
<div id="left">
<h2>Incearca sa ghicesti cuvantul: <span class="word"></span></h2>
<h3>Apasa pe o litera de pe tastatura!</h3>
<br>
<h4 class="litera_msg" style="display: none;">Ai apasat pe "<span class="litera red" style="color: red;"></span>"
<span class="litera_msg2"></span></h4>
<br>
<br>
<br>
<h4>Instructiuni:</h4>
<p>Incearca sa ghicesti cuvantul! Ai 6 incercari pana cand vei fi spanzurat</p>
<br>
<br>
<h4 class="litere red"></h4>
<br>
<br>
<h4>Cuvinte:</h4>
<select name="lista_cuvinte" class="change_words">
<option value="animale_eu">Animale din Europa</option>
<option value="tari_eu">Tari din Europa</option>
<option value="firme">Companii</option>
<option value="ldp">Limbaje de programare</option>
</select>
<button class="">Schimba</button>
</div>
<div id="gamewon">
<p>Da-i click pe imagine pentru a juca din nou!</p>
<img src="./img/win.png" alt="Winner!" title="YOU'RE WINNER!">
</div>
<div id="gameover">
<p>Da-i click pe imagine pentru a juca din nou!</p>
<p>Cuvantul era: <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">Incercari ramase: <span id="incercari">6</span></h3>
</div>
</div>
</div>
<footer>
<div class="footer-content">
<p>
<span>Spanzuratoarea</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 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>