102 lines
No EOL
4 KiB
JavaScript
102 lines
No EOL
4 KiB
JavaScript
/*jshint esversion: 6 */
|
|
// ==UserScript==
|
|
// @name Builded
|
|
// @namespace https://git.swee.codes/swee/Builded
|
|
// @version 0.1
|
|
// @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-body
|
|
// ==/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
|
|
});
|
|
});
|
|
}
|
|
(async () => {
|
|
let settings_HTML = `
|
|
<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>
|
|
`;
|
|
|
|
let customloader = await GM.getValue("customLoader", `
|
|
<img height="90px" src="https://git.swee.codes/swee/Builded/raw/branch/main/Builded-solid.svg" />
|
|
`)
|
|
let customloader_enable = await GM.getValue("customLoaderEnable", true)
|
|
let settings_entry = `
|
|
<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>
|
|
<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>
|
|
</div>
|
|
`
|
|
if (location.host == "www.guilded.gg") {
|
|
console.info("Guilded.GG detected.");
|
|
$.initialize('.NavV4TeamSelectorBottomOptionsList-container', function() {
|
|
console.info("Injecting settings entry...")
|
|
$(this)[0].innerHTML = settings_entry;
|
|
});
|
|
$.initialize('#loading', function() {
|
|
$(this)[0].innerHTML = customloader;
|
|
});
|
|
} else {
|
|
document.body.innerHTML += settings_HTML;
|
|
}
|
|
console.info("Builded Loaded <3");
|
|
})(); |