// ==UserScript== // @name [Pokeclicker] Catch Filter Fantasia // @namespace Pokeclicker Scripts // @author Ephenia (Credit: Pastaficionado, umamaistempo) // @description An experimental catch filter that aims to help you have much better control and will completely change how you capture Pokémon. // @copyright https://github.com/Ephenia // @license GPL-3.0 License // @version 1.9.3 // @homepageURL https://github.com/Ephenia/Pokeclicker-Scripts/ // @supportURL https://github.com/Ephenia/Pokeclicker-Scripts/issues // @match https://www.pokeclicker.com/ // @icon https://www.google.com/s2/favicons?domain=pokeclicker.com // @grant unsafeWindow // @run-at document-idle // @downloadURL https://update.greasyfork.icu/scripts/445823/%5BPokeclicker%5D%20Catch%20Filter%20Fantasia.user.js // @updateURL https://update.greasyfork.icu/scripts/445823/%5BPokeclicker%5D%20Catch%20Filter%20Fantasia.meta.js // ==/UserScript== const ballNames = ['None', 'Pokeball', 'Greatball', 'Ultraball', 'Masterball', 'Fastball', 'Quickball', 'Timerball', 'Duskball', 'Luxuryball', 'Diveball', 'Lureball', 'Nestball', 'Repeatball', 'Beastball']; var filterState; var filterTypes; var filterBallPref; var catchFilter; var filterColor; function initCatchFilter() { const pokeballDisplay = document.getElementById('pokeballSelector'); const profileModal = document.getElementById('profileModal'); filterState ? filterColor = true : filterColor = false; // Setting custon CSS styles addGlobalStyle('#catch-filter-btn { position: absolute; left: 0px; top: 0px; width: auto; height: 41px; }'); addGlobalStyle('#catch-filter-cont { display: flex; flex-direction: column; justify-content: center; }'); addGlobalStyle('#filter-results { cursor: pointer; }'); addGlobalStyle('#filter-results > div { display: flex; align-items: center; justify-content: center; min-height: 34px; }'); addGlobalStyle('#filter-results > div:hover { background-color: gold; }'); addGlobalStyle('.filter-pokeball-n { position: absolute; right: 25%; }'); addGlobalStyle('.filter-pokeball-s { position: absolute; right: 20%; }'); addGlobalStyle('.filter-shiny { position: absolute; right: 17%; }'); addGlobalStyle('#filter-btn-cont { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }'); addGlobalStyle('#filter-btn-cont > button { display: flex; justify-content: center; min-width: 107px; }'); addGlobalStyle('#filter-btn-tools { display: flex; flex-direction: row; justify-content: space-between; align-items: flex-end; column-gap: 10px; }'); // Creating the button to append to the Pokeballs container let frag = new DocumentFragment(); const btn = document.createElement('button'); btn.innerText = 'Filter' btn.setAttribute('id', 'catch-filter-btn') btn.setAttribute('class', 'btn btn-sm btn-primary'); btn.addEventListener('click', () => { $('#filterModal').modal('show') }) frag.appendChild(btn); pokeballDisplay.appendChild(frag); // Creating a modal for the catch filter const filterMod = document.createElement('div'); filterMod.setAttribute("class", "modal noselect fade show"); filterMod.setAttribute("id", "filterModal"); filterMod.setAttribute("tabindex", "-1"); filterMod.setAttribute("aria-labelledby", "filterModal"); filterMod.setAttribute("aria-labelledby", "filterModal"); filterMod.setAttribute("aria-modal", "true"); filterMod.setAttribute("role", "dialog"); filterMod.innerHTML = `