2024-12-18 15:18:02 -08:00
|
|
|
/*jshint esversion: 6 */
|
2024-11-14 20:59:43 -08:00
|
|
|
// ==UserScript==
|
|
|
|
// @name Builded
|
|
|
|
// @namespace https://git.swee.codes/swee/Builded
|
2024-11-29 16:13:06 -08:00
|
|
|
// @version 0.0.1.2
|
2024-11-14 20:59:43 -08:00
|
|
|
// @description Vencord, but for Guilded
|
|
|
|
// @author Swee
|
2024-11-29 16:13:06 -08:00
|
|
|
// @match https://*.guilded.gg/*
|
2024-11-16 13:53:41 -08:00
|
|
|
// @match https://builded.swee.codes/settings
|
2024-11-14 21:02:25 -08:00
|
|
|
// @icon https://git.swee.codes/swee/Builded/raw/branch/main/Builded-solid.svg
|
2024-11-14 22:00:49 -08:00
|
|
|
// @grant GM_setValue
|
|
|
|
// @grant GM_getValue
|
2025-01-03 22:25:33 -08:00
|
|
|
// @require https://code.jquery.com/jquery-3.7.1.min.js
|
2025-01-03 22:35:07 -08:00
|
|
|
// @require https://github.com/pie6k/jquery.initialize/raw/refs/heads/master/jquery.initialize.min.js
|
2025-01-03 22:25:33 -08:00
|
|
|
// @run-at document-end
|
2025-01-03 22:24:52 -08:00
|
|
|
// ==/UserScript==
|
2025-01-03 22:54:39 -08:00
|
|
|
function waitForElm(selector) {
|
|
|
|
return new Promise(resolve => {
|
|
|
|
if (document.querySelector(selector)) {
|
|
|
|
return resolve(document.querySelector(selector));
|
|
|
|
}
|
2024-11-14 20:59:43 -08:00
|
|
|
|
2025-01-03 22:54:39 -08:00
|
|
|
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
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2024-12-18 15:19:43 -08:00
|
|
|
let settings_HTML = `
|
2025-01-03 23:10:52 -08:00
|
|
|
<p>There are no settings here... Want to suggest some <a href="https://discuss.swee.codes/c/10">here?</a> :3</p>
|
2024-12-18 15:19:43 -08:00
|
|
|
`;
|
2025-01-03 22:52:05 -08:00
|
|
|
let settings_entry = `
|
2025-01-03 23:10:52 -08:00
|
|
|
<div class="ActionMenu-section ActionMenu-section">
|
|
|
|
<div class="ActionMenu-items ActionMenu-section-type-list">
|
2025-01-03 23:11:55 -08:00
|
|
|
<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");'>
|
2025-01-03 23:10:52 -08:00
|
|
|
<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>
|
2025-01-03 22:52:05 -08:00
|
|
|
</div>
|
2025-01-03 23:10:52 -08:00
|
|
|
</div>
|
2025-01-03 22:52:05 -08:00
|
|
|
</div>
|
|
|
|
`
|
2024-12-18 15:19:43 -08:00
|
|
|
if (location.host == "www.guilded.gg") {
|
|
|
|
console.info("Guilded.GG detected.");
|
2025-01-03 23:10:52 -08:00
|
|
|
$.initialize('.ActionMenu-sections', function() {
|
|
|
|
console.info("Context menu opened!")
|
|
|
|
$(this)[0].innerHTML += settings_entry;
|
2025-01-03 22:39:59 -08:00
|
|
|
});
|
2024-12-18 15:19:43 -08:00
|
|
|
} else {
|
|
|
|
document.body.innerHTML += settings_HTML;
|
|
|
|
}
|
|
|
|
console.info("Builded Loaded <3");
|