Skip to content

Instantly share code, notes, and snippets.

@jeromefroe
Created July 2, 2019 19:23
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 jeromefroe/ff3d4a5a618b0403cd2ec518ca8c7247 to your computer and use it in GitHub Desktop.
Save jeromefroe/ff3d4a5a618b0403cd2ec518ca8c7247 to your computer and use it in GitHub Desktop.
An example bookmarklet to open the same set of links on a page
javascript:(function expandFiles() {
// The Chrome extension SelectorGadget is helpful for determining what selector
// to use for selecting certain elements.
var links = document.querySelectorAll('.myElement');
if (links) {
for (var i in links) {
// If we only want to select a subset of the elements matched by the selector
// query we used we can use different properties of the elements to filter them
// further. In the example below, for instance, we use the inner text of the
// element.
if (links[i].innerHTML.indexOf('My Special Text') != -1) {
links[i].click();
};
};
};
}())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment