Created
April 22, 2018 13:18
-
-
Save mharris717/7e439d1b4f2697d578ebc4c407a2206d to your computer and use it in GitHub Desktop.
Draftaholics Rarity Script
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
var rarities = {"Plains":"Basic Land","Island":"Basic Land","Swamp":"Basic Land","Mountain":"Basic Land","Forest":"Basic Land","Serra Angel":"Uncommon","Llanowar Elves":"Common","Juggernaut":"Uncommon","Icy Manipulator":"Uncommon","Goblin Warchief":"Uncommon","Gaea's Blessing":"Uncommon","Verdant Force":"Rare","Skirk Prospector":"Common","Aesthir Glider":"Common","Siege-Gang Commander":"Rare","Gilded Lotus":"Rare","Divination":"Common","Fire Elemental":"Common","Opt":"Common","Tragic Poet":"Common","Rescue":"Common","Thorn Elemental":"Uncommon","Syncopate":"Common","Meandering River":"Common","Timber Gorge":"Common","Isolated Chapel":"Rare","Nature's Spiral":"Uncommon","Clifftop Retreat":"Rare","Hinterland Harbor":"Rare","Sulfur Falls":"Rare","Woodland Cemetery":"Rare","Skizzik":"Uncommon","Gideon's Reproach":"Common","Sage of Lat-Nam":"Uncommon","Karn, Scion of Urza":"Mythic Rare","Adamant Will":"Common","Aven Sentry":"Common","Baird, Steward of Argive":"Uncommon","Benalish Honor Guard":"Common","Benalish Marshal":"Rare","Blessed Light":"Common","Board the Weatherlight":"Uncommon","Call the Cavalry":"Common","Charge":"Common","D'Avenant Trapper":"Common","Danitha Capashen, Paragon":"Uncommon","Daring Archaeologist":"Rare","Dauntless Bodyguard":"Uncommon","Dub":"Common","Evra, Halcyon Witness":"Rare","Excavation Elephant":"Common","Fall of the Thran":"Rare","Healing Grace":"Common","History of Benalia":"Mythic Rare","Invoke the Divine":"Common","Knight of Grace":"Uncommon","Knight of New Benalia":"Common","Kwende, Pride of Femeref":"Uncommon","Lyra Dawnbringer":"Mythic Rare","Mesa Unicorn":"Common","On Serra's Wings":"Uncommon","Pegasus Courser":"Common","Sanctum Spirit":"Uncommon","Seal Away":"Uncommon","Sergeant-at-Arms":"Common","Serra Disciple":"Common","Shalai, Voice of Plenty":"Rare","Teshar, Ancestor's Apostle":"Rare","Triumph of Gerrard":"Uncommon","Urza's Ruinous Blast":"Rare","Academy Drake":"Common","Academy Journeymage":"Common","The Antiquities War":"Rare","Arcane Flight":"Common","Artificer's Assistant":"Common","Befuddle":"Common","Blink of an Eye":"Common","Cloudreader Sphinx":"Common","Cold-Water Snapper":"Common","Curator's Ward":"Uncommon","Deep Freeze":"Common","Diligent Excavator":"Uncommon","Homarid Explorer":"Common","In Bolas's Clutches":"Uncommon","Karn's Temporal Sundering":"Rare","Merfolk Trickster":"Uncommon","The Mirari Conjecture":"Rare","Naban, Dean of Iteration":"Rare","Naru Meha, Master Wizard":"Mythic Rare","Precognition Field":"Rare","Relic Runner":"Common","Sentinel of the Pearl Trident":"Uncommon","Slinn Voda, the Rising Deep":"Uncommon","Tempest Djinn":"Rare","Tetsuko Umezawa, Fugitive":"Uncommon","Time of Ice":"Uncommon","Tolarian Scholar":"Common","Unwind":"Common","Vodalian Arcanist":"Common","Weight of Memory":"Uncommon","Wizard's Retort":"Uncommon","Zahid, Djinn of the Lamp":"Rare","Blessing of Belzenlok":"Common","Cabal Evangel":"Common","Cabal Paladin":"Common","Caligo Skin-Witch":"Common","Cast Down":"Uncommon","Chainer's Torment":"Uncommon","Dark Bargain":"Common","Deathbloom Thallid":"Common","Demonic Vigor":"Common","Demonlord Belzenlok":"Mythic Rare","Divest":"Common","Dread Shade":"Rare","Drudge Sentinel":"Common","The Eldest Reborn":"Uncommon","Eviscerate":"Common","Feral Abomination":"Common","Final Parting":"Uncommon","Fungal Infection":"Common","Josu Vess, Lich Knight":"Rare","Kazarov, Sengir Pureblood":"Rare","Knight of Malice":"Uncommon","Lich's Mastery":"Rare","Lingering Phantom":"Uncommon","Phyrexian Scriptures":"Mythic Rare","Rat Colony":"Common","Rite of Belzenlok":"Rare","Settle the Score":"Uncommon","Soul Salvage":"Common","Stronghold Confessor":"Common","Thallid Omnivore":"Common","Thallid Soothsayer":"Uncommon","Torgaar, Famine Incarnate":"Rare","Urgoros, the Empty One":"Uncommon","Vicious Offering":"Common","Whisper, Blood Liturgist":"Uncommon","Windgrace Acolyte":"Common","Yargle, Glutton of Urborg":"Uncommon","Yawgmoth's Vile Offering":"Rare","Bloodstone Goblin":"Common","Champion of the Flame":"Uncommon","Fervent Strike":"Common","Fiery Intervention":"Common","Fight with Fire":"Uncommon","Firefist Adept":"Uncommon","The First Eruption":"Rare","The Flame of Keld":"Uncommon","Frenzied Rage":"Common","Ghitu Chronicler":"Common","Ghitu Journeymage":"Common","Ghitu Lavarunner":"Common","Goblin Barrage":"Uncommon","Goblin Chainwhirler":"Rare","Haphazard Bombardment":"Rare","Jaya Ballard":"Mythic Rare","Jaya's Immolating Inferno":"Rare","Keldon Overseer":"Common","Keldon Raider":"Common","Keldon Warcaller":"Common","Orcish Vandal":"Uncommon","Radiating Lightning":"Common","Rampaging Cyclops":"Common","Run Amok":"Common","Seismic Shift":"Common","Shivan Fire":"Common","Squee, the Immortal":"Rare","Two-Headed Giant":"Rare","Valduk, Keeper of the Flame":"Uncommon","Verix Bladewing":"Mythic Rare","Warcry Phoenix":"Uncommon","Warlord's Fury":"Common","Wizard's Lightning":"Uncommon","Adventurous Impulse":"Common","Ancient Animus":"Common","Arbor Armament":"Common","Baloth Gorger":"Common","Broken Bond":"Common","Corrosive Ooze":"Common","Elfhame Druid":"Uncommon","Fungal Plots":"Uncommon","Gaea's Protector":"Common","Gift of Growth":"Common","Grow from the Ashes":"Common","Grunn, the Lonely King":"Uncommon","Kamahl's Druidic Vow":"Rare","Krosan Druid":"Common","Llanowar Envoy":"Common","Llanowar Scout":"Common","Mammoth Spider":"Common","Marwyn, the Nurturer":"Rare","The Mending of Dominaria":"Rare","Multani, Yavimaya's Avatar":"Mythic Rare","Pierce the Sky":"Common","Primordial Wurm":"Common","Saproling Migration":"Common","Song of Freyalise":"Uncommon","Spore Swarm":"Uncommon","Sporecrown Thallid":"Uncommon","Steel Leaf Champion":"Rare","Sylvan Awakening":"Rare","Territorial Allosaurus":"Rare","Untamed Kavu":"Uncommon","Wild Onslaught":"Uncommon","Yavimaya Sapherd":"Common","Adeliz, the Cinder Wind":"Uncommon","Arvad the Cursed":"Uncommon","Aryel, Knight of Windgrace":"Rare","Darigaaz Reincarnated":"Mythic Rare","Garna, the Bloodflame":"Uncommon","Grand Warlord Radha":"Rare","Hallar, the Firefletcher":"Uncommon","Jhoira, Weatherlight Captain":"Mythic Rare","Jodah, Archmage Eternal":"Rare","Muldrotha, the Gravetide":"Mythic Rare","Oath of Teferi":"Rare","Primevals' Glorious Rebirth":"Rare","Raff Capashen, Ship's Mage":"Uncommon","Rona, Disciple of Gix":"Uncommon","Shanna, Sisay's Legacy":"Uncommon","Slimefoot, the Stowaway":"Uncommon","Tatyova, Benthic Druid":"Uncommon","Teferi, Hero of Dominaria":"Mythic Rare","Tiana, Ship's Caretaker":"Uncommon","Amaranthine Wall":"Uncommon","Blackblade Reforged":"Rare","Bloodtallow Candle":"Common","Damping Sphere":"Uncommon","Forebear's Blade":"Rare","Guardians of Koilos":"Common","Helm of the Host":"Rare","Howling Golem":"Uncommon","Jhoira's Familiar":"Uncommon","Jousting Lance":"Common","Mishra's Self-Replicator":"Rare","Mox Amber":"Mythic Rare","Navigator's Compass":"Common","Pardic Wanderer":"Common","Powerstone Shard":"Common","Shield of the Realm":"Uncommon","Short Sword":"Common","Skittering Surveyor":"Common","Sorcerer's Wand":"Uncommon","Sparring Construct":"Common","Thran Temporal Gateway":"Rare","Traxos, Scourge of Kroog":"Rare","Urza's Tome":"Uncommon","Voltaic Servant":"Common","Weatherlight":"Mythic Rare","Cabal Stronghold":"Rare","Memorial to Folly":"Uncommon","Memorial to Genius":"Uncommon","Memorial to Glory":"Uncommon","Memorial to Unity":"Uncommon","Memorial to War":"Uncommon","Zhalfirin Void":"Uncommon","Teferi, Timebender":"Mythic Rare","Temporal Machinations":"Common","Niambi, Faithful Healer":"Rare","Teferi's Sentinel":"Uncommon","Chandra, Bold Pyromancer":"Mythic Rare","Chandra's Outburst":"Rare","Karplusan Hound":"Uncommon","Pyromantic Pilgrim":"Common","Firesong and Sunspeaker":"Rare"} | |
function setupRows() { | |
rows = jQuery(".a-brunchy-result-set table tr") | |
for (let row of rows) { | |
let card = jQuery(row).find('td')[2].innerText | |
let key = card.replace('’',"'").replace('“','"').replace('”','"') | |
let rarity = rarities[key] || 'unknown' | |
jQuery(row).append(`<td>${rarity}</td>`) | |
jQuery(row).addClass(rarity.toLowerCase().replace(" ","")) | |
} | |
} | |
function toggleRarity(rarity) { | |
let key = rarity.toLowerCase().replace(" ","") | |
jQuery(".a-brunchy-result-set table tr." + key).toggle() | |
} | |
function addButton(rarity) { | |
let link = jQuery(`<button>${rarity}</button>`) | |
link.click((e) => { | |
toggleRarity(rarity) | |
e.preventDefault() | |
}) | |
jQuery(".page-layout-text").prepend(link) | |
} | |
setupRows() | |
for (let rarity of ['Common','Uncommon','Rare','Mythic Rare']) { | |
addButton(rarity) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment