您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
// ==UserScript== // @name SteamCN Remember Last Search Mode // @namespace maboroshi // @version 0.3 // @description try to take over the world! // @author maboroshi // @match *://steamcn.com/* // @require https://greasemonkey.github.io/gm4-polyfill/gm4-polyfill.js // @grant GM.getValue // @grant GM_getValue // @grant GM.setValue // @grant GM_setValue // ==/UserScript== (async function () { 'use strict'; let ModeNamePairs = { 'forum': '帖子', 'user': '用户', 'google': 'Google', 'baidu': '百度', }; for (let mode in ModeNamePairs) { AddEvent(mode); } let Steamcn_LastMode = await GM.getValue('Steamcn_LastMode', 'baidu'); document.querySelector('.search-bar-form .dropdown .btn span:first-child').textContent = ModeNamePairs[Steamcn_LastMode]; document.querySelector('.search-bar-form input[name="mod"]').value = Steamcn_LastMode; function AddEvent(mode) { document.querySelector(`a[data-mod="${mode}"]`).addEventListener('click', () => GM.setValue('Steamcn_LastMode', mode)); } })();