fixed a bug when changing images, not retuning to the same order and "details page"

This commit is contained in:
2018-12-01 22:05:34 -05:00
parent 4701355894
commit e5e3ad5b71
3 changed files with 9 additions and 9 deletions

View File

@@ -24,7 +24,7 @@ $details = isset($_GET['details']) ? $_GET['details'] : "";
function update() { function update() {
$.get('page.php?rootpage=<?php echo $rootpage ?>&orderby=<?php echo $orderby ?>&details=<?php echo $details ?>', function(data) { $.get('page.php?rootpage=<?php echo $rootpage ?>&orderby=<?php echo $orderby ?>&details=<?php echo $details ?>', function(data) {
$("#page").html(data); $("#page").html(data);
window.setTimeout(update, 10000); // 10 secondes //window.setTimeout(update, 10000); // 10 secondes
}); });
} }
</script> </script>

View File

@@ -7,8 +7,8 @@ $sql = "SELECT * FROM game_time";
$result = $ps4->mysql_conn($sql); $result = $ps4->mysql_conn($sql);
$rootpage = $_GET['rootpage']; $rootpage = $_GET['rootpage'];
$orderby = $_GET['orderby']; $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : "lastplayed_desc";
$details = $_GET['details']; $details = isset($_GET['details']) ? $_GET['details'] : "";
?> ?>
@@ -53,7 +53,7 @@ $games = $ps4->games_reorder($games, $orderby);
foreach ($games as $key => $value) { foreach ($games as $key => $value) {
echo "<div class=\"game\">"; echo "<div class=\"game\">";
echo "<div class=\"thumbnail\">"; echo "<div class=\"thumbnail\">";
echo "<img src=\"".$ps4->thumbnailurl($games[$key]["game_id"])."\" border=0 weight=\"80px\" height=\"80px\" onclick=\"thumbnailupdateurl('". $games[$key]["game_id"] ."', '". $games[$key]["game_name"] ."');\">"; echo "<img src=\"".$ps4->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 "</div>"; echo "</div>";
echo "<div class=\"info\">"; echo "<div class=\"info\">";
echo "<strong>". $games[$key]["game_name"] ."</strong> (". $games[$key]["game_id"] .")"; echo "<strong>". $games[$key]["game_name"] ."</strong> (". $games[$key]["game_id"] .")";

View File

@@ -1,10 +1,8 @@
function thumbnailupdateurl(gameid, gamename) { function thumbnailupdateurl(gameid, gamename, rootpage, orderby, details) {
var sql;
var url = prompt("Enter Image URL for " + gamename + " (" + gameid + ")", ""); var url = prompt("Enter Image URL for " + gamename + " (" + gameid + ")", "");
if (url == "") { if (url === "") {
alert ("Enter something !"); alert ("Enter something !");
@@ -18,6 +16,7 @@ function thumbnailupdateurl(gameid, gamename) {
}; };
$.ajax( $.ajax(
{ {
type: "POST", type: "POST",
@@ -25,12 +24,13 @@ function thumbnailupdateurl(gameid, gamename) {
data: data, data: data,
success: function(data, textStatus, jqXHR) success: function(data, textStatus, jqXHR)
{ {
$( document ).ready(function(){ $( document ).ready(function(){
$('#message').html(data); $('#message').html(data);
$('#message').fadeIn('slow', function(){ $('#message').fadeIn('slow', function(){
$('#message').delay(3000).fadeOut(); $('#message').delay(3000).fadeOut();
}); });
$("#page").load('page.php'); $("#page").load('page.php?rootpage=' + rootpage + '&orderby=' + orderby + '&details=' + details);
}); });
} }