-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
161 lines (154 loc) · 7.19 KB
/
index.html
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DEEPSPACE Resources Chart</title>
<style>
.charts-container {
display: grid;
grid-template-columns: repeat(4, 1fr); /* 4 columns for larger screens */
gap: 10px;
margin-bottom: 20px;
}
iframe {
border: 2px solid #ddd;
box-shadow: 0 0 5px rgba(0,0,0,0.2);
width: 100%;
height: 425px;
overflow: hidden;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
table, th, td {
border: 1px solid black;
}
th, td {
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
/* Media Query for Mobile Screens */
@media screen and (max-width: 600px) {
.charts-container {
grid-template-columns: repeat(1, 1fr); /* 2 columns for mobile screens */
}
}
</style>
<meta http-equiv="Pragma" content="no-cache">
<base target="_blank">
<script type="text/javascript" src="https://d3js.org/d3.v7.min.js"></script>
<script type="text/javascript">
noFormatDecimal = d3.format(",.0f");
mediumFormatDecimal = d3.format(",.2f");
largeFormatDecimal = d3.format(",.4f");
// Get the current URL
const currentURL = window.location.href;
let resourcesURL = ""
// Check if the URL contains "resources.deepspace.game"
if (currentURL.includes("resources.deepspace.game")) {
// Use the variable with a specific value
resourcesURL = "https://resources.deepspace.game/api";
console.log(resourcesURL);
} else if (currentURL.includes("dev-resources.deepspace.game")) {
// Adjust the variable value for dev-resources.deepspace.game
resourcesURL = "https://dev-resources.deepspace.game/api";
console.log(resourcesURL);
} else {
// Handle other cases if needed
resourcesURL = "https://resources.deepspace.game/api";
console.log("URL does not match expected patterns");
}
fetch(resourcesURL)
.then(response => response.json())
.then(data => {
console.log(data);
const tableBody = document.getElementById('data');
data.forEach(item => {
let resourceType = '';
switch (item.poolId) {
case 0:
resourceType = 'Iron';
break;
case 1:
resourceType = 'Seplium';
break;
case 2:
resourceType = 'Hydrogen';
break;
case 3:
resourceType = 'Fenna';
break;
case 4:
resourceType = 'Bedasine';
break;
case 5:
resourceType = 'Netherite';
break;
case 6:
resourceType = 'Xanifarium';
break;
case 7:
resourceType = 'Promethium';
break;
default:
resourceType = 'N/A';
}
const row = document.createElement('tr');
row.innerHTML = `
<td>${resourceType}</td>
<td>${largeFormatDecimal(item.dpsBalance)}</td>
<td>${noFormatDecimal(item.resourceBalance)}</td>
<td>${mediumFormatDecimal(item.price)}</td>
`;
tableBody.appendChild(row);
});
})
.catch(error => {
console.error('Error fetching data:', error);
});
</script>
</head>
<body>
<h1>DEEPSPACE Resources Chart (DEVELOPMENT)</h1>
<h2>About DEEPSPACE</h2>
<p><b>Welcome to DEEPSPACE!</b><br/>
DEEPSPACE is an immersive space exploration strategy game that offers a captivating gaming experience. Dive into a universe of strategy and adventure with your fleet of ships! Engage in harvesting resources, trading NFTs, and navigating through thrilling space battles. As you explore the vastness of DEEPSPACE, you'll encounter unique challenges and opportunities. Get ready to strategize, explore, and engage in epic space adventures in the DEEPSPACE universe!
<br/>
Learn more at: <a href="https://deepspace.game">https://deepspace.game</a><br/>
Buy DEEPSPACE (DPS) at: <a href="https://app.deepspace.game">https://app.deepspace.game</a></p>
<p><i>Tip: Check the console log for the full JSON response from the resources api</i></p>
<p><i>Tip: Charts will be inaccurate on TESTNET but the table is accurate</i></p>
<p>Pro Tip: Command Supported: <a href="https://resources.deepspace.game/api">https://resources.deepspace.game/api</a></p>
<!-- Existing table and content from provided HTML -->
<table>
<thead>
<tr>
<th>Resource Name</th>
<th>DPS Balance</th>
<th>Resource Balance</th>
<th>Price (DPS)</th>
</tr>
</thead>
<tbody id="data"></tbody>
</table>
<!-- Charts Container -->
<div class="charts-container">
<!-- Add the iframe tags for each chart here -->
<iframe src="https://chart-embed.service.newrelic.com/herald/6deedd30-de4f-4c24-a141-f6d6c0c38e93?height=400px&timepicker=true" scrolling="no" style="overflow: hidden; overflow-y: hidden;"></iframe>
<iframe src="https://chart-embed.service.newrelic.com/herald/789fb20f-e190-4ca7-b04d-c7891b320b85?height=400px&timepicker=true" scrolling="no" style="overflow: hidden; overflow-y: hidden;"></iframe>
<iframe src="https://chart-embed.service.newrelic.com/herald/8f08b2cf-91fd-4b8e-ac15-0e64390e7c06?height=400px&timepicker=true" scrolling="no" style="overflow: hidden; overflow-y: hidden;"></iframe>
<iframe src="https://chart-embed.service.newrelic.com/herald/c0705778-b4bd-4b7f-81e5-38b7894ba0e8?height=400px&timepicker=true" scrolling="no" style="overflow: hidden; overflow-y: hidden;"></iframe>
<iframe src="https://chart-embed.service.newrelic.com/herald/96412c51-a10c-454c-8398-6bd1acf11b10?height=400px&timepicker=true" scrolling="no" style="overflow: hidden; overflow-y: hidden;"></iframe>
<iframe src="https://chart-embed.service.newrelic.com/herald/c996d8cb-40f3-47ac-bc65-db7ab0dfcf69?height=400px&timepicker=true" scrolling="no" style="overflow: hidden; overflow-y: hidden;"></iframe>
<iframe src="https://chart-embed.service.newrelic.com/herald/fafaed01-b11f-4e8b-a201-9d374037bdcb?height=400px&timepicker=true" scrolling="no" style="overflow: hidden; overflow-y: hidden;"></iframe>
<iframe src="https://chart-embed.service.newrelic.com/herald/e51cfa78-a322-419e-922d-f3e1621bcfbc?height=400px&timepicker=true" scrolling="no" style="overflow: hidden; overflow-y: hidden;"></iframe>
</div>
<br/>
</body>
</html>