Skip to content

Instantly share code, notes, and snippets.

@Glorfindel83
Created December 4, 2018 08: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 Glorfindel83/59b3fd67d37e81994547506f7eed18d9 to your computer and use it in GitHub Desktop.
Save Glorfindel83/59b3fd67d37e81994547506f7eed18d9 to your computer and use it in GitHub Desktop.
Search global inbox for notification types
let lastPageURL = $("#inbox-pager a:nth-last-child(2)").attr("href");
let lastPage = parseInt(lastPageURL.substring(lastPageURL.indexOf("&page=") + 6));
let baseURL = lastPageURL.substring(0, lastPageURL.indexOf("&page=") + 6);
var itemTypes = {};
function fetchPage(page) {
if (page > lastPage) {
console.log(itemTypes);
return;
}
console.log(baseURL + page);
$.get(baseURL + page, function(data) {
$(data).find("table.history-table tr td:nth-child(3)").each(function() {
let type = this.innerText.trim();
if (typeof itemTypes[type] == "undefined") {
itemTypes[type] = page;
}
});
window.setTimeout(function() {
fetchPage(++page);
}, 100);
});
}
fetchPage(1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment