mirror of
https://forge.murkfall.net/bluesaxman/deckard.git
synced 2026-03-13 02:34:20 -06:00
added example deck and added import function
This commit is contained in:
16
index.html
16
index.html
@@ -8,12 +8,26 @@
|
||||
Welcome to Deckcard
|
||||
</body>
|
||||
<script>
|
||||
function generateDeck(DDF) {
|
||||
var cards = [""];
|
||||
for (var attribute in DDF) {
|
||||
var tempcards = [];
|
||||
cards.forEach( function (current) {
|
||||
DDF[attribute].forEach( function (value) {
|
||||
tempcards.push(current+value);
|
||||
} );
|
||||
} );
|
||||
cards = tempcards.slice();
|
||||
}
|
||||
return cards;
|
||||
}
|
||||
|
||||
var menu = elementPlace("body","menu",null,"div");
|
||||
buttonAdd("#menu","upload","Upload Deck", function () {
|
||||
popupDialog("deckLoader","Select Deck definition File",true,inputDialog,{"inputType":"file"},function (f) {
|
||||
var myFile = new FileReader();
|
||||
myFile.onload = function (file) {
|
||||
window.deck = file.target.result;
|
||||
window.deck = generateDeck(JSON.parse(file.target.result));
|
||||
}
|
||||
myFile.readAsText(f[0]);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user