Adds Throw at Neofriend action to the inventory menu
当前为
// ==UserScript==
// @name GC - Throw Slorg at Neofriend Button
// @namespace https://greasyfork.org/en/users/1251911
// @version 0.5
// @description Adds Throw at Neofriend action to the inventory menu
// @author Teffy
// @match https://www.grundos.cafe/inventory/
// @match www.grundos.cafe/inventory/
// @icon https://www.google.com/s2/favicons?sz=64&domain=grundos.cafe
// @license MIT
// @grant none
// ==/UserScript==
(function() {
document.querySelectorAll('.inv-dropdown-menu').forEach(menu => {
if (menu.querySelector('p').textContent.trim() === "Slorg") {
const button = menu.querySelector('button[onclick]');
const id = button.getAttribute('onclick').match(/['"]([a-f0-9\-]+)['"]/)[1];
const throwButton = document.createElement('button');
throwButton.setAttribute('onclick', `const newWindow = window.open('https://www.grundos.cafe/useobject/${id}/?action=throw&key=slorg', 'newwindow', 'width=425,height=600');
newWindow.onload = function() {
const inputField = newWindow.document.getElementById('recip');
if (inputField) {
inputField.value = 'Teffy'; // Replace 'Teffy' with the desired recipient's username
}
}; return false;`);
throwButton.innerHTML = `
<img src="https://grundoscafe.b-cdn.net/items/hall_petpet1.gif" alt="Throw Icon" class="dropdown-icon"> Throw at Neofriend
`;
const targetButton = Array.from(menu.querySelectorAll('button')).find(button =>
button.textContent.includes("Send One as Gift") || button.textContent.includes("Send as Gift")
);
menu.insertBefore(throwButton, targetButton.nextSibling);
}
});
})();