Patch bug compte privé & modifications affichage
Modification de l’affichage avec Aucun compte chargé Modification de l’appuie de la touche entrée dans le champ d’instertion (#3)
This commit is contained in:
parent
7318a88909
commit
4540543d80
3 changed files with 17 additions and 6 deletions
|
@ -5,7 +5,7 @@ Application web pour voir la durée pour finir à 100% des jeux de son compte st
|
|||
|
||||
author: rick@gnous.eu
|
||||
git: https://git.gnous.eu/Rick/triAchievements
|
||||
version: 1.0.1
|
||||
version: 1.0.2
|
||||
*/
|
||||
|
||||
// ~ 4 minutes pour ~ 350 jeux
|
||||
|
@ -117,10 +117,11 @@ if (isset($_POST['steamid'])) {
|
|||
$steamid = $_POST['steamid'];
|
||||
$url = "http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=".API_KEY."&steamid=".$steamid;
|
||||
$listGames = file_get_contents($url);
|
||||
$responseListGames = json_decode($listGames, true)["response"];
|
||||
if ($listGames == NULL) {
|
||||
$ret = array('error' => 'User not found.', 'response' => $http_response_header);
|
||||
} elseif (empty($listGames["response"])) {
|
||||
$ret = array('error' => 'Private Account.', 'response' => $http_response_header);
|
||||
} elseif (empty($responseListGames)) {
|
||||
$ret = array('error' => 'Private Account.', 'response' => $http_response_header, 'test' => $listGames);
|
||||
} else {
|
||||
$url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=".API_KEY."&steamids=".$steamid;
|
||||
$userInformations = getJson($url);
|
||||
|
|
|
@ -26,7 +26,7 @@ function makeArray(jsonData) {
|
|||
error.appendChild(text);
|
||||
bigbox.appendChild(error);
|
||||
} else {
|
||||
document.getElementById("username").innerHTML = jsonData["username"];
|
||||
document.getElementById("username").innerHTML = "Compte de " + jsonData["username"];
|
||||
jsonData["gameWithTime"].sort((a, b) => parseFloat(a.hours) - parseFloat(b.hours));
|
||||
makeHtml(jsonData["gameWithTime"]);
|
||||
makeHtml(jsonData["gameWithoutTime"]);
|
||||
|
|
14
index.html
14
index.html
|
@ -13,10 +13,10 @@
|
|||
|
||||
<form id="myform">
|
||||
<input type="text" name="steamid" id="steamid" placeholder="SteamID">
|
||||
<input type="button" value="Charger le temps" onclick="sendData();">
|
||||
<input type="button" id="button" value="Charger le temps" onclick="sendData();">
|
||||
</form>
|
||||
|
||||
<h1>Compte de <span id="username"></span></h1>
|
||||
<h1 id="username">Aucun compte chargé</h1>
|
||||
|
||||
<div id="box">
|
||||
<div id="error">
|
||||
|
@ -31,5 +31,15 @@
|
|||
|
||||
<script src="getinformations.js">
|
||||
</script>
|
||||
<script>
|
||||
var input = document.getElementById("steamid");
|
||||
|
||||
input.addEventListener("keyup", function(event) {
|
||||
if (event.keyCode === 13) {
|
||||
event.preventDefault();
|
||||
document.getElementById("button").click();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue