-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview.html
126 lines (113 loc) · 4.62 KB
/
view.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<title>Random Volo tweet</title>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="description" content=""/>
<link rel="icon" href="assets/favicon.png">
<link rel="stylesheet" type="text/css" href="styles/main.css" media="screen"/>
<script type="text/javascript" src="data/lang.js"></script>
</head>
<body>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Josefin+Slab:wght@700&family=Josefin+Slab:wght@400&display=swap"
rel="stylesheet">
<div id="flags"></div>
<main>
<script>window.twttr = (function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
t._e = [];
t.ready = function (f) {
t._e.push(f);
};
return t;
}(document, "script", "twitter-wjs"));</script>
<div class="row">
<div class="column">
<div id="tweet_container"><span id="placeholder"><p>Loading... please wait a few seconds.</p>
<p>If nothing is appearing after a few second,<br/> the tweet may have been deleted, or <a
href="https://downdetector.fr/statut/twitter/">Twitter is experiencing an outage</a></p></span>
</div>
</div>
<div class="column-small">
<button onclick="copyLink(window.location)" id="copy">Copy link</button>
<button onclick="copyLink(`https://twitter.com/volostan/status/${window.tweet_id}`)"><img id="twitterIcon"
src="assets/twitter.png"
alt="Twitter logo">
</button>
<br/>
<button>
<a href="index.html" style="text-decoration: none; color: inherit;" id="another">
Get another Volo</a>
</button>
<br/>
<button onclick="reportMissingTweet()" id="report">Report deleted tweet</button>
<br/>
<div style="margin-left:15px;" id="reportInfo">Reports may take a while to be processed.</div>
<br>
<div style="height: 100px"/>
</div>
</div>
</main>
<footer>
<small id="footer">Brought to you by <a href="https://tumblr.com/volostan/">@Volostan</a> with love <3</small>
</footer>
</footer>
<div id="snackbar"></div>
<script>
const lang = localStorage.getItem('lang');
const {linkCopied, deleted} = window.lang[lang] || {};
function showToast(message) {
var x = document.getElementById("snackbar");
x.innerHTML = message;
x.className = "show";
setTimeout(() => x.className = x.className.replace("show", ""), 3000);
}
twttr.ready(() => {
const params = new URLSearchParams(window.location.search);
const id = params.get('id');
console.debug(id);
window.tweet_id = id;
window.reported = false;
twttr.widgets.createTweet(
id,
document.getElementById('tweet_container'),
{
theme: 'dark',
conversation: 'none',
dnt: true,
}
).then(() => document.getElementById("placeholder").className = "hidden");
})
function reportMissingTweet() {
const idPart2 = '_hrcz87EvLOyeYD6pc';
if (window.reported) {
return;
}
window.reported = true;
const request = new XMLHttpRequest();
const idPart1 = 'Gxdn8nNK28kQs0xpsBiN6C1v0LAi2gTevzMFRcPFGEBi6GA3Mf';
request.open("POST", `https://discord.com/api/webhooks/1084871356178518109/${idPart1}${idPart2}`);
request.setRequestHeader('Content-type', 'application/json');
const params = {
content: `${window.tweet_id} | https://twitter.com/volostan/status/${window.tweet_id}`
};
request.send(JSON.stringify(params));
showToast(deleted || "Thank you for reporting a deleted tweet !")
setTimeout(() => window.location = "index.html", 2000);
}
function copyLink(link) {
navigator.clipboard.writeText(link);
showToast(linkCopied || "Link copied to clipboard !")
}
</script>
</body>
</html>