您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Updates selected Pokémon when toggling "Only show imported sets".
当前为
// ==UserScript== // @name Import Only Init // @namespace http://greasyfork.icu/en/users/1357767-indigeau // @version 0.0 // @description Updates selected Pokémon when toggling "Only show imported sets". // @match https://calc.pokemonshowdown.com/* // @author indigeau // @license GNU GPLv3 // @icon https://www.google.com/s2/favicons?sz=64&domain=pokemonshowdown.com // @grant none // ==/UserScript== // The default imported mon const option = {}; // Setup toggle listeners for (const target of document.querySelectorAll('#importedSets')) { const root = target.parentElement.parentElement; target.addEventListener('change', () => { const id = target.checked ? `${option.species} (${option.id})` : window.getFirstValidSetOption().id; $(root.querySelector('input.set-selector')).val(id).change(); root.querySelector('.select2-chosen').innerText = id; }); } // Set default imported mon const setOption = (sets) => { for (const species of Object.keys(sets)) { if (!option.species || option.species > species) { option.species = species; option.id = Object.keys(sets[species])[0]; } } }; // Update default imported mon when new sets are added window.updateDex = (() => { const update = window.updateDex; return (sets) => { update(sets); setOption(sets); }; })(); // Initialise default imported mon using saved sets if (localStorage.customsets) { setOption(JSON.parse(localStorage.customsets)); } /* global $ */