-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclone.html
107 lines (95 loc) · 2.28 KB
/
clone.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!--Testing the project-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Linktree</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #F7882F;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container {
background-color: #DCC7AA;
text-align: center;
padding: 50px;
box-shadow: 0px 0px 10px rgba(0, 0, 0.8, 0.65);
border-radius: 5px;
}
h1 {
font-size: 54px;
font-family:courier;
margin-bottom: 20px;
}
button {
background-color: #00a0d2;
color: white;
border: none;
padding: 10px 30px;
border-radius: 5px;
cursor: pointer;
}
#links-container {
margin-top: 20px;
padding:12px;
}
</style>
</head>
<body>
<div class="container">
<h1>Linktree</h1>
<div id="links-container">
<!-- Links will be added here -->
</div>
<button onclick="addLink()">Add Link</button>
</div>
<script>
// Sample initial links
const initialLinks = [
{ name: 'GitHub', url: 'https://github.com/yourusername' },
];
// Function to add a link
function addLink() {
const name = prompt('Enter the name for your link:');
if (!name) return;
const url = prompt('Enter the URL for your link:');
if (!url) return;
const link = { name, url };
const linksContainer = document.getElementById('links-container');
const linkItem = document.createElement('div');
linkItem.className = 'link-item';
linkItem.innerHTML = `
<a href="${url}" target="_blank">${name}</a>
<button onclick="deleteLink(this)">Delete</button>
`;
linksContainer.appendChild(linkItem);
}
// Function to delete a link
function deleteLink(button) {
const linkItem = button.parentElement;
linkItem.remove();
}
// Initialize links
function initializeLinks() {
const linksContainer = document.getElementById('links-container');
initialLinks.forEach((link) => {
const linkItem = document.createElement('div');
linkItem.className = 'link-item';
linkItem.innerHTML = `
<a href="${link.url}" target="_blank">${link.name}</a>
<button onclick="deleteLink(this)">Delete</button>
`;
linksContainer.appendChild(linkItem);
});
}
initializeLinks();
</script>
</body>
</html>