Switch Playfield to use Fetch instead of XMLHTTPRequest
This commit is contained in:
parent
9d7b375994
commit
c39b37bfbd
@ -11,18 +11,17 @@ document.title = "Playfield|" + window.location.pathname.split('/')[2];
|
|||||||
interact.dynamicDrop(true);
|
interact.dynamicDrop(true);
|
||||||
|
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
let xhr = new XMLHttpRequest();
|
fetch("deck.json")
|
||||||
xhr.addEventListener("load", () => {
|
.then(data => data.json())
|
||||||
deckJSON = JSON.parse(xhr.responseText);
|
.then(json => {
|
||||||
deckNum = Object.keys(deckJSON.CustomDeck)[0];
|
deckJSON = json;
|
||||||
piles.deck = deckJSON.DeckIDs.map(c => c - deckNum * 100);
|
deckNum = Object.keys(deckJSON.CustomDeck)[0];
|
||||||
cardCount = piles.deck.length;
|
piles.deck = deckJSON.DeckIDs.map(c => c - deckNum * 100);
|
||||||
shuffle(piles.deck);
|
cardCount = piles.deck.length;
|
||||||
deckWidth = deckJSON.CustomDeck[deckNum].NumWidth;
|
shuffle(piles.deck);
|
||||||
deckHeight = deckJSON.CustomDeck[deckNum].NumHeight;
|
deckWidth = deckJSON.CustomDeck[deckNum].NumWidth;
|
||||||
});
|
deckHeight = deckJSON.CustomDeck[deckNum].NumHeight;
|
||||||
xhr.open("GET", "deck.json");
|
});
|
||||||
xhr.send();
|
|
||||||
|
|
||||||
window.addEventListener("contextmenu", event => event.preventDefault());
|
window.addEventListener("contextmenu", event => event.preventDefault());
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user