From 06919cc0b6a7af842031a7ba7ba09a45d9fa0e26 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 25 Feb 2024 15:01:25 +0000 Subject: [PATCH] Fix bookmarklet --- README.md | 4 ++-- web/bookmarklet.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4597bf7a..b27ed485 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Visit the [live site](https://expitau.github.io/InfiniteCraftWiki/) to see it in This site has support for importing your crafted elements from Infinite Craft. To do this, go to https://neal.fun/infinite-craft/, right click -> Inspect element -> Console, and paste the following code: ```javascript -fetch("https://raw.githubusercontent.com/expitau/InfiniteCraftWiki/main/data.json").then(res => res.json()).then(data => { index = Object.fromEntries(Object.entries(data.index).map(x => [x[1][1], x[0]])); window.location.href = `https://expitau.github.io/InfiniteCraftWiki?s=${JSON.parse(localStorage.getItem('infinite-craft-data')).elements.map(a => index[a.text]).filter(x => x).join(",")}` }) +fetch("https://raw.githubusercontent.com/expitau/InfiniteCraftWiki/main/data/data.json").then(res => res.json()).then(data => { index = Object.fromEntries(Object.entries(data.index).map(x => [x[1][1], x[0]])); window.location.href = `https://expitau.github.io/InfiniteCraftWiki?s=${JSON.parse(localStorage.getItem('infinite-craft-data')).elements.map(a => index[a.text]).filter(x => x).join(",")}` }) ``` This will automatically redirect and load your data. @@ -36,7 +36,7 @@ The data is stored in a JSON file, with two keys "index" and "data". The "index" (This corresponds to three recipes, Wind + Earth = Dust, Fire + Earth = Lava, and Fire + Fire = Volcano. The costs are the minimal costs for each item.) -See [data.json](data.json) for the current data, and the bottom of [index.html](index.html) for a way to parse it into a dictionary of recipes and backlinks. +See [data.json](data/data.json) for the current data, and the bottom of [index.html](index.html) for a way to parse it into a dictionary of recipes and backlinks. ## Acknowledgements - [Neal Agarwal](https://neal.fun/) for creating Infinite Craft diff --git a/web/bookmarklet.js b/web/bookmarklet.js index 57df8e5c..df33a12e 100644 --- a/web/bookmarklet.js +++ b/web/bookmarklet.js @@ -1 +1 @@ -fetch("https://raw.githubusercontent.com/expitau/InfiniteCraftWiki/main/data.json").then(res => res.json()).then(data => { index = Object.fromEntries(Object.entries(data.index).map(x => [x[1][1], x[0]])); window.location.href = `https://expitau.github.io/InfiniteCraftWiki?s=${JSON.parse(localStorage.getItem('infinite-craft-data')).elements.map(a => index[a.text]).filter(x => x).join(",")}` }) +fetch("https://raw.githubusercontent.com/expitau/InfiniteCraftWiki/main/data/data.json").then(res => res.json()).then(data => { index = Object.fromEntries(Object.entries(data.index).map(x => [x[1][1], x[0]])); window.location.href = `https://expitau.github.io/InfiniteCraftWiki?s=${JSON.parse(localStorage.getItem('infinite-craft-data')).elements.map(a => index[a.text]).filter(x => x).join(",")}` })