Adds buttons to search for the Steam game on F95Zone and its forums.
当前为
// ==UserScript==
// @name F95Zone Search Buttons for Steam
// @namespace http://tampermonkey.net/
// @version 1.3
// @description Adds buttons to search for the Steam game on F95Zone and its forums.
// @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)}`;
const gameButton = createButton('Search on F95Zone', f95zoneGameLink);
const forumButton = createButton('Search on F95Zone Forums', f95zoneForumLink);
const container = document.querySelector('.apphub_OtherSiteInfo');
container.appendChild(gameButton);
container.appendChild(forumButton);
}
function createButton(text, link) {
const button = document.createElement('a');
button.innerText = text;
button.href = link;
button.target = '_blank';
button.style.display = 'inline-block'; // Change display to inline-block
button.style.marginRight = '10px'; // Add margin between buttons
button.style.color = '#fff';
button.style.backgroundColor = '#009688';
button.style.padding = '10px';
button.style.borderRadius = '5px';
button.style.textDecoration = 'none';
button.style.cursor = 'pointer';
return button;
}
// Wait for the game details to load before creating the button
window.addEventListener('load', createF95ZoneButton);
// Listen for clicks on the F95Zone Forums button
document.addEventListener('click', function(event) {
if (event.target.textContent === 'Search on F95Zone Forums') {
event.preventDefault();
const gameTitle = document.querySelector('.apphub_AppName').innerText.trim();
const f95zoneForumLink = `https://f95zone.to/search/?q=${encodeURIComponent(gameTitle)}`;
window.location.href = f95zoneForumLink;
}
});
})();