Userscripts Comments Fix

By sizzlemctwizzle Last update Nov 14, 2011 — Installed 11,415 times.

Quote Link in "Author VCard"

in
Subscribe to Quote Link in "Author VCard" 4 posts, 2 voices



IzzySoft Scriptwright
FirefoxWindows
Sizzle, may I suggest a slight change (made necessary by the introduction of that "useragent" div): line 315 now reads:
var posts = document.evaluate('//td[@class="author vcard"]', document, null, 6, null), post, i=posts.snapshotLength;
Please change to:
var posts = document.evaluate('//td[@class="author vcard"]/p/span[@class="edit"]', document, null, 6, null), post, i=posts.snapshotLength;
After I did that, I was surprised you also add a "report spam" link I didn't see before (probably hidden below the useragent icons or something like that) :P

Edit: this needs an addition following line 315, i.e. line 316 must be added:
if (i<1) var posts = document.evaluate('//td[@class="author vcard"]/span[@class="role"]', document, null, 6, null), i=posts.snapshotLength;
Otherwise it would only work for your own posts ;)
 
IzzySoft Scriptwright
FirefoxWindows

Just found out this is not working as expected - so second approach here:

Mentioned line 315 should read:

var posts = document.evaluate('//td[@class="author vcard"]/span[@class="role"]', document, null, 6, null), post, i=posts.snapshotLength, post, i=posts.snapshotLength, br = document.createElement('br');
br.style.clear = 'both';

Then, the new elements should be appended like this:
if (post.nextSibling.nextSibling.tagName.toLowerCase()=='p')
  post.nextSibling.nextSibling.firstChild.nextSibling.appendChild(quote);
else {
  post.appendChild(br);
  post.appendChild(quote);
}

For the reports correspondingly:
if (post.nextSibling.nextSibling.tagName.toLowerCase()=='p') continue; // we don't report ourselves, do we?
else post.appendChild(report);

This way they are placed correctly in both cases: for own and foreign posts.

But the quote_handle() function also needs to be slightly adjusted then:

function quote_handle(e) {
...
  post_id = e.target.parentNode.parentNode.parentNode.id.split('row-')[1];
  if (post_id==undefined) post_id = e.target.parentNode.parentNode.parentNode.parentNode.id.split('row-')[1];
...
}

Same for report_handle():
function report_handle(e) {
...
var l=e.target.parentNode.parentNode.childNodes[5].lastChild.previousSibling;
...
}

Results look much better for me Tongue

 
sizzlemctwizzle Script's Author
FirefoxMacintosh

Thanks for making me aware of this problem. I've completely rewrote this code.

 
IzzySoft Scriptwright
FirefoxX11

Great - thanx, seems to work fine!

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel