forked from MouMou/EWP
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
116 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,63 @@ | ||
/////////////////////////////////////////////////////////// | ||
// Javascript file used for some events of the index.php // | ||
/////////////////////////////////////////////////////////// | ||
|
||
$(function() { | ||
|
||
/** | ||
* Declare the variable nickname | ||
*/ | ||
var nickname = $("#nickname"); | ||
|
||
/** | ||
* The Modal Connection opens when the page is loaded | ||
* @return {void} | ||
*/ | ||
$('#ModalConnection').modal({ | ||
backdrop: "static", | ||
keyboard: false | ||
}) | ||
|
||
/** | ||
* Validation of the user's connection | ||
* @return {void} | ||
*/ | ||
$("#loginSub").on("click", function(){ | ||
if(nickname.val() == ""){ | ||
nickname.parent('div').addClass("error"); | ||
nickname.siblings('span').removeClass('hide'); | ||
} else { | ||
$('#username').text(nickname.val()); | ||
$('#ModalConnection').modal('hide'); | ||
initialize(); | ||
} | ||
/** | ||
* if the nickname is not entered : error | ||
*/ | ||
if(nickname.val() == ""){ | ||
nickname.parent('div').addClass("error"); | ||
nickname.siblings('span').removeClass('hide'); | ||
/** | ||
* else write the nickname in the right of the navbar | ||
* and the Modal Connection closes when the user click on the "close button" | ||
*/ | ||
} else { | ||
$('#username').text(nickname.val()); | ||
$('#ModalConnection').modal('hide'); | ||
initialize(); | ||
} | ||
}); | ||
|
||
/** | ||
* The Modal About opens when the user click on the "about button" in the navbar | ||
* @return {void} | ||
*/ | ||
$("#about").on("click", function(){ | ||
$('#ModalAbout').modal({ | ||
backdrop: "static", | ||
keyboard: false | ||
}) | ||
}); | ||
|
||
/** | ||
* The Modal About closes when the user click on the "close button" | ||
* @return {void} | ||
*/ | ||
$("#close").on("click", function(){ | ||
$('#ModalAbout').modal('hide'); | ||
}); | ||
|
||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters