Builded/builded.user.js

101 lines
4 KiB
JavaScript
Raw Normal View History

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
2025-01-04 20:06:16 -08:00
// @version 0.1
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-04 20:06:16 -08:00
// @run-at document-body
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:34:13 -08:00
<p>There are no features here... Want to suggest some <a target="_blank" class=link onclick="window.close()" href="https://discuss.swee.codes/c/10">here?</a> :3</p>
2024-12-18 15:19:43 -08:00
`;
2025-01-04 20:06:16 -08:00
2025-01-04 20:07:31 -08:00
let customloader = await GM.getValue("customLoader", `
2025-01-04 20:06:16 -08:00
<img id="app-loader-animated-image" src="https://git.swee.codes/swee/Builded/raw/branch/main/Builded-solid.png" />
`)
2025-01-04 20:07:31 -08:00
let customloader_enable = await GM.getValue("customLoaderEnable", true)
2025-01-03 22:52:05 -08:00
let settings_entry = `
2025-01-03 23:30:35 -08:00
<div onclick="window.location = 'https://www.guilded.gg/explore/servers/overview';" class="DraggableHandle-container NavV4SelectorRow-container NavV4TeamSelectorBottomOptionsList-row">
<div class="NavV4SelectorRow-icon-container">
<div class="SVGIcon-container NavV4SelectorRow-svg-icon">
<svg class="icon SVGIcon-icon icon-globe" shape-rendering="geometricPrecision" role="img">
<use xml:space="http://www.w3.org/1999/xlink" xlink:href="#icon-globe"></use>
</svg>
</div>
</div>
<div class="NavV4SelectorRow-row-content">
<div class="NavV4TeamSelectorBottomOptionsList-label">
Discover
</div>
</div>
</div>
<div onclick="window.location = 'https://www.guilded.gg/chat';" class="DraggableHandle-container NavV4SelectorRow-container NavV4TeamSelectorBottomOptionsList-row NavV4TeamSelectorBottomOptionsList-dms">
<div class="NavV4SelectorRow-icon-container">
<div class="SVGIcon-container NavV4SelectorRow-svg-icon">
<svg class="icon SVGIcon-icon icon-dm" shape-rendering="geometricPrecision" role="img">
<use xml:space="http://www.w3.org/1999/xlink" xlink:href="#icon-dm">
</use>
</svg>
</div>
</div>
<div class="NavV4SelectorRow-row-content">
<div class="NavV4TeamSelectorBottomOptionsList-label">
Direct messages
</div>
</div>
</div>
2025-01-03 23:19:56 -08:00
<div onclick='window.open("https://builded.swee.codes/settings", "ree", "titlebar=yes,menubar=no,height=500px,width=300px,menubar=no,status=no");' class="DraggableHandle-container NavV4SelectorRow-container NavV4TeamSelectorBottomOptionsList-row">
<div class="NavV4SelectorRow-icon-container">
<div class="SVGIcon-container NavV4SelectorRow-svg-icon">
<img src="https://git.swee.codes/swee/Builded/raw/branch/main/Builded-solid.svg" height="32">
</div>
</div>
<div class="NavV4SelectorRow-row-content">
<div class="NavV4TeamSelectorBottomOptionsList-label">
Builded settings
</div>
</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:23:22 -08:00
$.initialize('.NavV4TeamSelectorBottomOptionsList-container', function() {
2025-01-03 23:19:56 -08:00
console.info("Injecting settings entry...")
2025-01-03 23:30:35 -08:00
$(this)[0].innerHTML = settings_entry;
2025-01-03 22:39:59 -08:00
});
2025-01-04 20:06:16 -08:00
$.initialize('#loading', function() {
$(this)[0].innerHTML = customloader;
});
2024-12-18 15:19:43 -08:00
} else {
document.body.innerHTML += settings_HTML;
}
console.info("Builded Loaded <3");