Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move DeckType into cards #11

Open
wants to merge 1 commit into
base: gh-pages
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions cards.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@

var cards = (function() {
const DeckType = Object.freeze({
STANDARD: 0,
EUCHRE: 1,
PINOCHLE: 2
});

//The global options
var opt = {
cardSize: {
Expand All @@ -14,7 +20,7 @@ var cards = (function() {
cardsUrl: 'img/cards.png',
blackJoker: false,
redJoker: false,
type: STANDARD,
type: DeckType.STANDARD,
loop: 1
};
var zIndexCounter = 1;
Expand All @@ -41,16 +47,16 @@ var cards = (function() {
}
}
switch (opt.type) {
case STANDARD:
case DeckType.STANDARD:
opt.acesHigh = false;
start = opt.acesHigh ? 2 : 1;
end = start + 12;
break;
case EUCHRE:
case DeckType.EUCHRE:
start = 9;
end = start + 5;
break;
case PINOCHLE:
case DeckType.PINOCHLE:
start = 9;
end = start + 5;
opt.loop = 2;
Expand Down Expand Up @@ -384,6 +390,7 @@ var cards = (function() {
Deck: Deck,
Hand: Hand,
Pile: Pile,
DeckType: DeckType,
shuffle: shuffle
};
})();
Expand Down
3 changes: 0 additions & 3 deletions deckType.js

This file was deleted.

1 change: 0 additions & 1 deletion example.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ <h1>Cards.js - Example</h1>
in the public domain.
</footer>
<!-- load this at the bottom so the #card-table element exists -->
<script src="deckType.js"></script>
<script src="cards.js"></script>
<script src="example.js"></script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion example.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

//Tell the library which element to use for the table
cards.init({table:'#card-table', type:STANDARD});
cards.init({table:'#card-table', type:cards.DeckType.STANDARD});

//Create a new deck of cards
deck = new cards.Deck();
Expand Down
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
}
</style>
<script src="jquery-1.7.min.js"></script>
<script src="deckType.js"></script>
<script src="cards.js"></script>
<script>
var exampleCounter = 1;
Expand Down