您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
If the URL contains the clickthrough=1 GET variable, then if there is an exact match for the search, click through to it to open the game's page. This is for use with search add-ons and search engine keyword functionality. 5/18/2023, 3:25:43 AM
当前为
// ==UserScript== // @name Steam Search - Click Through To Game // @namespace Violentmonkey Scripts // @match https://store.steampowered.com/search/ // @grant none // @version 1.0 // @author - // @description If the URL contains the clickthrough=1 GET variable, then if there is an exact match for the search, click through to it to open the game's page. This is for use with search add-ons and search engine keyword functionality. 5/18/2023, 3:25:43 AM // ==/UserScript== const urlParams = new URLSearchParams(window.location.search); title = urlParams.get("term"); if ((urlParams.get("clickthrough") === "1") && (title !== null) && (title !== '')) { // the parameter is set, let's find the link // escape double quotes in title title2 = title.replaceAll(/"/g, '\\"'); xpath = '//a[contains(@class, "search_result_row") and descendant::span[contains(@class, "title") and text()="'+ title2 +'"]]'; result = document.evaluate(xpath, document, null, XPathResult.ANY_TYPE, null); a = result.iterateNext(); // check that we have found exactly one such link. if there's more, don't do anything, let the person click through manually. if (a !== null && result.iterateNext() === null) { window.location.assign(a.href) } }