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