forked from Hamidcc/de
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlink.html
30 lines (28 loc) · 982 Bytes
/
link.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
<!DOCTYPE html>
<html>
<head>
<title>Code Generator</title>
</head>
<body>
<h1>When you are a coder and a lazy guy:</h1>
<div id="output"></div>
<script>
fetch('/./test.json')
.then(response => response.json())
.then(data => {
const outputDiv = document.getElementById('output');
data.forEach(item => {
const generatedCode = `
<div class="column" data-url="${item.source}"> <a onclick="go(this)"> <img height="145" src="https://upload.wikimedia.org/wikipedia/commons/8/80/Icon_no.svg"> <p>${item.title}</p> </a> </div>
`;
const codeElement = document.createElement('pre');
codeElement.textContent = generatedCode;
outputDiv.appendChild(codeElement);
outputDiv.appendChild(document.createElement('hr')); // Add a horizontal line separator
});
})
.catch(error => console.error('Error fetching or parsing JSON:', error));
</script>
</body>
</html>
gi