-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
342 lines (293 loc) · 18.9 KB
/
index.js
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
localStorage.setItem("toggle", false);
window.onload = function () {
import(chrome.runtime.getURL("js-confetti.min.js")).then((module) => {
document.jsConfetti = new module.default();
});
};
// Create a button element
const button = document.createElement("button");
const img = document.createElement("img");
img.src = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAvAAAALwCAYAAADxpkF6AAAABmJLR0QA/wD/AP+gvaeTAAAgAElEQVR4nO3debBtVX0n8O97PCYZ1acMAhEVGdsYJY6tiPMQJ9pOHJJnmVbSGCvE2E5pY6hIbO1KLIndSYxJtOnY2iDVivOAtiAY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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADsRjlQAAAC/SURBVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJhf/w/HiQkpljkO6wAAAABJRU5ErkJggg==`;
img.alt = "Image Button";
button.appendChild(img);
// Style the button
img.style.position = "fixed";
img.style.bottom = "10px";
img.style.right = "10px";
img.style.zIndex = "9999"; // Ensure the button is on top of other page elements
img.style.width = "150px";
img.style.height = "150px";
let isOn = false;
// Add an event listener to the button
img.addEventListener("click", function () {
console.log("click");
console.log(localStorage.getItem("toggle"));
const currentToggle = localStorage.getItem("toggle");
localStorage.setItem("toggle", currentToggle === "true" ? "false" : "true");
isOn = !isOn;
if (!isOn) {
isClicked = false;
if (currentPopup) {
currentPopup.remove();
currentPopup = null;
}
if (selectedElement) {
selectedElement.classList.remove("highlight-on-hover");
}
selectedElement = null;
}
console.log(isOn);
document.jsConfetti.addConfetti({});
document.jsConfetti.addConfetti({});
document.jsConfetti.addConfetti({});
});
img.addEventListener("mouseover", function () {
console.log("mouseover");
img.style.width = "160px";
img.style.height = "160px";
img.style.bottom = "5px";
img.style.right = "5px";
});
img.addEventListener("mouseout", function () {
console.log("mouseout");
img.style.width = "150px";
img.style.height = "150px";
img.style.bottom = "10px";
img.style.right = "10px";
});
img.addEventListener("contextmenu", function (event) {
event.preventDefault();
window.location.href = "https://github.com/pranavnt/dubhacks22";
});
// Append the button to the document body
document.body.appendChild(img);
document.head.appendChild(document.createElement("style")).innerHTML = `body {
margin: 0;
padding: 0;
}
/* Highlight effect on hover */
.highlight-on-hover {
outline: 2px dashed rgb(65, 134, 246) !important;
background-color: rgba(65, 134, 246, 0.2) !important;
}
.umix-popup {
}
.umix-container {
display: flex;
align-items: center;
justify-content: space-between;
background-color: #fff;
border-radius: 8px;
padding: 10px 15px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
width: 350px; /* Adjust to your desired width */
}
.umix-input {
flex: 1;
border: none;
outline: none;
background-color: transparent;
font-size: 1em;
padding: 5px;
}
.umix-button {
background: transparent;
border: none;
}
.arrow-icon {
display: flex;
align-items: center;
justify-content: center;
width: 30px;
height: 30px;
background-color: #004B87;
border-radius: 50%;
}
.arrow-icon svg {
fill: none;
stroke: #fff;
stroke-width: 2;
width: 15px;
height: 15px;
}
.fade {
animation: fade-in-out 3s infinite;
}
@keyframes fade-in-out {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
.slide {
animation: slide-in 3s infinite;
}
@keyframes slide-in {
0% {
left: -100%;
}
50% {
left: 0;
}
100% {
left: -100%;
}
}
.rotate {
animation: rotate 3s infinite linear;
}
@keyframes rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}`;
let selectedElement = null;
let currentPopup = null;
let isClicked = false;
function extractHtmlContent(mixedString) {
// Match all HTML tags and their content
const matches = mixedString.match(/<[^>]*>[^<]*<\/[^>]*>|<[^/>]+\/>/g);
// If matches are found, join them to form the pure HTML content; otherwise, return an empty string
return matches ? matches.join("") : "";
}
document.addEventListener("mouseover", (e) => {
console.log(isOn, isClicked);
if (!isOn) return;
if (isClicked) return;
if (e.target?.className.includes("umix-popup")) return;
// check if the mouse is over the variable named img
if (e.target === img) return;
const x = e.clientX;
const y = e.clientY;
const element = document.elementFromPoint(x, y);
if (selectedElement) {
selectedElement.classList.remove("highlight-on-hover");
}
selectedElement = element;
// Add highlight effect to the selected element
selectedElement.classList.add("highlight-on-hover");
console.log(selectedElement);
});
document.addEventListener("keydown", function (event) {
if (!isOn) return;
if (event.key === "Escape") {
isClicked = false;
if (currentPopup) {
currentPopup.remove();
currentPopup = null;
}
if (selectedElement) {
selectedElement.classList.remove("highlight-on-hover");
}
selectedElement = null;
}
});
document.addEventListener("click", (e) => {
if (!isOn) return;
if (e.target === img) return;
if (
currentPopup &&
selectedElement &&
e.target !== selectedElement &&
!selectedElement.contains(e.target) &&
e.target !== currentPopup &&
!currentPopup.contains(e.target)
) {
isClicked = false;
if (currentPopup) {
currentPopup.remove();
currentPopup = null;
}
if (selectedElement) {
selectedElement.classList.remove("highlight-on-hover");
}
selectedElement = null;
return;
}
isClicked = true;
if (!selectedElement) return;
let currentEl = selectedElement;
if (
e.target?.className.includes("umix-popup") ||
!selectedElement.className.includes("highlight-on-hover")
)
return;
if (currentPopup) {
currentPopup.remove();
currentPopup = null;
}
// defines text area, button, and popup
const input = document.createElement("textarea");
const button = document.createElement("button");
const popup = document.createElement("div");
popup.className = "umix-popup umix-container";
button.className = "umix-popup umix-button";
input.className = "umix-popup umix-input";
input.placeholder =
"Make the text larger or change the colors of this element.";
input.style.color = "black";
button.style.color = "black";
popup.style.position = "fixed";
const x = e.clientX;
const y = e.clientY;
popup.style.left = `${x}px`;
popup.style.top = `${y}px`;
popup.style.zIndex = "99999";
const buttonText = `<span class="arrow-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><polyline points="9 10 4 15 9 20"></polyline><path d="M20 4v7a4 4 0 0 1-4 4H4"></path></svg>
</span>`;
const callback = () => {
if (!isOn) return;
currentEl.classList.remove("highlight-on-hover");
button.textContent = "Loading...";
fetch("https://dubhacks23-production.up.railway.app/edit", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
html: currentEl.outerHTML,
edit: input.value,
}),
})
.then((response) => response.json()) // Convert the response to JSON
.then((data) => {
try {
console.log(data);
const html = extractHtmlContent(data.output.output);
const fragment = document.createElement("div");
fragment.innerHTML = html;
button.innerHTML = buttonText;
currentEl.replaceWith(fragment);
currentEl = fragment;
} catch (error) {
console.error(error);
}
})
.catch((error) => {
console.error(error);
});
};
input.onkeypress = (event) => {
if (!isOn) return;
if (event.key === "Enter") {
event.preventDefault(); // Enter no longer makes a new line
callback();
}
};
button.onclick = callback;
button.innerHTML = buttonText;
popup.appendChild(input);
popup.appendChild(button);
document.body.appendChild(popup);
currentPopup = popup;
currentEl.classList.add("highlight-on-hover");
});