Skip to content

Instantly share code, notes, and snippets.

@prs-watch
Created March 1, 2020 12:05
Show Gist options
  • Select an option

  • Save prs-watch/ee7653409107225dff6e535467e77016 to your computer and use it in GitHub Desktop.

Select an option

Save prs-watch/ee7653409107225dff6e535467e77016 to your computer and use it in GitHub Desktop.
Expand MLB.com Prospect List without clicking "Load More" button
// ==UserScript==
// @name MLB.com Prospect List Expander
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Expand MLB.com Prospect List without clicking "Load More" button.
// @author prs-watch
// @match https://www.mlb.com/prospects/*
// @grant none
// ==/UserScript==
window.onload = () => {
const load = () => {
const container = document.getElementsByClassName("load-more__container")[0]
const buttons = container.getElementsByTagName("button")
while(buttons.length != 0) {
buttons[0].click()
}
}
load()
const target = document.body
const observer = new MutationObserver(records => {
load()
})
observer.observe(target, {
attributes: true
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment