Skip to content

Instantly share code, notes, and snippets.

@viankakrisna
Created September 28, 2018 22:44
Show Gist options
  • Save viankakrisna/b0b3550b0db2b189985c8404129ec731 to your computer and use it in GitHub Desktop.
Save viankakrisna/b0b3550b0db2b189985c8404129ec731 to your computer and use it in GitHub Desktop.
(async () => {
const numbers = Array.from({ length: 329 }, (v, k) => k + 1);
var messageList = document.getElementById("messageList");
while (messageList.firstChild) {
messageList.removeChild(messageList.firstChild);
}
for (const number of numbers) {
const res = await fetch(
window.location.href.replace("page-329", `page-${number}`)
);
const text = await res.text();
const parser = new DOMParser();
const doc = parser.parseFromString(text, "text/html");
Array.from(doc.querySelectorAll(".message")).forEach(el =>
messageList.appendChild(el)
);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment