-
Notifications
You must be signed in to change notification settings - Fork 142
/
Copy pathcodepen.html
33 lines (33 loc) · 1.17 KB
/
codepen.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
<script type="text/javascript">
var currentScript = 'https://unpkg.com/fabric@latest/dist/fabric.js';
function codepenLoaded() {
function escapeHtml(unsafe) {
return unsafe
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
}
var preEl = document.querySelectorAll('[data-lang="html"]');
[].forEach.call(preEl, function(el) {
el.innerHTML = escapeHtml(el.innerHTML);
});
var addMainEl = document.querySelectorAll('.codepen-later');
[].forEach.call(addMainEl, function(el) {
var currentData = el.getAttribute('data-prefill');
if (currentData) {
currentData = JSON.parse(currentData);
if (!currentData.scripts) {
currentData.scripts = [];
}
currentData.scripts.unshift(currentScript);
} else {
currentData = { scripts: [currentScript] };
}
el.setAttribute('data-prefill', JSON.stringify(currentData));
});
window.__CPEmbed(".codepen-later");
}
</script>
<script async onload="codepenLoaded()" src="https://static.codepen.io/assets/embed/ei.js"></script>