-
Notifications
You must be signed in to change notification settings - Fork 5
/
menu.html
40 lines (35 loc) · 1.01 KB
/
menu.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
<span style="background: black; font-family: Arial; font-weight: 400; width: 100% !important; display: block; text-align: center; color: white;"> ⚠️ Served by FreeNews R.Proxy | <span style="cursor: pointer; font-weight: bold" onclick="share()">Share 🌍</span></span>
<script>
let loaded = false;
function loadDeps(cb){
if (loaded){
cb();
}else {
// Load moz-readability
var script = document.createElement('script');
script.onload = () => {
loaded = true;
cb();
};
script.src = "https://cdn.jsdelivr.net/npm/[email protected]/Readability.min.js";
document.head.appendChild(script);
}
}
function share(){
if(!loaded) return;
try{
const documentClone = document.cloneNode(true);
const article = new Readability(documentClone).parse();
navigator.share({
title: article.title,
text: article.textContent,
url: window.location.href,
}).catch((err) => {
alert(err);
});
}catch(err){
alert(err);
}
}
loadDeps();
</script>