-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
57 lines (53 loc) · 1.77 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Copy and Pastable Webflow Element Converter</title>
<style>
body {
font-family: sans-serif;
margin: 20px;
}
textarea {
width: 100%;
height: 200px;
margin-bottom: 20px;
}
button {
padding: 10px 20px;
cursor: pointer;
}
</style>
</head>
<body>
<h1>Convert Clipboard to JSON</h1>
<iframe src="https://evercoder.github.io/clipboard-inspector/" frameborder="0" width="100%" height="400px"></iframe>
<h1>Convert JSON to Webflow</h1>
<textarea id="jsonInput"></textarea>
<button id="copyBTN">Copy</button>
<script>
document.querySelector('#copyBTN').addEventListener('click', function(){
let codeSnippetText = document.querySelector('#jsonInput').value;
if (codeSnippetText) {
try {
let codeSnippet = JSON.parse(codeSnippetText);
document.addEventListener("copy", (event) => {
event.clipboardData.setData("application/json", JSON.stringify(codeSnippet));
event.preventDefault();
});
document.execCommand('copy');
this.textContent = 'Copied!';
setTimeout(() => {
this.textContent = 'Copy';
}, 2000);
} catch (error) {
alert("Error parsing JSON:", error);
}
} else {
alert("Empty JSON data or invalid content");
}
})
</script>
</body>
</html>