replace usage of button with custom button to circumvent issues on some pages

This commit is contained in:
Holly Stubbs 2024-10-02 19:11:33 +01:00
parent 01360d2540
commit a2ce6c3515
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E

View file

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name MultiProbe // @name MultiProbe
// @namespace https://*.angusnicneven.com/* // @namespace https://*.angusnicneven.com/*
// @version 20241002.1 // @version 20241002.2
// @description Probe with friends! // @description Probe with friends!
// @author tgpholly // @author tgpholly
// @match https://*.angusnicneven.com/* // @match https://*.angusnicneven.com/*
@ -48,7 +48,7 @@ console.log("[MP] MultiProbe init");
'use strict'; 'use strict';
// Make sure to change the userscript version too!!!!!!!!!! // Make sure to change the userscript version too!!!!!!!!!!
const USERSCRIPT_VERSION_RAW = "20241002.1"; const USERSCRIPT_VERSION_RAW = "20241002.2";
const USERSCRIPT_VERSION = parseInt(USERSCRIPT_VERSION_RAW.replace(".", "")); const USERSCRIPT_VERSION = parseInt(USERSCRIPT_VERSION_RAW.replace(".", ""));
if (!continueRunningScript) { if (!continueRunningScript) {
@ -142,7 +142,7 @@ html {
.groupui { .groupui {
position: fixed; position: fixed;
top: 2rem; top: calc(2rem + 6px);
right: 0px; right: 0px;
height: 25rem; height: 25rem;
width: 12rem; width: 12rem;
@ -152,18 +152,26 @@ html {
text-shadow: none!important; text-shadow: none!important;
font-family: Arial,sans-serif; font-family: Arial,sans-serif;
font-size: unset !important; font-size: unset !important;
transition: right .16s ease-in-out;
} }
.groupui-popper { .groupui-popper {
position: absolute; position: absolute;
top: 0px; top: -2px;
left: -1rem; left: -1.5rem;
width: 1rem; width: 1rem;
height: 100%; height: calc(100% - 6px);
opacity: 0.25; opacity: 0.25;
transition: opacity .16s ease-in-out;
background-color: black; background-color: black;
border: 1px solid white; border: 1px solid white;
color: white; color: white;
padding: .125rem;
line-height: 380px;
}
.groupui:not(.grouphidden) .groupui-popper, .groupui-popper:hover {
opacity: 1;
} }
.groupui-title { .groupui-title {
@ -340,6 +348,28 @@ mp_container ul li {
mp_group_user { mp_group_user {
display: block; display: block;
} }
mp_button {
display: inline-block;
background-color: black;
color: white;
border: 1px solid white;
text-shadow: none!important;
font-family: Arial,sans-serif;
font-size: unset !important;
padding: 4px 8px;
margin: 2px;
text-align: center;
}
.out-of-the-way {
opacity: 0.25;
transition: opacity .16s ease-in-out;
}
.out-of-the-way:hover {
opacity: 1;
}
`.split("\n").join("").split("\r").join("").split("\t").join(""); `.split("\n").join("").split("\r").join("").split("\t").join("");
document.head.appendChild(styles); document.head.appendChild(styles);
@ -362,7 +392,7 @@ mp_group_user {
groupUIBase.style = "display:none"; groupUIBase.style = "display:none";
groupUIBase.classList.add("groupui"); groupUIBase.classList.add("groupui");
groupUIBase.classList.add("grouphidden"); groupUIBase.classList.add("grouphidden");
const groupPopper = document.createElement("button"); const groupPopper = document.createElement("mp_button");
groupPopper.classList.add("groupui-popper"); groupPopper.classList.add("groupui-popper");
groupPopper.onclick = () => { groupPopper.onclick = () => {
groupUIBase.classList.toggle("grouphidden"); groupUIBase.classList.toggle("grouphidden");
@ -393,11 +423,11 @@ mp_group_user {
buttonBox.classList.add("buttons"); buttonBox.classList.add("buttons");
user.appendChild(buttonBox); user.appendChild(buttonBox);
/*const followButton = document.createElement("button"); /*const followButton = document.createElement("mp_button");
followButton.innerText = "F"; followButton.innerText = "F";
buttonBox.appendChild(followButton);*/ buttonBox.appendChild(followButton);*/
const gotoButton = document.createElement("button"); const gotoButton = document.createElement("mp_button");
gotoButton.innerText = "Go To"; gotoButton.innerText = "Go To";
const gotoLoc = location; const gotoLoc = location;
gotoButton.onclick = () => { gotoButton.onclick = () => {
@ -833,7 +863,7 @@ mp_group_user {
const buttons = document.createElement("mp_container"); const buttons = document.createElement("mp_container");
buttons.style.marginTop = "1rem"; buttons.style.marginTop = "1rem";
const disconnectButton = document.createElement("button"); const disconnectButton = document.createElement("mp_button");
disconnectButton.innerText = localStorage["mpconnectonload"] === "true" ? "Disconnect" : "Connect"; disconnectButton.innerText = localStorage["mpconnectonload"] === "true" ? "Disconnect" : "Connect";
disconnectButton.onclick = () => { disconnectButton.onclick = () => {
if (localStorage["mpconnectonload"] === "true") { if (localStorage["mpconnectonload"] === "true") {
@ -843,9 +873,11 @@ mp_group_user {
} }
} else { } else {
localStorage["mpconnectonload"] = true; localStorage["mpconnectonload"] = true;
doConnect(localStorage["mpapikey"]); //doConnect(localStorage["mpapikey"]);
} }
disconnectButton.innerText = localStorage["mpconnectonload"] === "true" ? "Disconnect" : "Connect"; disconnectButton.innerText = localStorage["mpconnectonload"] === "true" ? "Disconnect" : "Connect";
window.location.reload();
}; };
buttons.appendChild(disconnectButton); buttons.appendChild(disconnectButton);
@ -854,7 +886,7 @@ mp_group_user {
manageAccountLink.href = "https://multiprobe.eusv.net/"; manageAccountLink.href = "https://multiprobe.eusv.net/";
manageAccountLink.target = "_blank"; manageAccountLink.target = "_blank";
buttons.appendChild(manageAccountLink); buttons.appendChild(manageAccountLink);
const manageAccount = document.createElement("button"); const manageAccount = document.createElement("mp_button");
manageAccount.style.marginLeft = "1rem"; manageAccount.style.marginLeft = "1rem";
manageAccount.innerText = "Manage Account"; manageAccount.innerText = "Manage Account";
manageAccount.onclick = () => { manageAccount.onclick = () => {
@ -862,7 +894,7 @@ mp_group_user {
} }
buttons.appendChild(manageAccount); buttons.appendChild(manageAccount);
const closeButton = document.createElement("button"); const closeButton = document.createElement("mp_button");
closeButton.innerText = "Close"; closeButton.innerText = "Close";
closeButton.onclick = () => { closeButton.onclick = () => {
bg.remove(); bg.remove();
@ -894,7 +926,7 @@ mp_group_user {
const buttons = document.createElement("mp_container"); const buttons = document.createElement("mp_container");
buttons.style.marginTop = "1rem"; buttons.style.marginTop = "1rem";
const gotIt = document.createElement("button"); const gotIt = document.createElement("mp_button");
gotIt.onclick = () => { gotIt.onclick = () => {
bg.remove(); bg.remove();
} }
@ -945,7 +977,7 @@ mp_group_user {
const buttons = document.createElement("mp_container"); const buttons = document.createElement("mp_container");
buttons.style.marginTop = "1rem"; buttons.style.marginTop = "1rem";
const gotIt = document.createElement("button"); const gotIt = document.createElement("mp_button");
gotIt.onclick = () => { gotIt.onclick = () => {
localStorage["mpshowfirsttime"] = "false"; localStorage["mpshowfirsttime"] = "false";
bg.remove(); bg.remove();
@ -1031,11 +1063,11 @@ mp_group_user {
const buttons = document.createElement("mp_container"); const buttons = document.createElement("mp_container");
buttons.style.marginTop = "1rem"; buttons.style.marginTop = "1rem";
loginForm.appendChild(buttons); loginForm.appendChild(buttons);
const submitButton = document.createElement("button"); const submitButton = document.createElement("mp_button");
submitButton.innerText = "Connect"; submitButton.innerText = "Connect";
submitButton.type = "submit"; submitButton.type = "submit";
buttons.appendChild(submitButton); buttons.appendChild(submitButton);
const doNotButton = document.createElement("button"); const doNotButton = document.createElement("mp_button");
doNotButton.innerText = "Close"; doNotButton.innerText = "Close";
doNotButton.onclick = () => bg.remove(); doNotButton.onclick = () => bg.remove();
doNotButton.style.marginLeft = "1rem"; doNotButton.style.marginLeft = "1rem";
@ -1083,9 +1115,10 @@ mp_group_user {
document.documentElement.appendChild(bg); document.documentElement.appendChild(bg);
} }
const openMenuButton = document.createElement("button"); const openMenuButton = document.createElement("mp_button");
openMenuButton.style = "opacity:0.25;position:fixed;top:0px;right:0px;z-index:9999999;margin:4px;background-color:black;color:white;border:1px solid white;text-shadow: none!important;font-family: Arial,sans-serif;font-size: unset !important;"; openMenuButton.style = "position:fixed;top:0px;right:0px;z-index:9999999;margin:4px";
openMenuButton.innerText = "MultiProbe Menu"; openMenuButton.classList.add("out-of-the-way");
openMenuButton.innerText = "MultiProbe";
openMenuButton.onclick = () => { openMenuButton.onclick = () => {
if (ws || localStorage["mpapikey"]) { if (ws || localStorage["mpapikey"]) {
createOnlineDialog(); createOnlineDialog();