[Greasemonkey] Patterns

Scott R. Turner srt at aero.org
Tue Apr 12 17:08:16 EDT 2005

On Tue, 12 Apr 2005, Mark Pilgrim wrote:
> - Insert after an existing element
> existingElement.parentNode.insertBefore(newElement,
> existingElement.nextSibling);

Does that work if there is no nextSibling?

> - Test whether page contains text string
> if (document.textContent.indexOf(...) != -1) { ... }

I didn't know about textContent... What text does it include -- only
text that will be rendered on the page?

This is a very handy and useful list.  I created the content
aggregator script partly to give people who wanted to do something
similar a starting point.  A bunch of example scripts based on these
snippets would probably cover 90% of the tasks people will want to

 		-- Scott

More information about the Greasemonkey mailing list