diff --git a/getAchievements.php b/getAchievements.php
index cadcd26..659b935 100644
--- a/getAchievements.php
+++ b/getAchievements.php
@@ -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);
diff --git a/getinformations.js b/getinformations.js
index 2c53b06..b38d2a1 100644
--- a/getinformations.js
+++ b/getinformations.js
@@ -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"]);
diff --git a/index.html b/index.html
index 8c1121c..48504df 100644
--- a/index.html
+++ b/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>
\ No newline at end of file