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
|
author: rick@gnous.eu
|
||||||
git: https://git.gnous.eu/Rick/triAchievements
|
git: https://git.gnous.eu/Rick/triAchievements
|
||||||
version: 1.0.1
|
version: 1.0.2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ~ 4 minutes pour ~ 350 jeux
|
// ~ 4 minutes pour ~ 350 jeux
|
||||||
|
@ -117,10 +117,11 @@ if (isset($_POST['steamid'])) {
|
||||||
$steamid = $_POST['steamid'];
|
$steamid = $_POST['steamid'];
|
||||||
$url = "http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=".API_KEY."&steamid=".$steamid;
|
$url = "http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=".API_KEY."&steamid=".$steamid;
|
||||||
$listGames = file_get_contents($url);
|
$listGames = file_get_contents($url);
|
||||||
|
$responseListGames = json_decode($listGames, true)["response"];
|
||||||
if ($listGames == NULL) {
|
if ($listGames == NULL) {
|
||||||
$ret = array('error' => 'User not found.', 'response' => $http_response_header);
|
$ret = array('error' => 'User not found.', 'response' => $http_response_header);
|
||||||
} elseif (empty($listGames["response"])) {
|
} elseif (empty($responseListGames)) {
|
||||||
$ret = array('error' => 'Private Account.', 'response' => $http_response_header);
|
$ret = array('error' => 'Private Account.', 'response' => $http_response_header, 'test' => $listGames);
|
||||||
} else {
|
} else {
|
||||||
$url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=".API_KEY."&steamids=".$steamid;
|
$url = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=".API_KEY."&steamids=".$steamid;
|
||||||
$userInformations = getJson($url);
|
$userInformations = getJson($url);
|
||||||
|
|
|
@ -26,7 +26,7 @@ function makeArray(jsonData) {
|
||||||
error.appendChild(text);
|
error.appendChild(text);
|
||||||
bigbox.appendChild(error);
|
bigbox.appendChild(error);
|
||||||
} else {
|
} 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));
|
jsonData["gameWithTime"].sort((a, b) => parseFloat(a.hours) - parseFloat(b.hours));
|
||||||
makeHtml(jsonData["gameWithTime"]);
|
makeHtml(jsonData["gameWithTime"]);
|
||||||
makeHtml(jsonData["gameWithoutTime"]);
|
makeHtml(jsonData["gameWithoutTime"]);
|
||||||
|
|
14
index.html
14
index.html
|
@ -13,10 +13,10 @@
|
||||||
|
|
||||||
<form id="myform">
|
<form id="myform">
|
||||||
<input type="text" name="steamid" id="steamid" placeholder="SteamID">
|
<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>
|
</form>
|
||||||
|
|
||||||
<h1>Compte de <span id="username"></span></h1>
|
<h1 id="username">Aucun compte chargé</h1>
|
||||||
|
|
||||||
<div id="box">
|
<div id="box">
|
||||||
<div id="error">
|
<div id="error">
|
||||||
|
@ -31,5 +31,15 @@
|
||||||
|
|
||||||
<script src="getinformations.js">
|
<script src="getinformations.js">
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
|
var input = document.getElementById("steamid");
|
||||||
|
|
||||||
|
input.addEventListener("keyup", function(event) {
|
||||||
|
if (event.keyCode === 13) {
|
||||||
|
event.preventDefault();
|
||||||
|
document.getElementById("button").click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in a new issue