added example deck and added import function
This commit is contained in:
parent
11fe602f70
commit
ea37f2f436
16
index.html
16
index.html
@ -8,12 +8,26 @@
|
|||||||
Welcome to Deckcard
|
Welcome to Deckcard
|
||||||
</body>
|
</body>
|
||||||
<script>
|
<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");
|
var menu = elementPlace("body","menu",null,"div");
|
||||||
buttonAdd("#menu","upload","Upload Deck", function () {
|
buttonAdd("#menu","upload","Upload Deck", function () {
|
||||||
popupDialog("deckLoader","Select Deck definition File",true,inputDialog,{"inputType":"file"},function (f) {
|
popupDialog("deckLoader","Select Deck definition File",true,inputDialog,{"inputType":"file"},function (f) {
|
||||||
var myFile = new FileReader();
|
var myFile = new FileReader();
|
||||||
myFile.onload = function (file) {
|
myFile.onload = function (file) {
|
||||||
window.deck = file.target.result;
|
window.deck = generateDeck(JSON.parse(file.target.result));
|
||||||
}
|
}
|
||||||
myFile.readAsText(f[0]);
|
myFile.readAsText(f[0]);
|
||||||
})
|
})
|
||||||
|
22
standardfaces.ddf
Normal file
22
standardfaces.ddf
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{"value":[
|
||||||
|
"A",
|
||||||
|
"2",
|
||||||
|
"3",
|
||||||
|
"4",
|
||||||
|
"5",
|
||||||
|
"6",
|
||||||
|
"7",
|
||||||
|
"8",
|
||||||
|
"9",
|
||||||
|
"10",
|
||||||
|
"J",
|
||||||
|
"Q",
|
||||||
|
"K"],
|
||||||
|
"shape":[
|
||||||
|
"round",
|
||||||
|
"sharp"],
|
||||||
|
"color":[
|
||||||
|
"red",
|
||||||
|
"black"
|
||||||
|
]}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user