-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
134 lines (122 loc) · 4.63 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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>games2d</title>
<meta name=viewport content="width=device-width, initial-scale=1">
<link rel="manifest" href="manifest.webmanifest">
<link rel="stylesheet" href="main.css" type="text/css">
<script type="module">
if ('serviceWorker' in navigator) {
let deferredPrompt
let installButton = document.querySelector('#install-button')
if (installButton) {
installButton.parentNode.style.display = 'none'
window.addEventListener('beforeinstallprompt', (e) => {
let evt = e
evt.preventDefault()
deferredPrompt = evt
installButton.parentNode.style.display = 'block'
installButton.addEventListener('click', (_) => {
installButton.parentNode.style.display = 'none'
if (deferredPrompt) {
deferredPrompt.prompt()
deferredPrompt.userChoice.then((choiceResult) => {
console.log(choiceResult)
deferredPrompt = null;
});
}
})
})
}
navigator.serviceWorker.register('service_worker.js')
}
</script>
<script src="https://js.stripe.com/v3"></script>
<link rel="icon" href="assets/games2d_icon.png">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Raleway&display=swap">
</head>
<body id=games2d>
<h1><span class=games2d_title_games>games</span><span class=games2d_title_2d>2d</span></h1>
<p>A collection of <span class=games2d_title_2d>2d</span> <span class=games2d_title_games>games</span> for the
web.</p>
<div id="error-message"></div>
<div class="games">
<div class="game"><a href="stray_lines/">Stray lines</a></div>
<div class="game"><a href="4snakes/">4snakes</a></div>
<div class="game"><a href="simon/">Simon</a></div>
<div class="game">Enjoying the games? Support their development by donating!<br /><button
id="checkout-link-G2D_STRIPE_SKU_2" class=buy>2€</button> <button
id="checkout-link-G2D_STRIPE_SKU_5" class=buy>5€</button> <button
id="checkout-link-G2D_STRIPE_SKU_10" class=buy>10€</button></div>
<div class="game">
<button id="install-button">Install</button>
<p class="install-description">Install the games on your device. When installed <b>games2d</b> provides
more features like vibration and offline use (<a
href="https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps">read more about
PWAs</a>).</p>
</div>
</div>
<p>See what <a href="https://discu.eu/q/site:xojoc.pw/games2d" title="games2d discussions">people say about the
games</a>.</p>
<p>Made by <a href="https://xojoc.pw" title="My website">Alexandru Cojocaru</a>.</p>
<p>Get the <a href="https://github.com/xojoc/games2d" title="games2d's source">source code</a>. See the <a
href="https://github.com/xojoc/games2d/blob/master/CREDITS.md" title="Credits">CREDITS</a>.</p>
<script>
(function () {
var stripe = Stripe('G2D_STRIPE_PUBLIC_KEY');
var checkoutLink2 = document.getElementById('checkout-link-G2D_STRIPE_SKU_2');
checkoutLink2.addEventListener('click', function () {
stripe.redirectToCheckout({
items: [{
sku: 'G2D_STRIPE_SKU_2',
quantity: 1
}],
successUrl: 'https://xojoc.pw/games2d/thanks',
cancelUrl: 'https://xojoc.pw/games2d/',
})
.then(function (result) {
if (result.error) {
var displayError = document.getElementById('error-message');
displayError.textContent = result.error.message;
}
});
});
var checkoutLink5 = document.getElementById('checkout-link-G2D_STRIPE_SKU_5');
checkoutLink5.addEventListener('click', function () {
stripe.redirectToCheckout({
items: [{
sku: 'G2D_STRIPE_SKU_5',
quantity: 1
}],
successUrl: 'https://xojoc.pw/games2d/thanks',
cancelUrl: 'https://xojoc.pw/games2d/',
})
.then(function (result) {
if (result.error) {
var displayError = document.getElementById('error-message');
displayError.textContent = result.error.message;
}
});
});
var checkoutLink10 = document.getElementById('checkout-link-G2D_STRIPE_SKU_10');
checkoutLink10.addEventListener('click', function () {
stripe.redirectToCheckout({
items: [{
sku: 'G2D_STRIPE_SKU_10',
quantity: 1
}],
successUrl: 'https://xojoc.pw/games2d/thanks',
cancelUrl: 'https://xojoc.pw/games2d/',
})
.then(function (result) {
if (result.error) {
var displayError = document.getElementById('error-message');
displayError.textContent = result.error.message;
}
});
});
})();
</script>
</body>
</html>