Adds buttons to search for the current game and developer on F95Zone and its forums, and search for the game on Ryuugames and OtomiGames. Also autofills and submits the search form on the F95Zone forums search page by clicking the search button.
当前为
// ==UserScript==
// @name F95Zone and Ryuugames Search Buttons for Steam
// @namespace http://tampermonkey.net/
// @version 4.0
// @description Adds buttons to search for the current game and developer on F95Zone and its forums, and search for the game on Ryuugames and OtomiGames. Also autofills and submits the search form on the F95Zone forums search page by clicking the search button.
// @author FunkyJustin
// @match https://store.steampowered.com/app/*
// @grant none
// @license MIT
// ==/UserScript==
(function() {
'use strict';
function createF95ZoneButton() {
const gameTitle = document.querySelector('.apphub_AppName').innerText.trim();
const f95zoneGameLink = `https://f95zone.to/sam/latest_alpha/#/cat=games/page=1/search=${encodeURIComponent(gameTitle)}`;
const f95zoneForumLink = `https://f95zone.to/search/?q=${encodeURIComponent(gameTitle)}&t=post&c[child_nodes]=1&c[nodes][0]=2&c[title_only]=1&o=relevance`;
const ryuugamesLink = `https://www.ryuugames.com/?s=${encodeURIComponent(gameTitle)}`;
const otomiGamesLink = `https://otomi-games.com/?s=${encodeURIComponent(gameTitle)}`;
const developerElement = document.querySelector('#developers_list a');
const gameButton = createButton('Search on F95Zone', f95zoneGameLink);
const forumButton = createButton('Search on F95Zone Forums', f95zoneForumLink);
const ryuugamesButton = createButton('Search on Ryuugames', ryuugamesLink);
const otomiGamesButton = createButton('Search on OtomiGames', otomiGamesLink);
const titleElement = document.querySelector('.apphub_AppName');
titleElement.parentElement.appendChild(gameButton);
titleElement.parentElement.appendChild(document.createTextNode(' '));
titleElement.parentElement.appendChild(forumButton);
titleElement.parentElement.appendChild(document.createTextNode(' '));
titleElement.parentElement.appendChild(ryuugamesButton);
titleElement.parentElement.appendChild(document.createTextNode(' '));
titleElement.parentElement.appendChild(otomiGamesButton);
if (developerElement) {
const developerName = developerElement.innerText.trim();
const f95zoneDeveloperLink = `https://f95zone.to/sam/latest_alpha/#/cat=games/page=1/creator=${encodeURIComponent(developerName)}`;
const developerButton = createButton('Search Developer on F95Zone', f95zoneDeveloperLink);
developerButton.style.fontSize = '0.8em'; // Adjust font size to match other buttons
developerButton.style.whiteSpace = 'nowrap'; // Prevent text wrapping
titleElement.parentElement.appendChild(document.createTextNode(' '));
titleElement.parentElement.appendChild(developerButton);
}
}
function createButton(text, link) {
const buttonContainer = document.createElement('div');
buttonContainer.className = 'esi-add-note btnv6_blue_hoverfade btn_medium';
buttonContainer.style.margin = '5px 10px 5px 0'; // 5px top, 10px right, 5px bottom, 0px left
buttonContainer.style.overflow = 'hidden'; // Hide overflow content
const button = document.createElement('span');
button.innerText = text;
button.style.whiteSpace = 'nowrap'; // Prevent text wrapping
button.style.overflow = 'hidden'; // Hide overflow content
button.style.textOverflow = 'ellipsis'; // Add ellipsis for overflow text
buttonContainer.appendChild(button);
buttonContainer.addEventListener('click', function(event) {
event.preventDefault(); // Prevent default action
openUniqueTab(link); // Open link in a new tab
});
return buttonContainer;
}
function openUniqueTab(url) {
window.open(url, '_blank'); // Open link in a new tab
}
// Wait for the game details to load before creating the button
window.addEventListener('load', createF95ZoneButton);
})();