I'm writing a Greasemonkey script, and I wanted to change the text of a forum post on a phpBB2 forum by using XPath to select the body of the post that occurs after a certain username, but the whole thing is a giant mess of tables.
<tr>
<td>
<span class="name">
<a>
<b>username</b>
</span>
<span></span>
</td>
<td>
<table>
<tbody>
<tr></tr>
<tr></tr>
<tr>
<td>
<span class="postbody">text of post</span>
<span></span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
I need to get the postbody span that happens after the username in the b tag equals a certain name, and then mess with the text. Here is how I am trying to do it:
var postguy = document.evaluate('fffffff', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < postguy.snapshotLength; i++) {
thisLink = postguy.snapshotItem(i);
//then do something with the post
}