shenafu.com

Games and Entertainment => Games General => Magic: the Gathering => Topic started by: Den on 2008-Oct-27 11:42

Title: Autocard as Opera Extension and Userjs
Post by: Den on 2008-Oct-27 11:42
This is an Opera extension / userscript that I wrote that lets you view a card's image when you mouseover a link in Magic related sites, including wizards.com (http://www.wizards.com/Magic/) and their boards (http://community.wizards.com/go/forum/viewcategory/75842/Magic_The_Gathering), mtgsalvation (http://forums.mtgsalvation.com/), starcity (http://www.starcitygames.com/), crystalkeep (http://www.crystalkeep.com/magic/rules/search.php), and obviously this forum (http://shenafu.com/smf/index.php) and domain (www.shenafu.com (http://www.shenafu.com)).

As userScript:
autocard_mtg.user.js (http://www.shenafu.com/magic/autocard_mtg.user.js)
Last updated February 14, 2018, version 1.60

Get it from this link:
As Opera extension:
Install Autocard_MTG (https://addons.opera.com/addons/extensions/details/autocard_mtg/?display=en)
Last updated February 10, 2011, version 1.2

For Opera, save this script in userjs folder.
For Firefox, install Greasemonkey add-on. Click the link and install the script.

More information can be found at the following URL:
http://shenafu.com/magic/autocard_mtg.php (http://shenafu.com/magic/autocard_mtg.php)

Video demonstration of this script in action:

http://www.youtube.com/v/-yyZqtFcB2s&hl=en&fs=1

Test the script on the following card links by moving your mouse over them:
Lord of Atlantis
Apprentice MTGO
 Autocard tests
Lord of Atlantis
Mesa Pegasus
Demonfire
Fire/Ice
Fire
Ice
Dead Gone
Bound//Determined
Bound
Determined
Armed/Dangerous
Appeal//Authority
Appeal
Authority
Ludevic's Test Subject
Ludevic's Abomination
Aberrant Researcher
Perfected Form
Docent of Perfection
Final Iteration
Eternal Witness
Gaea's Skyfolk
Day of Judgement -- should be judgment, script autofixes certain misspellings
Kiki-Jiki, Mirror Breaker
Aerathi Berserker
Vedalken Æthermage
Looter il-Kor
Nath of the Gilt-Leaf
Lys Alana Scarblade
Circle of Protection: Artifacts
Rune_of_Protection:_Green
To Arms!
Temple Elder
Pang Tong, "Young Phoenix"
Riding Red Hare {Portals 3 Kingdoms}
Erase
Erase (Not the Urza's Legacy One)
Goblin S.W.A.T. Team
Land Aid `04
Look at Me, I'm R&D
Sauté
_____ {at least 5 long}
Question Elemental?
Richard Garfield, Ph.D.
Who/What/When/Where/Why
The Ultimate Nightmare of Wizards of the Coast(R) Customer Service
The Ultimate Nightmare of Wizards of the Coast® Customer Service
Super Secret Tech {Gotcha!}
why
BFM
BFM left
BFM right

Alias card names
Finkel
Bob
Tiago


Apprentice MTGO
 Upcoming Set Previews
Anticipate
Savage Ventmaw
Ojutai's Command
Foe-Razer Regent
Sidisi, Undead Vizier
--Reprints
Ultimate Price
Evolving Wilds

Apprentice MTGO
 Custom Cards that I Created
Double Striking
Double Dealing
Aqua-kin Flowmage
Atroex, Temporal Watcher
Title: Re: Autocard Userjs
Post by: Den on 2009-Aug-15 05:17
version 1.21
added support for puremtgo.com
reverted global functions
Title: Re: Autocard Userjs
Post by: Den on 2009-Nov-09 20:27
version 1.22
grave, acute, dumb quotes
Title: Re: Autocard Userjs
Post by: Den on 2010-Jan-04 15:10
version 1.23
wizards boards migrated, autocard link modified
Title: Re: Autocard Userjs
Post by: Den on 2010-Apr-19 03:08
version 1.24
added image URL to a script on my site so that one can find arts for cards that would be otherwise unavailable by default naming (eg newly spoiled cards or cards with aliases such as legends and planeswalkers)
Title: Re: Autocard Userjs
Post by: Den on 2010-Apr-25 01:52
version 1.25
added site MTG Vault
Title: Re: Autocard Userjs
Post by: Den on 2010-Oct-10 06:45
version 1.26
exclude sites that have their own pop up script (wizards.com, tcgplayer.com)
fixed link match for tcgplayer (in case one wants to re-include that site)
Title: Re: Autocard Userjs
Post by: Den on 2010-Oct-18 20:07
version 1.27
reinclude wizards.com, but disable native popup
Title: Re: Autocard Userjs
Post by: Den on 2010-Nov-02 12:05
version 1.28
include daccg.com
hide / show img using style.display rather than visibility or z-index
clean up event handling
Title: Re: Autocard Userjs
Post by: Den on 2010-Nov-04 00:21
version 1.29
modified attachment match pattern (from /attach/ to /attachment\.php/)
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2011-Jan-25 23:59
Converted into Opera extension. Need Opera 11.

Install Autocard_MTG (https://addons.opera.com/addons/extensions/details/autocard_mtg/?display=en)
Last updated February 10, 2011, version 1.2
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2011-Apr-20 02:29
1.30
fix back quotes and multiple underscore

1.31
replace magiccards.info/query URLs
Title: 1.32
Post by: Den on 2011-Jun-01 03:02
1.32
added card image directories
http://shenafu.com/images/mtg-cardname.jpg (http://shenafu.com/images/mtg-cardname.jpg)
http://shenafu.com/imgd/card2img/mtg-cardname.jpg (http://shenafu.com/imgd/card2img/mtg-cardname.jpg)

second URL scours net for image
Title: 1.33
Post by: ADMIN on 2011-Jun-07 12:20
1.33
copied over the code from extension because it performed much better.
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2011-Jun-17 00:44
1.34
firefox compatible
added cardnames with quotes to AUTOCARD_SPLIT because some sites do not escape the quotes correctly (e.g. crystalkeep)
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2011-Jun-30 03:33
1.35
fix for www.wizards.com (http://www.wizards.com) (match their new code; remove their mouseover code)
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2011-Jul-14 15:26
1.36
hide image on mouseover
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2011-Oct-15 00:00
1.37
Double-face cards show both faces
Changed replacement URL to http://magiccards.info/query?q= (http://magiccards.info/query?q=)
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2012-Apr-05 03:38
1.38
added regex to also match original card name
added regex for image URL to match cards made by amuseum in Shenafu's Card Creator
http://shenafu.com/imgd/ymtc/cardoriginal (http://shenafu.com/imgd/ymtc/cardoriginal) by amuseum.png
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2012-Jun-14 14:26
1.39
magiccards.info/query remove beginning %21 or !
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2012-Jul-01 17:23
1.40
added Dark Ascension transform cards.
fix commonly misspelled words (e.g. judgement -> judgment)

test transform cards
Apprentice MTGO
 Decklist
werewolf ransacker
chalice of death
markov's servant
withengar unbound
hinterland scourge
ravager of the fells
silverpelt werewolf
unhallowed cathar
tovolar's magehunter
archdemon of greed
moonscarred werewolf
ghastly haunting
krallenhorde killer

test misspelled words
Apprentice MTGO
 Decklist
day of judgement --judgment

1.41
fix transform no longer match cards that match part of the name (e.g. terror should not pop up terror of kruin pass).
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2012-Sep-14 20:03
1.43
fixed 'A' tags with child nodes steal events. so loop until parent node is 'A' or null.

1.44
now works with http://shenafu.com/imgd/card2img/mtg-cardoriginal.jpg (http://shenafu.com/imgd/card2img/mtg-cardoriginal.jpg) , where it takes unchanged card name
http://shenafu.com/imgd/card2img/mtg-cardname.jpg (http://shenafu.com/imgd/card2img/mtg-cardname.jpg) script finds cards at magiccards.info and scours the page for the image source

1.45
included mtgredzone.com
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2013-Mar-22 18:06
1.46
magiccards.info flip cards and double-face cards have 'a' and 'b' in URL: e.g. http://magiccards.info/dka/en/71a.html (http://magiccards.info/dka/en/71a.html) & http://magiccards.info/dka/en/71a.html (http://magiccards.info/dka/en/71a.html)

1.47
added site mtgcolorpie.com
change \u2019 (dumb quote) to apostrophe
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2013-May-03 20:57
1.48
added Dragon's Maze split cards
Apprentice MTGO
 test DGM splits
Turn
Burn
Turn//Burn
Turn/Burn
Turn_Burn
alive_well
armed_dangerous
beck_call
breaking_entering
catch_release
down_dirty
far_away
flesh_blood
give_take
profit_loss
protect_serve
ready_willing
toil_trouble
turn_burn
wear_tear
Title: Re: Autocard as Opera Extension and Userjs
Post by: ADMIN on 2014-Feb-05 02:51
1.49
added RegExp for new MTGSalvation (Curse) Forums
added CSS Style Sheet to suppress websites' own autocard popup

TODO: fix StarCity Games
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2014-Mar-14 00:05
1.50
added site www.ultimatemtgo.com (http://www.ultimatemtgo.com)
save as UTF-8 encoding

1.51
enable AUTOCARD_IMG_RE for http://shenafu.com/imgd/card2img/mtg-cardoriginal.jpg, (http://shenafu.com/imgd/card2img/mtg-cardoriginal.jpg,) which finds images from various 3rd party sites besides wizards.com
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2014-Sep-01 20:34
1.52
included http://mtgsalvation.gamepedia.com/ (http://mtgsalvation.gamepedia.com/)* (MTG Wiki moved here)
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2015-Mar-10 23:31
1.53
scrape Wizards.com spoiled cards for upcoming set
http://magic.wizards.com/en/articles/archive/card-image-gallery/ (http://magic.wizards.com/en/articles/archive/card-image-gallery/)$SETNAME
(need to modify imgd/card2img2.php for every new set)

1.54
fix infinite loop in Firefox (img.complete buggy in FF)
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2015-Aug-13 18:36
1.55
added Magic Origins double faced cards

Apprentice MTGO
 Decklist
Kytheon, Hero of Akros
Jace, Vryn's Prodigy
Liliana, Heretical Healer
Chandra, Fire of Kaladesh
Nissa, Vastwood Seer
Gideon, Battle-Forged
Jace, Telepath Unbound
Liliana, Defiant Necromancer
Chandra, Roaring Flame
Nissa, Sage Animist

1.56
debug mode option
debug log as fixed P element
debug mode logs imgs[cardname] (all URLs under that cardname)
include file://localhost/
move gatherer.wizards.com to last
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2016-Apr-05 23:05
1.57
included site slightlymagic.net (software development forums and wiki, including Forge)

1.58
added Shadows over Innistrad DFCs
move gatherer.wizards.com to 2nd
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2018-Feb-13 15:39
1.59
alter to https as necessary
removed nonexistent domains

TODO:
fix sites: mtgsalvation.com, yawgatog.com, goblinartisans.blogspot.com, magic-league.com


1.60
fixed scraping from magiccards.info
added split cards from Amonkhet, Hour of Devastation
added transform cards from Eldritch Moon
Apprentice MTGO
 Split Cards
// Amonkhet
Commit
Memory
Cut
Ribbons
Destined
Lead
Dusk
Dawn
Failure
Comply
Heaven
Earth
Insult
Injury
Mouth
Feed
Never
Return
Onward
Victory
Prepare
Fight
Rags
Riches
Reduce
Rubble
Spring
Mind
Start
Finish
// Hour of Devastation
Appeal
Authority
Claim
Fame
Consign
Oblivion
Driven
Despair
Farm
Market
Grind
Dust
Leave
Chance
Reason
Believe
Refuse
Cooperate
Struggle
Survive

Apprentice MTGO
 Transform cards
// Front
Extricator of Sin
Lone Rider
Curious Homunculus
Docent of Perfection
Grizzled Angler
Voldaren Pariah
Conduit of Storms
Smoldering Werewolf
Vildin-Pack Outcast
Kessig Prowler
Shrill Howler
Tangleclaw Werewolf
Ulvenwald Captive
Ulrich of the Krallenhorde
Cryptolith Fragment
Bruna, the Fading Light
Gisela, the Broken Blade
Graf Rats
Midnight Scavengers
Hanweir Garrison
Hanweir Battlements
// Back
Extricator of Flesh
It That Rides as One
Voracious Reader
Final Iteration
Grisly Anglerfish
Abolisher of Bloodlines
Conduit of Emrakul
Erupting Dreadwolf
Dronepack Kindred
Sinuous Predator
Howling Chorus
Fibrous Entangler
Ulvenwald Abomination
Ulrich, Uncontested Alpha
Aurora of Emrakul
Brisela, Voice of Nightmares
Brisela, Voice of Nightmares
Chittering Host
Chittering Host
Hanweir, the Writhing Township
Hanweir, the Writhing Township
Title: Re: Autocard as Opera Extension and Userjs
Post by: Den on 2018-Sep-13 19:08
1.61
included site scryfall.com
scrape using scryfall API (https://scryfall.com/docs/api)
added transform cards from Ixalan block

Apprentice MTGO
 Transform cards
// front
Legion's Landing
Search for Azcanta
Arguel's Blood Fast
Hadana's Climb
Journey to Eternity
Path of Mettle
Profane Procession
Storm the Vault
Vance's Blasting Cannons
Azor's Gateway
Golden Guardian
Growing Rites of Itlimoc
Conqueror's Galleon
Dowsing Dagger
Primal Amulet
Thaumatic Compass
Treasure Map
// back
Adanto, the First Fort
Azcanta, the Sunken Ruin
Temple of Aclazotz
Winged Temple of Orazca
Atzal, Cave of Eternity
Metzali, Tower of Triumph
Tomb of the Dusk Rose
Vault of Catlacan
Spitfire Bastion
Sanctum of the Sun
Gold-Forge Garrison
Itlimoc, Cradle of the Sun
Conqueror's Foothold
Lost Vale
Primal Wellspring
Spires of Orazca
Treasure Cove