I'm trying to create a safari extension that will place an "Add to BibDesk" link after any text that looks like a BibText entry. BibText entries look like this:
@string{
foo = "bar",
foo2 = "bar2"
}
I know how to const开发者_运维百科ruct the necessary regex, but my question is what's the best way, using javascript, to search all the text on a page for a particular bit of text?
Get any elements that can contain text nodes (div, p, etc.) using a selector, then for each element search for any BibText entries and replace the matched text with itself PLUS the link that does the work appended to the end.
精彩评论