开发者

how to append link to text block using Safari Extensions

开发者 https://www.devze.com 2023-01-15 14:13 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消