Skip to content

Instantly share code, notes, and snippets.

@pancelor
Created June 14, 2021 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pancelor/c20d850f19c4f6fcc2965212e495634f to your computer and use it in GitHub Desktop.
Save pancelor/c20d850f19c4f6fcc2965212e495634f to your computer and use it in GitHub Desktop.
/*
To clear your save data for Too Many Daves:
1. open the javascript console (f12)
2. change the "javascript context" (near the top left of the console) from "top" to "index.html - v6p9d9t4.ssl.hwcdn.net"
(This is the iframe itch.io uses to run the game. We need to change our javascript context so that we have access to its data storage)
3. paste this code into the console and run it; it should say "save data successfully deleted"
4. refresh the page. the game should start you back in the first level
*/
filename_to_delete="/user_data/cdata/pancelor_toomanydavesjam_0.p8d.txt"
if (window.location.host==="pancelor.itch.io") {
console.error("you need to manually change the javascript context from 'top' to 'index.html'")
} else {
openreq=indexedDB.open("/user_data")
openreq.onerror=console.error
openreq.onsuccess=()=>{
let db=openreq.result
let transaction=db.transaction("FILE_DATA","readwrite")
let req=transaction.objectStore("FILE_DATA").delete(filename_to_delete)
req.onerror=console.error
req.onsuccess=()=>console.log("save data successfully deleted")
}; null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment