Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 4f8fc93c authored by Mathieu Loiseau's avatar Mathieu Loiseau
Browse files

ménage

parent ff4016fd
......@@ -128,24 +128,15 @@ CREATE TABLE IF NOT EXISTS `notif` (
CREATE TABLE IF NOT EXISTS `parties` (
`partieID` int(11) NOT NULL AUTO_INCREMENT,
`enregistrementID` int(11) NOT NULL,
`tpsDevin` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`idDevin` int(11) NOT NULL,
`reussie` enum('en cours','non','oui') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'en cours',
`tpsDevin` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'heure de début de la partie',
`duree_Partie` tinyint(4) DEFAULT NULL COMMENT 'Au bout de combien de temps le joueur a trouvé (ou abandonné)',
`reussite` enum('en cours','non','oui') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'en cours',
`mise` tinyint(3) UNSIGNED NOT NULL COMMENT 'la mise de la partie (pas de miseV/miseD)',
PRIMARY KEY (`partieID`),
UNIQUE KEY `un_enr_par_joueur` (`idDevin`,`enregistrementID`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Structure de la table `sanctionCarte`
--
CREATE TABLE IF NOT EXISTS `sanctionCarte` (
`idDevin` int(11) NOT NULL,
`enregistrementID` int(11) NOT NULL,
UNIQUE KEY `idDevin` (`idDevin`,`enregistrementID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
......@@ -153,7 +144,7 @@ CREATE TABLE IF NOT EXISTS `sanctionCarte` (
-- Structure de la table `stats`
--
CREATE TABLE `stats` (
CREATE TABLE IF NOT EXISTS `stats` (
`userid` int(11) NOT NULL,
`langue` varchar(20) NOT NULL,
`nbJeux_oracle` smallint(5) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Nombre de parties',
......@@ -169,9 +160,10 @@ CREATE TABLE `stats` (
`score_druide` mediumint(9) NOT NULL DEFAULT '0' COMMENT 'score (peut être calculé uniquement avec les données de la table)',
`nbEnregistrements_devin` smallint(5) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'nombre d''enregistrements écoutés',
`nbMotsTrouves_devin` smallint(5) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'nombres de mots associés aux enregistrements trouvés',
`sommeMises_devin` mediumint(8) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'La somme des mises des parties jouées en tant que devin',
`score_devin` mediumint(9) NOT NULL DEFAULT '0' COMMENT 'score de devin (pas calculable avec les données de la table)',
PRIMARY KEY (`userid`,`langue`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Statistiques des joueurs';
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Statistiques et scores des joueurs';
-- --------------------------------------------------------
......
......@@ -132,6 +132,7 @@ class diviner_game
private function selectpartie(){
$res = false;
try{
/**/include_once("debug.php");
$recordingFactory = new ItemFactory($this->diviner,$this->user->langGame);
$this->raisin = $recordingFactory->get_recording(ItemFactory::VALID_RECORDING_NOT_ME);
if(is_object($this->raisin)){
......@@ -160,7 +161,7 @@ class diviner_game
$res=true;
}
else{
throw new Exception("Pas pu récupérer le nom de l'auteur '$this->raisin->idOracle'");
throw new Exception("Pas pu récupérer le nom de l'auteur '".print_r($this->raisin,true)."'");
}
}
else{
......
......@@ -13,6 +13,7 @@ class TracesHandler{
private $oracle = false;
private $druid = false;
private $augur = false;
private $queries;
private $recording;
private $user;
private $lang_iso;
......@@ -33,6 +34,15 @@ class TracesHandler{
$this->notif = new Notification(false);
require_once('./languages/language.fn.php');
$this->messages = get_messages($this->user->get_lang(), $this->db);
$this->reinit_queries();
}
public function reinit_queries(){
$this->queries = array();
}
public function add_query($query){
array_push($this->queries, $query);
}
public function oracle_see_card($card, $gameLevel){
......@@ -43,28 +53,28 @@ class TracesHandler{
throw new Exception("$lang ne semble pas être une langue…");
}
//once a card is seen it is stored in db for score and next play
$queries = array();
$this->reinit_queries();
$stakes = array("V" => $this->sv->get_stake($gameLevel, $card->get_level(), $user_level, true),
"D" => $this->sv->get_stake($gameLevel, $card->get_level(), $user_level, false));
//create recording
array_push($queries, "INSERT INTO `enregistrement` (`idOracle`, `OracleLang`, `carteID`, `nivcarte`, `nivpartie`, `validation`, `miseD`, `miseV`)
$this->add_query("INSERT INTO `enregistrement` (`idOracle`, `OracleLang`, `carteID`, `nivcarte`, `nivpartie`, `validation`, `miseD`, `miseV`)
VALUES ('".$this->user->id."','".
$lang."', '".
$card->get_id()."', '".
$card->get_level()."', '".
$gameLevel."','given up', '".$stakes['D']."', '".$stakes['V']."');");
//score
array_push($queries, "SET @recording_id = LAST_INSERT_ID();");
array_push($queries, "UPDATE `stats` SET `score_oracle`=`score_oracle`+(SELECT ".$this->sv->get_recording_score_sql_formula()." FROM `enregistrement` WHERE `enregistrementID`=@recording_id), `nbAbandons_oracle`=`nbAbandons_oracle`+1, `nbJeux_oracle`=`nbJeux_oracle`+1 WHERE `userid`='".$this->user->id."' AND `langue`='$lang';");
$this->add_query("SET @recording_id = LAST_INSERT_ID();");
$this->add_query("UPDATE `stats` SET `score_oracle`=`score_oracle`+(SELECT ".$this->sv->get_recording_score_sql_formula()." FROM `enregistrement` WHERE `enregistrementID`=@recording_id), `nbAbandons_oracle`=`nbAbandons_oracle`+1, `nbJeux_oracle`=`nbJeux_oracle`+1 WHERE `userid`='".$this->user->id."' AND `langue`='$lang';");
//notification
array_push($queries, $this->notif->addNotifGAME(
$this->add_query($this->notif->addNotifGAME(
$this->user->id,$this->messages['Oracle_started'].$stakes["V"]." pts.",
$this->messages['img_oracle'],
$this->messages['notif']['Oracle_started']
));
if(!$this->db->transaction($queries)){
if(!$this->db->transaction($this->queries)){
$res = false;
throw new Exception("“".print_r($queries,true)."” could not be performed.\n".$this->db->get_error());
throw new Exception("“".print_r($this->queries,true)."” could not be performed.\n".$this->db->get_error());
}
else{
$res = true;
......@@ -73,27 +83,27 @@ class TracesHandler{
}
public function post_record($cardId, $rec_path, $rec_length){
$queries = array();
$this->reinit_queries();
//update recording
//prepare score
array_push($queries, "SELECT @previous_recording_score := ".$this->sv->get_recording_score_sql_formula().", @recording_id := `enregistrementID`, @lang := `OracleLang` FROM `enregistrement` WHERE `enregistrement`.`idOracle` = ".$this->user->id." AND `enregistrement`.`carteID`='$cardId';");
$this->add_query("SELECT @previous_recording_score := ".$this->sv->get_recording_score_sql_formula().", @recording_id := `enregistrementID`, @lang := `OracleLang` FROM `enregistrement` WHERE `enregistrement`.`idOracle` = ".$this->user->id." AND `enregistrement`.`carteID`='$cardId';");
//actual recording update
array_push($queries, "UPDATE `enregistrement` SET `cheminEnregistrement` = '$rec_path', `duration`='$rec_length', `tpsEnregistrement`=CURRENT_TIMESTAMP, `validation` = 'limbo' WHERE `enregistrementID`=@recording_id;");
$this->add_query("UPDATE `enregistrement` SET `cheminEnregistrement` = '$rec_path', `duration`='$rec_length', `tpsEnregistrement`=CURRENT_TIMESTAMP, `validation` = 'limbo' WHERE `enregistrementID`=@recording_id;");
//score update
array_push($queries, "UPDATE `stats` SET `score_oracle`=`score_oracle`+(SELECT ".$this->sv->get_recording_score_sql_formula()." FROM `enregistrement` WHERE `enregistrementID`=@recording_id)-(@previous_recording_score), `nbAbandons_oracle`=`nbAbandons_oracle`-1, `nbEnregistrements_oracle`=`nbEnregistrements_oracle`+1 WHERE `userid`='".$this->user->id."' AND `langue`=@lang;");
$this->add_query("UPDATE `stats` SET `score_oracle`=`score_oracle`+(SELECT ".$this->sv->get_recording_score_sql_formula()." FROM `enregistrement` WHERE `enregistrementID`=@recording_id)-(@previous_recording_score), `nbAbandons_oracle`=`nbAbandons_oracle`-1, `nbEnregistrements_oracle`=`nbEnregistrements_oracle`+1 WHERE `userid`='".$this->user->id."' AND `langue`=@lang;");
//notifications
array_push($queries, $this->notif->cancelLastNotifOfType(
$this->add_query($this->notif->cancelLastNotifOfType(
$this->user->id,
$this->messages['notif']['Oracle_started']));
array_push($queries, $this->notif->addNotifGAME(
$this->add_query($this->notif->addNotifGAME(
$this->user->id,
$this->messages['Oracle_posted'],
$this->messages['img_oracle'],
$this->messages['notif']['Oracle_posted']
));
if(!$this->db->transaction($queries)){
if(!$this->db->transaction($this->queries)){
$res = false;
throw new Exception("“".print_r($queries,true)."” could not be performed.\n".$this->db->get_error());
throw new Exception("“".print_r($this->queries,true)."” could not be performed.\n".$this->db->get_error());
}
else{
$res = true;
......@@ -102,27 +112,27 @@ class TracesHandler{
}
public function abort_record($recording_path){
$queries = array();
$this->reinit_queries();
//update recording
//prepare score
array_push($queries, "SELECT @previous_recording_score := ".$this->sv->get_recording_score_sql_formula().", @recording_id := `enregistrementID`, @lang := `OracleLang` FROM `enregistrement` WHERE `enregistrement`.`cheminEnregistrement` = '$recording_path';");
$this->add_query("SELECT @previous_recording_score := ".$this->sv->get_recording_score_sql_formula().", @recording_id := `enregistrementID`, @lang := `OracleLang` FROM `enregistrement` WHERE `enregistrement`.`cheminEnregistrement` = '$recording_path';");
//actual recording update
array_push($queries, "UPDATE `enregistrement` SET `validation` = 'given up', `tpsEnregistrement`=CURRENT_TIMESTAMP WHERE `enregistrement`.`cheminEnregistrement` = '$recording_path'; ");
$this->add_query("UPDATE `enregistrement` SET `validation` = 'given up', `tpsEnregistrement`=CURRENT_TIMESTAMP WHERE `enregistrement`.`cheminEnregistrement` = '$recording_path'; ");
//score update
array_push($queries, "UPDATE `stats` SET `score_oracle`=`score_oracle`+(SELECT ".$this->sv->get_recording_score_sql_formula()." FROM `enregistrement` WHERE `enregistrementID`=@recording_id)-(@previous_recording_score), `nbAbandons_oracle`=`nbAbandons_oracle`+1, `nbEnregistrements_oracle`=`nbEnregistrements_oracle`-1 WHERE `userid`='".$this->user->id."' AND `langue`=@lang;");
$this->add_query("UPDATE `stats` SET `score_oracle`=`score_oracle`+(SELECT ".$this->sv->get_recording_score_sql_formula()." FROM `enregistrement` WHERE `enregistrementID`=@recording_id)-(@previous_recording_score), `nbAbandons_oracle`=`nbAbandons_oracle`+1, `nbEnregistrements_oracle`=`nbEnregistrements_oracle`-1 WHERE `userid`='".$this->user->id."' AND `langue`=@lang;");
//notifications
array_push($queries, $this->notif->cancelLastNotifOfType(
$this->add_query($this->notif->cancelLastNotifOfType(
$this->user->id,
$this->messages['notif']['Oracle_posted']));
array_push($queries, $this->notif->addNotifGAME(
$this->add_query($this->notif->addNotifGAME(
$this->user->id,
$this->messages['Oracle_abort'],
$this->messages['img_oracle'],
$this->messages['notif']['Oracle_abort']
));
if(!$this->db->transaction($queries)){
if(!$this->db->transaction($this->queries)){
$res = false;
throw new Exception("“".print_r($queries,true)."” could not be performed.\n".$this->db->get_error());
throw new Exception("“".print_r($this->queries,true)."” could not be performed.\n".$this->db->get_error());
}
else{
$res = true;
......@@ -131,25 +141,25 @@ class TracesHandler{
}
public function druid_validate($recordingID, $validate=true, $revoke=false){
$queries = array();
$this->reinit_queries();
//insert new arbitrage
array_push($queries, "INSERT INTO `arbitrage` (`enregistrementID`, `idDruide` , `validation`) VALUES(
$this->add_query("INSERT INTO `arbitrage` (`enregistrementID`, `idDruide` , `validation`) VALUES(
'$recordingID',
'".$this->user->id."',
'".$this->sv->get_druid_string($validate)."');");
if($revoke){
array_push($queries, "SET @arbitrage_id = LAST_INSERT_ID();");
$this->add_query("SET @arbitrage_id = LAST_INSERT_ID();");
}
//update recording
//previous score and variables
array_push($queries, "SELECT @previous_recording_score := ".$this->sv->get_recording_score_sql_formula().", @lang:=`OracleLang`, @oracle_id:= `idOracle` FROM `enregistrement` WHERE `enregistrementID`='$recordingID';");
$this->add_query("SELECT @previous_recording_score := ".$this->sv->get_recording_score_sql_formula().", @lang:=`OracleLang`, @oracle_id:= `idOracle` FROM `enregistrement` WHERE `enregistrementID`='$recordingID';");
//new recording validation
array_push($queries, "UPDATE `enregistrement` SET `validation` = '".
$this->add_query("UPDATE `enregistrement` SET `validation` = '".
$this->sv->get_druid_string($validate)."' WHERE `enregistrementID`='$recordingID';");
//update oracle score
//the score itself
array_push($queries, "SELECT @recording_score_diff := ".$this->sv->get_recording_score_sql_formula()."-(@previous_recording_score) FROM `enregistrement` WHERE `enregistrementID`='$recordingID';");
$this->add_query("SELECT @recording_score_diff := ".$this->sv->get_recording_score_sql_formula()."-(@previous_recording_score) FROM `enregistrement` WHERE `enregistrementID`='$recordingID';");
$nb_err = "";
if($revoke){
if($validate){
......@@ -162,19 +172,19 @@ class TracesHandler{
elseif (!$validate) {
$nb_err = ", `nbErreurs_oracle` = `nbErreurs_oracle` + 1";
}
array_push($queries, "UPDATE `stats` SET `score_oracle`=`score_oracle`+@recording_score_diff$nb_err WHERE `userid`=@oracle_id AND `langue`=@lang;");
$this->add_query("UPDATE `stats` SET `score_oracle`=`score_oracle`+@recording_score_diff$nb_err WHERE `userid`=@oracle_id AND `langue`=@lang;");
//update druid score
array_push($queries, "UPDATE `stats` SET `nbArbitrages_druide` = `nbArbitrages_druide`+1, `score_druide` = `score_druide`+".$this->sv->get_druid_verification_score()." WHERE `stats`.`userid` = '".$this->user->id."' AND `stats`.`langue` = @lang;");
$this->add_query("UPDATE `stats` SET `nbArbitrages_druide` = `nbArbitrages_druide`+1, `score_druide` = `score_druide`+".$this->sv->get_druid_verification_score()." WHERE `stats`.`userid` = '".$this->user->id."' AND `stats`.`langue` = @lang;");
//update former druids score
if($revoke){
array_push($queries, "UPDATE `stats` SET `nbErrArbitrage_druide` = `nbErrArbitrage_druide`+1, `score_druide` = IF(`score_druide`-".$this->sv->get_druid_verification_error_score()." WHERE `stats`.`langue` = @lang AND `stats`.`userid` IN (SELECT `idDruide` FROM `arbitrage` WHERE `enregistrementID`='$recordingID' AND `arbitrageID` < @arbitrage_id AND 'validation'!='".
$this->add_query("UPDATE `stats` SET `nbErrArbitrage_druide` = `nbErrArbitrage_druide`+1, `score_druide` = IF(`score_druide`-".$this->sv->get_druid_verification_error_score()." WHERE `stats`.`langue` = @lang AND `stats`.`userid` IN (SELECT `idDruide` FROM `arbitrage` WHERE `enregistrementID`='$recordingID' AND `arbitrageID` < @arbitrage_id AND 'validation'!='".
$this->sv->get_druid_string($validate).");");
array_push($queries, "UPDATE `stats` SET `nbErrArbitrage_druide` = `nbErrArbitrage_druide`+1, `score_druide` = IF(`score_druide`+".$this->sv->get_druid_verification_error_score()." WHERE `stats`.`langue` = @lang AND `stats`.`userid` IN (SELECT `idDruide` FROM `arbitrage` WHERE `enregistrementID`='$recordingID' AND `arbitrageID` < @arbitrage_id AND 'validation'='".
$this->add_query("UPDATE `stats` SET `nbErrArbitrage_druide` = `nbErrArbitrage_druide`+1, `score_druide` = IF(`score_druide`+".$this->sv->get_druid_verification_error_score()." WHERE `stats`.`langue` = @lang AND `stats`.`userid` IN (SELECT `idDruide` FROM `arbitrage` WHERE `enregistrementID`='$recordingID' AND `arbitrageID` < @arbitrage_id AND 'validation'='".
$this->sv->get_druid_string($validate)."');");
}
//the notifications
array_push($queries, $this->notif->addNotif(
$this->add_query($this->notif->addNotif(
"@oracle_id",
"CONCAT('".$this->user->username.$this->messages['Oracle_verif'][$validate]."',
' (', @recording_score_diff,' pts)')",
......@@ -182,23 +192,40 @@ class TracesHandler{
$this->messages['notif']['Oracle_verif'][$validate],
false
));
array_push($queries, $this->notif->addNotif(
$this->add_query($this->notif->addNotif(
$this->user->id,
"'".$this->messages['Rec_verified']."'",
"@oracle_id",
$this->messages['notif']['Rec_verified'],
false
));
//TODO, il faudrait des notifications de réhabilitation / révocation, mais je vais pas m'en sortir si je les fais maintenant
//TODO, il faudrait des notifications de réhabilitation / révocation, mais de toute façon il y a pas vraiment la fonctionnalité
/**/require_once("debug.php");
/**/myLog("<h2>Druid action</h2><pre>".print_r($queries, true)."</pre>");
if(!$this->db->transaction($queries)){
/**/myLog("<h2>Druid action</h2><pre>".print_r($this->queries, true)."</pre>");
if(!$this->db->transaction($this->queries)){
$res = false;
throw new Exception("“".print_r($queries,true)."” could not be performed.\n".$this->db->get_error());
throw new Exception("“".print_r($this->queries,true)."” could not be performed.\n".$this->db->get_error());
}
else{
$res = true;
}
return $res;
}
//so that if the augur reloads to give up without loss there's a penalty
//and not for oracle
public function augur_start_play(){
}
//don't find (end timer, either by giving up or not)
//augur & oracle
public function augur_loss(){
}
//augur (and oracle) win
public function augur_win(){
}
}?>
......@@ -42,7 +42,7 @@ class ScoreValues{
"IF(`validation`='given up',
-ROUND(`miseD`/3),
IF(`validation`='invalid',
-ROUND(1.2*`miseD`),
-ROUND(4*`miseD`/3),
IF(`validation`='valid',
ROUND(`miseV`*(0.5+(`nbSucces`*1.2)/GREATEST(1,`nbTentatives`))),
0
......
......@@ -11,7 +11,7 @@ include('./views/page.header.html');
function renders(minutes, seconds){
if(seconds == Math.floor(seconds)){
if (seconds < 10){
seconds = "0" + seconds;
seconds = "0" + seconds;
}
$('#countdown').html(minutes + ":" + seconds);
}
......@@ -39,7 +39,7 @@ function give_up(){
<div id="jrForm">
<div class="form-jr">
<?php
<?php
//Si l'utilisateur a quitté la partie précédente
if ( $this->lang ) {
foreach ($this->lang as $mess){
......@@ -48,7 +48,7 @@ function give_up(){
<div id="facebox">
<div class="content">
<div style="padding:5px;">
<h2><?php echo $lang['Becareful']; ?></h2><br/><h3><?php echo $lang[$mess]; ?></h3>
<h2><?php echo $lang['Becareful']; ?></h2><br/><h3><?php echo $lang[$mess]; ?></h3>
<button class="close" style="cursor: pointer; background:#000; color:white; text-align:center; font-weight:bold; position:absolute; bottom:20%; left:50%; padding:0 2px; width:200px; height:30px; line-height:20px">OK</button>
<div class="resume">&nbsp;</div>
</div>
......@@ -57,12 +57,12 @@ function give_up(){
<!-- Fin Popup -->
<?php
}
?>
?>
<script>popUp();</script>
<?php
}
// S'il y a des erreurs dans la class diviner.class.php
if ( $this->errors ) {
}
// S'il y a des erreurs dans la class diviner.class.php
if ( $this->errors ) {
?>
<fieldset class="errors">
<legend>Erreurs</legend>
......@@ -72,12 +72,12 @@ function give_up(){
<?php
echo $lang[$error]; ?>
</li>
</ul>
</fieldset>
<?php }
</fieldset>
<?php }
}
else {
else {
?>
<script>monChrono.start();</script>
<fieldset>
......@@ -86,11 +86,11 @@ function give_up(){
<dl>
<dt><label for="carteID"><?php echo $lang['id_card'];?></label> <?php echo $this->raisin->carteID.'</br>'; ?></dt>
<dt><label for="createur"><?php echo $lang['card_creator'];?></label> <?php echo $this->res4['username'].'</br>'; ?></dt>
<dt><label for="oracle"><?php echo $lang['card_oracle'];?></label> <?php echo $this->res2['username'].'</br>'; ?></dt>
<dt><label for="oracle"><?php echo $lang['card_oracle'];?></label> <?php echo $this->res2['username'].'</br>'; ?></dt>
</dl>
<h3><?php echo $lang['which_word'];?> </h3>
<div class="inner" style="height: 5em;">
<audio id="audio" autoplay controls></audio>
<audio id="audio" autoplay controls></audio>
<button class="btn btn-primary" type="button" id="start-audio"><?php echo $lang['start_playback'] ?></button>
<button class="btn btn-primary" type="button" id="give-up"><?php echo $lang['give_up'] ?></button>
</div>
......@@ -103,8 +103,9 @@ function give_up(){
<div id="form-cmd">
<!-- <input class="btn btn-lg btn-primary btn-block" type="submit" id="submit_form" name="submit_form" value="<?php// echo $lang['validate']; ?>" class="submit_buttons" /> -->
<input class="btn btn-lg btn-primary btn-block" type="button" id="valide" onclick="validate()" value="<?php echo $lang['validate']; ?>" />
<input type="hidden" name="mode" value="<?php echo $this->mode; ?>"/>
<input type="hidden" name="mode" value="<?php echo $this->mode; ?>"/>
<input type="hidden" id='motadeviner' value="<?php echo $this->card->get_word(); ?>"/>
<input type="hidden" id='idPartie' value="<?php echo $this->card->get_word(); ?>"/><!--TODO-->
</div>
</fieldset>
<?php } ?>
......@@ -114,21 +115,21 @@ function give_up(){
</div>
<script type="text/javascript">
// Résultats
// Résultats
// Si le devin donne la bonne réponse
function validate() {
var motadeviner=document.getElementById('motadeviner').value;
var motentre=document.getElementById('mot').value;
//fonction qui rend insensible à la casse et enlève les espaces en trop
var motentre=(motentre.replace(/\s{2,}/g, ' ').trim().toLowerCase());
var motadeviner=(motadeviner.replace(/\s{2,}/g, ' ').trim().toLowerCase());
//if (document.getElementById('motadeviner').value == document.getElementById('mot').value ) {
if (motentre == motadeviner) {
document.location.href="index.php?mode=diviner.result";
}
// Si le devin donne une réponse fausse, on vide la zone de texte
// Si le devin donne une réponse fausse, on vide la zone de texte
else {
console.log('OK');
var inputElt = document.getElementById('mot');
......@@ -147,7 +148,7 @@ function give_up(){
}, 1000);
}
}
//test keypress
$(document).keypress(function(e) {
if(e.which == 13) {
......@@ -185,8 +186,8 @@ $(document).keypress(function(e) {
if (start) start.startPlay();
window.isAudio = true;
this.disabled = true;
};
giveup.onclick = give_up ;
</script>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment