您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a Virtupets search link for Inventory, SDB and Search.
当前为
// ==UserScript== // @name GC Virtupets Search Links // @namespace https://greasyfork.org/en/users/1291562-zarotrox // @version 1.0 // @description Adds a Virtupets search link for Inventory, SDB and Search. // @author Zarotrox // @match https://www.grundos.cafe/* // @icon https://i.ibb.co/44SS6xZ/Zarotrox.png // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; function addVirtupetsLink(item, itemName) { let searchLinksDiv = item.querySelector('.searchhelp'); if (!searchLinksDiv) { searchLinksDiv = document.createElement('div'); searchLinksDiv.className = 'searchhelp'; item.appendChild(searchLinksDiv); } const newLink = document.createElement('a'); newLink.href = `https://virtupets.net/search?q=${encodeURIComponent(itemName)}`; newLink.title = `Search Virtupets for ${itemName}`; newLink.target = '_blank'; const img = document.createElement('img'); img.src = 'https://virtupets.net/assets/images/vp.png'; img.alt = 'Virtupets Search'; img.title = `Search Virtupets for ${itemName}`; img.className = 'search-helper-virtupets'; newLink.appendChild(img); searchLinksDiv.appendChild(newLink); } function processInventoryItems() { const inventoryItems = document.querySelectorAll('.inv-item'); inventoryItems.forEach(item => { const itemNameElement = item.querySelector('strong'); if (itemNameElement) { const itemName = itemNameElement.textContent.trim(); addVirtupetsLink(item, itemName); } }); } function processSDBItems() { const sdbItems = document.querySelectorAll('div[id^="sdb-item-"].data.flex-column.small-gap.break'); sdbItems.forEach(item => { const itemNameSpan = item.querySelector('.searchhelp a[onclick*="submitSWSearch"]'); if (itemNameSpan) { const regex = /`([^`]+)`/; const match = regex.exec(itemNameSpan.getAttribute('onclick')); const itemName = match ? match[1] : null; if (itemName) { addVirtupetsLink(item, itemName); } } }); } processInventoryItems(); processSDBItems(); })();