Created
December 4, 2018 08:18
-
-
Save Glorfindel83/59b3fd67d37e81994547506f7eed18d9 to your computer and use it in GitHub Desktop.
Search global inbox for notification types
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
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