Created
May 15, 2023 16:01
-
-
Save sertalpbilal/485946e709a1551b8a3a61bd224dd503 to your computer and use it in GitHub Desktop.
List Challenges Export to CSV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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