Created
July 2, 2019 19:23
-
-
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
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
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