forked from parse-community/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.html
56 lines (52 loc) · 1.76 KB
/
default.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
<!doctype html>
<html>
{% include head.html %}
{{ content }}
<script src="//cdnjs.cloudflare.com/ajax/libs/modernizr/2.8.3/modernizr.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/anchor-js/3.2.2/anchor.min.js"></script>
<script>
anchors.options = {
placement: 'left',
icon: '#'
};
anchors.add();
</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-102564547-3"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-102564547-3');
window.onload = function () {
function copyToClipboard() {
const textId = this.id.replace('btn','code')
const copyText = document.getElementById(textId);
const text = copyText.textContent || copyText.innerText;
const input = document.createElement('textarea');
input.innerHTML = text.replace(/\n$/, '');
document.body.appendChild(input);
input.select();
input.setSelectionRange(0, 99999);
document.execCommand('copy');
document.body.removeChild(input);
this.innerHTML = '✔️';
setTimeout(() => {
this.innerHTML = '📋';
},2000)
}
let codes = document.querySelectorAll('.highlight > pre > code');
let count = 0;
codes.forEach((code) => {
code.setAttribute("id", `code-${count}`);
const btn = document.createElement('button');
btn.innerHTML = "📋";
btn.className = "btn-copy";
btn.setAttribute("id", `btn-${count}`);
btn.addEventListener("click",copyToClipboard);
code.before(btn);
count++;
});
}
</script>
</html>