-
Notifications
You must be signed in to change notification settings - Fork 0
/
gamereview.php
57 lines (54 loc) · 2 KB
/
gamereview.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./style.css">
<title>Steam REVIEW PHP</title>
</head>
<body>
<div class="sticky">
<a href="./index.php">На главную</a>
<div class="review-header-inside">
<input type="text" id="game-link" name="game-link"
placeholder="https://store.steampowered.com/app/275850/No_Mans_Sky/">
<input type="submit" value="Получить" onclick="openLink(event)">
</div>
<a href="./clipboard.php">Из буфера</a>
</div>
<div id="root">
<?php require_once('./func/fetch.php'); ?>
<h1>
<?= $title ?><br>Не рекомендую
</h1>
<?= $content ?>
</div>
</body>
<script>
function LoadMoreReviews(gameID, newCursor) {
// console.log("🚀 newCursor =", newCursor)
const urlParams = new URLSearchParams(window.location.search);
const playtime_filter_min = urlParams.get('playtimemin') || 10
newCursor = encodeURIComponent(newCursor)
console.log("🚀 ~ file: gamereview.php:50 ~ LoadMoreReviews ~ newCursor", newCursor)
window.location.href = `./gamereview.php?gameid=${gameID}&playtimemin=${playtime_filter_min}&cursor=${newCursor}`
}
function goToLink(gameID, playtime_filter_min) {
window.location.href = `./gamereview.php?gameid=${gameID}&playtimemin=${playtime_filter_min}`
}
function openLink(e) {
e.preventDefault()
const gameLink = document.getElementById('game-link').value.trim()
if (gameLink) {
const gameID = getIDFromLink(gameLink)
goToLink(gameID, 10)
}
}
function getIDFromLink(link) {
link = link.replace('https://store.steampowered.com/app/', '')
const slash = link.indexOf('/')
const id = link.slice(0, slash)
return id
}
</script>
</html>