// ==UserScript== // @name PokéFarm Original Trainer Revealer // @author NE0NYAN // @homepageURL https://github.com/NE0NYAN/PokeFarm-OT-Revealer // @downloadURL https://raw.githubusercontent.com/NE0NYAN/PokeFarm-OT-Revealer/refs/heads/main/PFQ-OT-Revealer.js // @updateURL https://raw.githubusercontent.com/NE0NYAN/PokeFarm-OT-Revealer/refs/heads/main/PFQ-OT-Revealer.js // @description Adds the Original Trainer (OT) to a Pokémon's Summary Page // @version 1.0.0 // @match https://pokefarm.com/summary/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js // ==/UserScript== /* How to find the OT of a Pokemon: - The first time they are traded, the SENDER is the OT. - If they have not been traded, the HATCHER is the OT. - If they are in the Shelter, they have NO OT. */ (function () { "use strict"; // ---------------------------------------------------------------------------------------------------- // // Tell ESLint that jQuery's $ is defined elsewhere /* global $ */ // Getting the OT const timelineEntries = $("#timeline").children('li'); const pokemonSummaryTitle = $("#content > h1"); let tradedEntries = []; let lastTraded = null; let hasOT = true; let linkToRead = null; let userName = null; // Iterate through each list item in the timeline and make a list of times the pokemon was traded $.each(timelineEntries, function (index, value) { let text = $(this).html(); if (text.includes("Traded")) { tradedEntries.push("Timeline Entry " + index + ": " + text); } }); // Check if Pokemon has an OT or not (tradedEntries.length == 0) ? hasOT = false : hasOT = true; if (hasOT == true) { // Get the oldest entry where this pokemon was traded if (tradedEntries.length != 0) { lastTraded = tradedEntries[tradedEntries.length - 1]; } // Get traded from username userName = (lastTraded.split(`from`).pop().split(`" class=`)[0]).split(` p:contains('Parents')"); const otText = `

Original Trainer: ${userName}

`; insertLocation.before(otText); })();