-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlink.html
More file actions
162 lines (147 loc) · 4.92 KB
/
Copy pathlink.html
File metadata and controls
162 lines (147 loc) · 4.92 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
152
153
154
155
156
157
158
159
160
161
162
<!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 some stylized links to this site, use these!
<br />
<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>
<h3>Type A</h3>
<div
id="aHTML"
class="code runonpgld"
runonpgld="importTextFromElement('aContainer', this)"
></div>
<button
onclick="copyElementText('aHTML', this)"
class="copybutton"
>
📋 Copy
</button>
<div id="aContainer">
<a href="https://scratchfakemon.github.io"
><img class="sitelinkbutton"
src="https://scratchfakemon.github.io/Friendsite%20Link%20Image%20(A).svg"
/></a>
</div>
<h3>Type B</h3>
<div
id="bHTML"
class="code runonpgld"
runonpgld="importTextFromElement('bContainer', this)"
></div>
<button
onclick="copyElementText('bHTML', this)"
class="copybutton"
>
📋 Copy
</button>
<div id="bContainer">
<a href="https://scratchfakemon.github.io"
><img class="sitelinkbutton"
src="https://scratchfakemon.github.io/Friendsite%20Link%20Image%20(B).svg"
/></a>
</div>
<h3>Type C</h3>
<div
id="cHTML"
class="code runonpgld"
runonpgld="importTextFromElement('cContainer', this)"
></div>
<button
onclick="copyElementText('cHTML', this)"
class="copybutton"
>
📋 Copy
</button>
<div id="cContainer">
<a href="https://scratchfakemon.github.io"
><img class="sitelinkbutton"
src="https://scratchfakemon.github.io/Friendsite%20Link%20Image%20(C).svg"
/></a>
</div>
<h3>Type D</h3>
<div
id="dHTML"
class="code runonpgld"
runonpgld="importTextFromElement('dContainer', this)"
></div>
<button
onclick="copyElementText('dHTML', this)"
class="copybutton"
>
📋 Copy
</button>
<div id="dContainer">
<a href="https://scratchfakemon.github.io"
><img class="sitelinkbutton"
src="https://scratchfakemon.github.io/Friendsite%20Link%20Image%20(D).svg"
/></a>
</div>
<hr class="but" />
<div class="links">
<!--these elements rlly r universal if u catch my drift-->
</div>
</div>
</body>
</html>