Bug: Doesn't work for moderator accounts
Symptom: The self-destruct button doesn't appear.
Investigation:
The problem seems to be that $that.find('.comment-user').text() ==
… won't match the name (scraped from elsewhere on the page) because the left side of the equals test also contains the diamond and its enclosing span
. Compare these two .comment-user
objects' structures, one for a normal user and one for a moderator:
Normal user:
<a href="/users/4163/sevensideddie"
title="27,705 reputation"
class="comment-user">SevenSidedDie</a>
Moderator:
<a href="/users/321/sevensideddie"
title="145,704 reputation"
class="comment-user">SevenSidedDie<span class="mod-flair" title="moderator">♦</span></a>
Ironically, my many moderation-related comments are exactly the ones that would most benefit from self-destructing! :)
Fix
A find-and-replace for .text() ==
replaced with .text().replace('♦','') ==
enables the self-destruct button for moderator messages.