Merge branch 'unstable' of https://github.com/jsmaniac/2011-m1s2-ter into unstable

This commit is contained in:
Bertrand Brun 2011-04-28 15:14:01 +02:00
commit c5415d3718
3 changed files with 11 additions and 9 deletions

View File

@ -25,11 +25,11 @@ if(!isset($_SESSION['userId']))
visibility: hidden;
}
.valid .status, #center.valid .status {
color: green;
color: #20FF20;
visibility: visible;
}
.invalid .status, #center.invalid .status, #center .status {
color: red;
color: #FF2020;
visibility: visible;
}

View File

@ -756,6 +756,6 @@ function getNodeEid($node) {
function wordExist($node) {
$db = getDB();
return getNodeEid($node) === null ? true : false;
return getNodeEid($node) === null ? "0" : "1";
}
?>

View File

@ -109,7 +109,8 @@ $(function() {
url: "server.php?",
data: "action=4&word="+word+"&user="+user+"&passwd="+passwd,
success: function(msg){
input.closest(".wordLine, #center").addClass((msg == false) ? "invalid" : "valid");
console.log(msg);
input.closest(".wordLine, #center").addClass(msg == "false" ? "invalid" : "valid");
wordsOK[input.attr("id")] = !(msg == false);
}});
}
@ -185,18 +186,19 @@ $(function() {
}
$.get("server.php",{user:"foo",passwd:"bar",action:"6",game:exit},function (data) {
$(".word").closest(".wordLine, #center").removeClass("valid invalid");
if(data === true) {
alert("Partie envoyée avec succès");
} else if (data === false) {
//$(".word").closest(".wordLine, #center").removeClass("valid invalid");
if(data == "true") {
alert("Partie enregistrée avec succès");
} else if (data == "false") {
displayError("Le nuage doit contenir au moins "+nbWordMin+" mots valides.");
} else if (data !== true) {
} else if (data != "true") {
$('input').removeAttr('disabled');
var that = $(this);
$.each(data,function(i,e) {
$('.word')
.filter(function() { return that.val() == e; })
.closest(".wordLine, #center")
.removeClass("valid invalid")
.addClass("invalid");
});
}