-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
115 lines (102 loc) · 4.06 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
<!DOCTYPE html>
<html lang="en">
<head>
<script type="module">
import { Buffer } from "buffer";
window.Buffer = Buffer;
</script>
<meta charset="UTF-8" />
<meta http-equiv="Cache-Control" content="max-age=86400" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Checking</title>
<link rel="icon" href="/favicon.ico" />
<script src="/telegram-web-app.js"></script>
<script src="https://sad.adsgram.ai/js/sad.min.js"></script>
<!-- Add Telegram Analytics script to HTML head -->
<script src="https://tganalytics.xyz/index.js" type="text/javascript"></script>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-293GP0XFSZ"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-293GP0XFSZ');
// Initialize Telegram Analytics SDK
window.telegramAnalytics.init({
token: 'eyJhcHBfbmFtZSI6IkdNQ29pbiIsImFwcF91cmwiOiJodHRwczovL3QubWUvdGhlR01Db2luQm90IiwiYXBwX2RvbWFpbiI6Imh0dHBzOi8vZ21raW5nLmlvLyJ9!0FEQ4F0g88pVX2Lh8m5Nvk6M6T0JxqPT5Ke2l8wwUvU=',
appName: 'GMCoin',
});
</script>
<script>
/**
* LetterAvatar
* Create Letter avatar based on Initials
*/
(function (w, d) {
function LetterAvatar(name, size, color) {
name = name || '';
size = size || 60;
var colours = [
"#1abc9c", "#2ecc71", "#3498db", "#9b59b6", "#34495e", "#16a085", "#27ae60", "#2980b9", "#8e44ad", "#2c3e50",
"#f1c40f", "#e67e22", "#e74c3c", "#00bcd4", "#95a5a6", "#f39c12", "#d35400", "#c0392b", "#bdc3c7", "#7f8c8d"
],
nameSplit = name,
initials, charIndex, colourIndex, canvas, context, dataURI;
if (nameSplit.length > 1) {
initials = nameSplit ? nameSplit.charAt(0).toUpperCase() + nameSplit.charAt(1) : '?';
} else {
initials = nameSplit ? nameSplit.charAt(0).toUpperCase() : '?';
}
if (w.devicePixelRatio) {
size = (size * w.devicePixelRatio);
}
charIndex = (initials == '?' ? 72 : initials.charCodeAt(0)) - 64;
colourIndex = charIndex % 20;
canvas = d.createElement('canvas');
canvas.width = size;
canvas.height = size;
context = canvas.getContext("2d");
context.fillStyle = color ? color : colours[colourIndex - 1];
context.fillRect(0, 0, canvas.width, canvas.height);
context.font = "bold " + Math.round(canvas.width / 2) + "px 'Microsoft Yahei'";
context.textAlign = "center";
context.fillStyle = "#fff";
context.fillText(initials, size / 2, size / 1.5);
dataURI = canvas.toDataURL();
canvas = null;
return dataURI;
}
LetterAvatar.transform = function () {
Array.prototype.forEach.call(d.querySelectorAll('img[avatar]'), function (img, name, color) {
name = img.getAttribute('avatar');
color = img.getAttribute('color');
img.src = LetterAvatar(name, img.getAttribute('width'), color);
img.removeAttribute('avatar');
img.setAttribute('alt', name);
});
};
// AMD support
if (typeof define === 'function' && define.amd) {
define(function () { return LetterAvatar; });
// CommonJS and Node.js module support.
} else if (typeof exports !== 'undefined') {
// Support Node.js specific `module.exports` (which can be a function)
if (typeof module != 'undefined' && module.exports) {
exports = module.exports = LetterAvatar;
}
// But always support CommonJS module 1.1.1 spec (`exports` cannot be a function)
exports.LetterAvatar = LetterAvatar;
} else {
window.LetterAvatar = LetterAvatar;
d.addEventListener('DOMContentLoaded', function (event) {
LetterAvatar.transform();
});
}
})(window, document);
</script>
</body>
</html>