Skip to content

Instantly share code, notes, and snippets.

@sertalpbilal
Created May 15, 2023 16:01
Show Gist options
  • Save sertalpbilal/485946e709a1551b8a3a61bd224dd503 to your computer and use it in GitHub Desktop.
Save sertalpbilal/485946e709a1551b8a3a61bd224dd503 to your computer and use it in GitHub Desktop.
List Challenges Export to CSV
// in each page
loc = localStorage.getItem('list_of_cities')
if (loc == null) {
loc = []
}
else {
loc = JSON.parse(loc)
}
a = loc
items = Object.values(document.querySelectorAll(".item-name")).map(i => i.innerText)
a.push(...items)
localStorage.setItem('list_of_cities', JSON.stringify(a))
// at the end
c = "data:text/csv;charset=utf-8," + a.join('\r\n')
var encodedUri = encodeURI(c);
window.open(encodedUri);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment