|
//infiniteAdd by Antonabi (https://gist.github.com/Antonabi/98de19b4c41fd62efa09e12a1f7ebc17) |
|
// _ __ _ _ _ _ _ _ |
|
//(_) _ __ / _|(_) _ __ (_)| |_ ___ / \ __| | __| | |
|
//| || '_ \ | |_ | || '_ \ | || __| / _ \ / _ \ / _` | / _` | |
|
//| || | | || _|| || | | || || |_ | __/ / ___ \ | (_| || (_| | |
|
//|_||_| |_||_| |_||_| |_||_| \__| \___|/_/ \_\ \__,_| \__,_| |
|
// -your mom is fadd- |
|
|
|
//thx for using it I guess. But dont cheat, only use it for testing crafts. Or I will find you. (joking) |
|
//btw if you dont trust my code, you can just look through it. I tried to comment it but its meh. |
|
|
|
//define the icData and elements as vars at the beginning |
|
icData = getIcData() |
|
elements = icData["elements"] |
|
|
|
//get the infinite craft local storage |
|
function getIcData(){ |
|
icData = JSON.parse(localStorage.getItem("infinite-craft-data")) |
|
return icData |
|
} |
|
|
|
//modify the elements in local storage |
|
function modifyElements(newData){ |
|
console.log(icData) |
|
localStorage.setItem("infinite-craft-data", JSON.stringify(icData)) |
|
} |
|
|
|
//checks if the element data is empty |
|
function checkElementData(elementData){ |
|
//checks the element text |
|
if (elementData["text"] == ""){ |
|
elementData["text"] = prompt("The text of the element is empty. To what do you want to set it? (Just leave it empty to set it to empty)") |
|
} |
|
|
|
//checks the element emoji |
|
if (elementData["emoji"] == ""){ |
|
elementData["emoji"] = prompt("The text of the emoji is empty. To what do you want to set it? (Just leave it empty to set it to empty)") |
|
} |
|
return elementData |
|
} |
|
|
|
//prints intro and clears the console |
|
function intro(){ |
|
//clears console |
|
console.clear() |
|
|
|
//the logo in ascii art |
|
logo = " _ __ _ _ _ _ _ _ \n(_) _ __ / _|(_) _ __ (_)| |_ ___ / \\ __| | __| |\n| || '_ \\ | |_ | || '_ \\ | || __| / _ \\ / _ \\ / _` | / _` |\n| || | | || _|| || | | || || |_ | __/ / ___ \\ | (_| || (_| |\n|_||_| |_||_| |_||_| |_||_| \\__| \\___|/_/ \\_\\ \\__,_| \\__,_|\n \n" |
|
console.log(logo) |
|
console.log("\t\t\t\t\t\t-your mom is fadd-") |
|
} |
|
|
|
function main(){ |
|
//the data structure of the element |
|
//change this to not be prompted every time |
|
elementData = { |
|
"text": "Water", //the text of the element |
|
"emoji": "💧", //the emoji of the element (can also be text) |
|
"discovered": true //if you are the first who discovered it (only clientside) |
|
} |
|
|
|
//checks the elementData to be empty |
|
elementData = checkElementData(elementData) |
|
|
|
//adds the new element to the elemnts |
|
elements.push(elementData) |
|
console.log("Added to local elements") |
|
//adds it to the actual localStorage |
|
modifyElements(elements) |
|
console.log("Added to the actual elements in local storage") |
|
|
|
//reloads the page so the element gets shown |
|
console.log("Reloading page...") |
|
location.reload() |
|
console.log("Done!") |
|
} |
|
|
|
intro() |
|
main() |
Wow
You’re late