-
-
Save dithpri/d443d2873a4b6212fc0b32894ce15707 to your computer and use it in GitHub Desktop.
Userscript for NationStates trading cards – automatically inputs a default value in the ask/bid fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Card Default Prices | |
// @version 0.1 | |
// @namespace dithpri | |
// @description Automatically inputs a default value in the ask/bid fields | |
// @author dithpri | |
// @noframes | |
// @match https://www.nationstates.net/*page=deck*/card=* | |
// @match https://www.nationstates.net/*card=*/page=deck* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Change values here: | |
const default_prices = { | |
"common": {ask: 0.01, bid: 0.01}, | |
"uncommon": {ask: 0.05, bid: 0.05}, | |
"rare": {ask: 0.10, bid: 0.10}, | |
"ultra-rare": {ask: 0.20, bid: 0.20}, | |
"epic": {ask: 0.50, bid: 0.50}, | |
"legendary": {ask: 1.00, bid: 1.00} | |
}; | |
const rarity = document.querySelector(".deckcard-season-list-card-selected > .deckcard-token").textContent.toLowerCase(); | |
document.querySelector("input[name=\"auction_ask\"").value = default_prices[rarity].ask.toFixed(2); | |
document.querySelector("input[name=\"auction_bid\"").value = default_prices[rarity].bid.toFixed(2); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment