This repository was archived by the owner on Jan 23, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckout.html
More file actions
116 lines (101 loc) · 5.46 KB
/
checkout.html
File metadata and controls
116 lines (101 loc) · 5.46 KB
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
<html>
<head>
<link href="/style.css" rel="stylesheet">
<link href="/checkout.css" rel="stylesheet">
<link rel="icon" type="image/x-icon" href="favicon.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- HTML Meta Tags -->
<title>Sonic: Lock & Load » DLC</title>
<meta name="description" content="Download some DLC for Sonic: Lock & Load.">
<!-- Facebook Meta Tags -->
<meta property="og:url" content="https://sonic-lockandload.github.io/dlc.html">
<meta property="og:type" content="website">
<meta property="og:title" content="Sonic: Lock & Load » DLC">
<meta property="og:description" content="Download some DLC for Sonic: Lock & Load.">
<meta property="og:image" content="https://sonic-lockandload.github.io/TITLEPIC.png">
<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta property="twitter:domain" content="sonic-lockandload.github.io">
<meta property="twitter:url" content="https://sonic-lockandload.github.io/dlc.html">
<meta name="twitter:title" content="Sonic: Lock & Load » DLC">
<meta name="twitter:description" content="Download some DLC for Sonic: Lock & Load.">
<meta name="twitter:image" content="https://sonic-lockandload.github.io/TITLEPIC.png">
<!-- Meta Tags Generated via https://www.opengraph.xyz -->
<script src="https://kit.fontawesome.com/56b6b2df41.js" crossorigin="anonymous"></script>
<title>Sonic: Lock & Load » DLC</title>
</head>
<body>
<div id="header">
<a href="index.html"><img src="Sonic-LockandLoadLogo.png" id="logo"/></a>
<hr id="separator">
</div>
<div id="content">
<a href="dlc.html" style="position:absolute;">⟨ Back to DLC page</a>
<h1>Checkout</h1>
<div id="receipt">
<h4><strong><span id="name">Loading...</span></strong> – <span id="price"></span> Rings</h4>
<p>This content requires the base game <a href="index.html">Sonic: Lock & Load</a> to play.</p>
<p>Your total amounts to <strong><span id="total"></span> Rings.</strong></p>
<h4>Billing Information</h4>
<p>
Name: Sonic the Hedgehog<br>
Email: sonic@emeraldnotwork.com<br>
Card Number: 1991 0623 1234 4321<br>
Expiry Date: 06/24<br>
CVV: 069<br>
Address: 29th Chaos Street, Station Square, CTC, Mobius<br>
Shipping Address: Tails' Laboratory, Mystic Ruins, Mobius<br>
Special Instructions: Just leave it on the ground, Sonic will come pick it up himself.
</p>
<p id="billing-info">You will be billed on your Emerald Notwork account. This transaction is non-refundable.</p>
<button type="button" id="purchase-button" onclick="downloadFile()">Purchase & Download</button>
</div>
</div>
<script>
let dlcEntry = null;
async function fetchData() {
const urlParams = new URLSearchParams(window.location.search);
const dlcName = urlParams.get('name');
try {
const response = await fetch('dlc-items.json');
const dlcs = await response.json();
for (const dlc of dlcs) {
if (dlc.name === dlcName) {
dlcEntry = dlc;
break;
}
}
if (!dlcName || !dlcEntry) {
window.location.href = 'dlc.html';
} else {
const name = document.getElementById('name');
const price = document.getElementById('price');
const total = document.getElementById('total');
name.innerHTML = dlcName;
price.innerHTML = dlcEntry.price;
total.innerHTML = dlcEntry.price;
const purchased = localStorage.getItem(dlcName);
if (purchased) {
const billingInfo = document.getElementById('billing-info');
const purchaseButton = document.getElementById('purchase-button');
billingInfo.innerHTML = 'You own this item.';
purchaseButton.innerHTML = 'Download';
}
}
}
catch (error) {
console.error('Error:', error);
window.location.href = 'dlc.html';
}
}
function downloadFile() {
if (!localStorage.getItem(dlcEntry.name)) {
localStorage.setItem(dlcEntry.name, 'true');
}
window.location.href = "dlc/" + dlcEntry.file;
setTimeout(location.reload.bind(location), 200);
}
fetchData();
</script>
</body>
</html>