-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnew.js
30 lines (30 loc) · 1019 Bytes
/
new.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
import "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js";
const log = (text, color, size) => {
console.log("%c%s", `color: ${color}; font-size: ${size || 1}em;`, text);
};
const css = (inject) => {
const $style = document.createElement("style");
$style.innerHTML = inject;
document.body.appendChild($style);
};
function syntheticImport(url) {
return new Promise((resolve, reject) => {
const script = document.createElement("script");
script.async = true;
script.src = url;
script.addEventListener("load", resolve);
script.addEventListener("error", reject);
document.head.appendChild(script);
});
}
const require = syntheticImport;
async function main() {
// Entrypoint
await syntheticImport("https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.9/dat.gui.min.js");
log("init", "lime", 1);
const gui = new dat.GUI();
const folder = gui.addFolder("real");
folder.add(window, "scrollY", 1);
$();
}
main();