first commit
This commit is contained in:
25
js/widget.js
Normal file
25
js/widget.js
Normal file
@ -0,0 +1,25 @@
|
||||
let firstLoadWidget = 1;
|
||||
let widgetOpen = 0;
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
let button = document.createElement("button");
|
||||
button.setAttribute("id", "discord");
|
||||
document.body.appendChild(button);
|
||||
button.addEventListener("click", () => {
|
||||
if(firstLoadWidget) {
|
||||
toast({ title: "Do you want to load Discord?", message: "This may be blocked in certain schools.\nClick here to load Discord." }, loadWidget);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
function loadWidget() {
|
||||
if(firstLoadWidget) {
|
||||
firstLoadWidget = 0;
|
||||
loadScript("https://cdn.jsdelivr.net/npm/@widgetbot/crate@3", loadCrate);
|
||||
}
|
||||
}
|
||||
function loadCrate() {
|
||||
new Crate({server: '1148719137238040606',channel: '1173731814196645909', color: "#00000000", glyph: ["data:;base64,=", "100%"]});
|
||||
crate.toggle(true);
|
||||
let element = document.querySelector('[aria-label="Discord chat embed"]');
|
||||
element.remove();
|
||||
}
|
Reference in New Issue
Block a user