Quickly Donwload Decks from starcitygames
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Quickly Donwload Decks from starcitygames
by DonRagout » 03 Nov 2015, 12:46
Hi,
i created a little javascript snippet to quickly create forge decks out of starcitygames deck listings. Because i am new i can't post the code to the example page. just go to starcitygames and append "/article/29003_JaliraPOW.html" to the url.
it only works for commander decks because these are the ones i use the most.
Here's what it does (see screenshot for details):
It uses the title "Jalira, Master Polymorphist" as the deckname and also as the commander. The format is selected from the upper right banner.
then all the cards are selected. If a card has the same name as the title it is kicked out because this card is already our commander.
Known Bugs:
If the title is not the exact commander name, then your deck will have an invalid commander and too many cards.
When i find the time i will extend the script to support other formats and sites.
any feedback is welcome.
i created a little javascript snippet to quickly create forge decks out of starcitygames deck listings. Because i am new i can't post the code to the example page. just go to starcitygames and append "/article/29003_JaliraPOW.html" to the url.
it only works for commander decks because these are the ones i use the most.
Here's what it does (see screenshot for details):
It uses the title "Jalira, Master Polymorphist" as the deckname and also as the commander. The format is selected from the upper right banner.
then all the cards are selected. If a card has the same name as the title it is kicked out because this card is already our commander.
- Code: Select all
$('.deck_listing').each(function(){
var title = $('.deck_title',$(this)).text();
var fortmat = $('.deck_format',$(this)).text();
var cards = "";
$('ul[rel] li',$(this)).each(function(){
if($(this).text().indexOf(title)<0)
cards += $(this).text() + "\n";
});
download("starcity_" + title + ".dck", "[metadata]\nName=starcity_" + title + " \n[general]\nConstructed \n[commander]\n1 " + title + " \n[main]\n" + cards+"\n[sideboard]");
});
function download(filename, text) {
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
element.setAttribute('download', filename);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
Known Bugs:
If the title is not the exact commander name, then your deck will have an invalid commander and too many cards.
When i find the time i will extend the script to support other formats and sites.
any feedback is welcome.
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 28 guests