Filter rentals on PeakMonsters - A small helper for splinterland rentals

in #splinterlands3 years ago (edited)

Unfortunately it is not possible to filter the cards within the "setup rent fees popup" based on a minimum rental price. Since I do not want to go through hundreds of cards by hand, I have written a small tampermonkey script which takes over this task.

<h2>userscript <pre><code>// ==UserScript== // @name filter-rental-cards // @namespace http://tampermonkey.net/ // @version 0.1 // @description filter rentals // @author @snackaholic // @match https://peakmonsters.com/@YOURUSENAME/cards // @icon https://www.google.com/s2/favicons?domain=peakmonsters.com // @grant none // ==/UserScript== (function() { 'use strict'; function addLimitInput() { var element = document.createElement('input'); element.style.cssText = ` position: absolute; z-index: 9999; `; element.placeholder = "enter limit"; element.id = "filterlimit"; document.body.prepend(element); } function addFilterButton() { var buttonone = document.createElement('button'); buttonone.addEventListener('click', function (event) { filterUnrentable(); }); buttonone.textContent = ("filter unrentable cards"); buttonone.style.cssText = ` position: absolute; z-index: 9999; left:200px;`; document.body.prepend(buttonone); } function filterUnrentable() { let inputs = document.querySelectorAll(".card-popup-line input"); let filterlimit = parseFloat(document.getElementById("filterlimit").value) || 0.1; for (let i = 0; i < inputs.length; i++) { let input = inputs[i]; let textValue = parseFloat(input.value); if (textValue <= filterlimit || textValue == 0) { input.parentElement.parentElement.querySelectorAll("button")[2].click(); } } } addLimitInput(); addFilterButton(); })(); <p dir="auto">All you need to get this running is the browser extension tampermonkey. Also you have to adjust the line <code>// @match https://peakmonsters.com/@YOURUSENAME/cards, where you replace YOURUSERNAME to your actual username, so that the script is activated when you look at your card collection. <p dir="auto">If u have installed tampermonkey and the script, go to peakmonsters, select the cards that you want to rental and load the current market price. After that use the textfield to filter the selection based on the minimum target price. <p dir="auto"><img src="https://images.hive.blog/DQmZg7siwkSSeCYNy7VFZt7oSsGoqQBCTS9daThb4xwNCxq/filter-selection.gif" alt="filter-selection.gif" /> <p dir="auto">Let me know if you find this useful. Also if you have any questions about it, feel free to post them in the comments. If you need a different kind of script, feel free to write it in the comments aswell. <p dir="auto">Cheers