63 lines
2.6 KiB
JavaScript
63 lines
2.6 KiB
JavaScript
/*jshint esversion: 6 */
|
|
// ==UserScript==
|
|
// @name Builded
|
|
// @namespace https://git.swee.codes/swee/Builded
|
|
// @version 0.0.1.2
|
|
// @description Vencord, but for Guilded
|
|
// @author Swee
|
|
// @match https://*.guilded.gg/*
|
|
// @match https://builded.swee.codes/settings
|
|
// @icon https://git.swee.codes/swee/Builded/raw/branch/main/Builded-solid.svg
|
|
// @grant GM_setValue
|
|
// @grant GM_getValue
|
|
// @require https://code.jquery.com/jquery-3.7.1.min.js
|
|
// @require https://github.com/pie6k/jquery.initialize/raw/refs/heads/master/jquery.initialize.min.js
|
|
// @run-at document-end
|
|
// ==/UserScript==
|
|
function waitForElm(selector) {
|
|
return new Promise(resolve => {
|
|
if (document.querySelector(selector)) {
|
|
return resolve(document.querySelector(selector));
|
|
}
|
|
|
|
const observer = new MutationObserver(mutations => {
|
|
if (document.querySelector(selector)) {
|
|
observer.disconnect();
|
|
resolve(document.querySelector(selector));
|
|
}
|
|
});
|
|
|
|
// If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336
|
|
observer.observe(document.body, {
|
|
childList: true,
|
|
subtree: true
|
|
});
|
|
});
|
|
}
|
|
let settings_HTML = `
|
|
<p>There are no settings here... Want to suggest some <a href="https://discuss.swee.codes/c/10">here?</a> :3</p>
|
|
`;
|
|
let settings_entry = `
|
|
<div class="ActionMenu-section ActionMenu-section">
|
|
<div class="ActionMenu-items ActionMenu-section-type-list">
|
|
<div class="ContextMenuItem-container ContextMenuItem-container-section-type-list" onclick='window.open("https://builded.swee.codes/settings", "ree", "titlebar=yes,menubar=no,height=500px,width=300px,menubar=no,status=no");'>
|
|
<div class="SVGIcon-container ContextMenuIcon-container-destructive-action ContextMenuIcon-container-section-type-list ContextMenuIcon-container-icon ContextMenuItem-icon">
|
|
<img width="25" src="https://git.swee.codes/swee/Builded/raw/branch/main/Builded-solid.svg">
|
|
</div>
|
|
<div class="ContextMenuItem-label">
|
|
Builded Settings
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`
|
|
if (location.host == "www.guilded.gg") {
|
|
console.info("Guilded.GG detected.");
|
|
$.initialize('.ActionMenu-sections', function() {
|
|
console.info("Context menu opened!")
|
|
$(this)[0].innerHTML += settings_entry;
|
|
});
|
|
} else {
|
|
document.body.innerHTML += settings_HTML;
|
|
}
|
|
console.info("Builded Loaded <3");
|