From e5e3ad5b71afc6c0cd7ce2ac53c6e5dc4f39ff24 Mon Sep 17 00:00:00 2001 From: Sebastien Plante Date: Sat, 1 Dec 2018 22:05:34 -0500 Subject: [PATCH] fixed a bug when changing images, not retuning to the same order and "details page" --- index.php | 2 +- page.php | 6 +++--- updatethumbnail.js | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/index.php b/index.php index 72f9ce7..df57a3f 100644 --- a/index.php +++ b/index.php @@ -24,7 +24,7 @@ $details = isset($_GET['details']) ? $_GET['details'] : ""; function update() { $.get('page.php?rootpage=&orderby=&details=', function(data) { $("#page").html(data); - window.setTimeout(update, 10000); // 10 secondes + //window.setTimeout(update, 10000); // 10 secondes }); } diff --git a/page.php b/page.php index e53fd11..5599fb6 100644 --- a/page.php +++ b/page.php @@ -7,8 +7,8 @@ $sql = "SELECT * FROM game_time"; $result = $ps4->mysql_conn($sql); $rootpage = $_GET['rootpage']; -$orderby = $_GET['orderby']; -$details = $_GET['details']; +$orderby = isset($_GET['orderby']) ? $_GET['orderby'] : "lastplayed_desc"; +$details = isset($_GET['details']) ? $_GET['details'] : ""; ?> @@ -53,7 +53,7 @@ $games = $ps4->games_reorder($games, $orderby); foreach ($games as $key => $value) { echo "
"; echo "
"; - echo "thumbnailurl($games[$key]["game_id"])."\" border=0 weight=\"80px\" height=\"80px\" onclick=\"thumbnailupdateurl('". $games[$key]["game_id"] ."', '". $games[$key]["game_name"] ."');\">"; + echo "thumbnailurl($games[$key]["game_id"])."\" border=0 weight=\"80px\" height=\"80px\" onclick=\"thumbnailupdateurl('". $games[$key]["game_id"] ."', '". $games[$key]["game_name"] ."', '". $rootpage ."', '". $orderby ."', '". $details ."');\">"; echo "
"; echo "
"; echo "". $games[$key]["game_name"] ." (". $games[$key]["game_id"] .")"; diff --git a/updatethumbnail.js b/updatethumbnail.js index addb0d7..8ad908b 100644 --- a/updatethumbnail.js +++ b/updatethumbnail.js @@ -1,10 +1,8 @@ -function thumbnailupdateurl(gameid, gamename) { - - var sql; +function thumbnailupdateurl(gameid, gamename, rootpage, orderby, details) { var url = prompt("Enter Image URL for " + gamename + " (" + gameid + ")", ""); - if (url == "") { + if (url === "") { alert ("Enter something !"); @@ -18,6 +16,7 @@ function thumbnailupdateurl(gameid, gamename) { }; + $.ajax( { type: "POST", @@ -25,12 +24,13 @@ function thumbnailupdateurl(gameid, gamename) { data: data, success: function(data, textStatus, jqXHR) { + $( document ).ready(function(){ $('#message').html(data); $('#message').fadeIn('slow', function(){ $('#message').delay(3000).fadeOut(); }); - $("#page").load('page.php'); + $("#page").load('page.php?rootpage=' + rootpage + '&orderby=' + orderby + '&details=' + details); }); }