This commit is contained in:
parent
b22d903e28
commit
c4412b3f2f
1 changed files with 14 additions and 23 deletions
|
@ -35,36 +35,27 @@ function waitForElm(selector) {
|
|||
});
|
||||
}
|
||||
let settings_HTML = `
|
||||
<p>If you see this text, the userscript successfully rendered the settings page.</p>
|
||||
<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="PersistentActionMenuSection-container PersistentActionMenuSection-container-orientation-vertical">
|
||||
<div class="DesktopOptionsControlOptionHeader-container">
|
||||
<div class="DesktopOptionsControlOptionHeader-header-text">Builded</div>
|
||||
</div>
|
||||
<div class="PersistentActionMenuSection-sections-wrapper PersistentActionMenu-menu-section DesktopOptionsControl-persistent-action-menu-section">
|
||||
<div class="PersistentActionMenuItem-container">
|
||||
<span class="RouteLink-disabled">
|
||||
<div class="DesktopOptionsControlItemTemplate-container" data-name="Overview" onclick="openSettings();">
|
||||
<div class="DesktopOptionsControlItemTemplate-label-text">
|
||||
Open Settings
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
<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>
|
||||
`
|
||||
function openSettings() {
|
||||
let win = window.open("https://builded.swee.codes/settings", "ree", `titlebar=yes,menubar=no,height=500px,width=300px,menubar=no,status=no`);
|
||||
}
|
||||
if (location.host == "www.guilded.gg") {
|
||||
console.info("Guilded.GG detected.");
|
||||
$.initialize('.DesktopOptionsControl-persistent-menu', function() {
|
||||
console.info("Settings opened!")
|
||||
waitForElm('.PersistentActionMenuSection-container').then((elm) => {
|
||||
console.log('Injecting Builded settings...');
|
||||
$(this)[0].innerHTML += settings_entry;
|
||||
});
|
||||
$.initialize('.ActionMenu-sections', function() {
|
||||
console.info("Context menu opened!")
|
||||
$(this)[0].innerHTML += settings_entry;
|
||||
});
|
||||
} else {
|
||||
document.body.innerHTML += settings_HTML;
|
||||
|
|
Loading…
Reference in a new issue