-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlink.html
More file actions
151 lines (143 loc) · 5.42 KB
/
link.html
File metadata and controls
151 lines (143 loc) · 5.42 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Fakemon's Website | Link My Site</title>
<script src="UniversalElements.js">
// Script for automatically filling element data across pages (this is an anti-React household)
</script>
</head>
<body>
<div class="main">
<div class="navbar">
<!--UniversalElements.js or something idk and idc atp-->
</div>
<img
src="https://uploads.scratch.mit.edu/get_image/user/117698316_99x99.png"
class="pfp"
/>
<h1>Link My Site</h1>
If you want a fancy link to my site, use this:
<br />
<div
id="complexLinkHTML"
class="code runonpgld"
runonpgld="importTextFromElement('complexLinkContainer', this)"
></div>
<script>
// Source - https://stackoverflow.com/questions/6234773/can-i-escape-html-special-chars-in-javascript
// Posted by bjornd, modified by community. See post 'Timeline' for change history
// Retrieved 2025-12-07, License - CC BY-SA 4.0
function escapeHtml(unsafe) {
return unsafe
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
}
// End Stack Overflow code
function importTextFromElement(sourceID, linkmy) {
console.log(
"Importing text to element",
linkmy,
"from element with ID",
sourceID
);
let sourceElem = document.getElementById(sourceID);
linkmy.innerHTML = escapeHtml(sourceElem.innerHTML.trim());
}
function copyElementText(elemID, copybutton) {
navigator.clipboard.writeText(
document.getElementById(elemID).innerText
);
copybutton.style.backgroundColor = "lightgreen";
copybutton.style.color = "green";
copybutton.innerText = "✔️ Copied!";
}
document.addEventListener("DOMContentLoaded", () => {
// Really bad workaround because onload didn't work but I still wanted to seem cool (at least I learned about custom attributes!)
const elems = document.getElementsByClassName("runonpgld");
for (let i = 0; i < elems.length; i++) {
let code = elems[i].attributes.runonpgld.textContent;
console.log(
"Now on element",
elems[i],
"with runonpgld value of",
code
);
elems[i].addEventListener("click", Function(code));
elems[i].click();
}
});
</script>
<button
onclick="copyElementText('complexLinkHTML', this)"
class="copybutton"
>
📋 Copy
</button>
<div id="complexLinkContainer">
<a
href="https://scratchfakemon.github.io"
id="fakemonsWebsite"
style="
color: #7f94fd;
text-decoration: none;
font-weight: bold;
background-color: #ffffff00;
border-radius: 100px;
justify-content: center;
padding: 10px 5px;
display: block;
align-items: center; /* Aligns icons with text */
gap: 5px; /* Spacing between icon and text */
text-decoration: none;
transition: all 1s cubic-bezier(0.3, 0.94, 0.3, 0.95);
"
onmouseover="
const thislink = document.getElementById('fakemonsWebsite')
thislink.style = `color: #2e4ff6; display: block; text-decoration: underline; font-weight: bolder; background-color: #8da6ffec; padding: 10px 15px; transition: all 1s cubic-bezier(0.3, 0.94, 0.3, 0.95); font-size-adjust: 10px;`"
onmouseout="
const thislink = document.getElementById('fakemonsWebsite')
thislink.style = `color: #7f94fd; text-decoration: none; font-weight: bold; background-color: #ffffff00; border-radius: 100px; justify-content: center; padding: 10px 5px; display: block; align-items: center; gap: 5px; text-decoration: none; transition: all 1s cubic-bezier(0.3, 0.94, 0.3, 0.95);`
"
>
<img
style="width: 25px; border-radius: 25px"
src="https://uploads.scratch.mit.edu/get_image/user/117698316_99x99.png"
class="pfp"
/>Fakemon's Website<br />
<small
><i
>i make stupid stuff on the interwebz from time to time</i
></small
>
</a>
</div>
Or if you want something more basic...
<div
id="simpleLinkHTML"
class="code runonpgld"
runonpgld="importTextFromElement('simpleLinkContainer', this)"
></div>
<button
onclick="copyElementText('simpleLinkHTML', this)"
class="copybutton"
>
📋 Copy
</button>
<div id="simpleLinkContainer">
<a href="https://scratchfakemon.github.io"
><img
src="https://scratchfakemon.github.io/Friendsite%20Link%20Image%20(A).png"
style="width: 131px; height: 49.25px"
/></a>
</div>
<hr class="but" />
<div class="links">
<!--these elements rlly r universal if u catch my drift-->
</div>
</div>
</body>
</html>