PDA

View Full Version : Greasemonkey Javascript to ignore certain users on a forum



Derpy
01-20-2012, 12:08 AM
I frequent a forum that has a pretty large community. There are a few users there I don't particularly care for. I would like to make a Greasemonkey compatible javascript code that would allow me to completely erase their posts from the page.

What I want to happen is that every time

<li class="kpost-username">
<a rel="nofollow" title="" href="/index.php/component/kunena/profile/userid-80?Itemid=0" class="kwho-user">Rolepgeek</a> </li>
appears it deletes the parent <table class="kmsg"> node.

I know that I can find each of those code snippets with
document.getElementById('kpost-usernmae')however I am not sure how I would go about defining if it includes
<li class="kpost-username">
<a rel="nofollow" title="" href="/index.php/component/kunena/profile/userid-80?Itemid=0" class="kwho-user">Rolepgeek</a> </li>or not, nor am I sure on how to tell the code to delete the parent <table class="kmsg"> node when it does include it.

I've been messing around a bit with some code, and I understand the general idea of how it should work, however I do not know the syntax in order to get it to work. Any help would be appreciated.

HTML to a full post:

<table class="kmsg">
<tbody>
<tr>
<td class="kprofile-top">
<ul id="kpost-profiletop">
<li class="kpost-smallicons">
<span title="Gender: Unknown" class="kicon-profile kicon-profile-gender-unknown"></span> <a title="Click here to send a private message to this user." href="/index.php/component/uddeim/?task=new&amp;recip=80&amp;Itemid=213"><span alt="Click here to send a private message to this user." class="kicon-profile kicon-profile-pm"></span></a> <br>
<div>
<span class="kpost-userposts">Posts:334</span>
</div>
</li>
<li class="kpost-personal">
Chaos will consume all... </li>
<li class="kpost-avatar">
<a rel="nofollow" title="" href="/index.php/component/kunena/profile/userid-80?Itemid=0" class="kwho-user"><span class="kavatar"><img style="max-width: 72px; max-height: 72px" alt="" src="http://thekingdomsmc.com/media/kunena/avatars/resized/size72/users/avatar80.jpg" class="kavatar vbavnparnxybaoekjwjh"></span></a> </li>
<li class="kpost-username">
<a rel="nofollow" title="" href="/index.php/component/kunena/profile/userid-80?Itemid=0" class="kwho-user">Rolepgeek</a> </li>
<li class="kpost-userrank">
Merchant </li>
<li class="kpost-userrank-img">
<img alt="" src="http://thekingdomsmc.com/components/com_kunena/template/default/images/ranks/rank3.gif"> </li>
<li><span class="kicon-button kbuttononline-yes"><span class="online-yes"><span>NOW ONLINE</span></span></span></li>
<li class="kpost-karma">
<span class="kmsgkarma">
Karma: -9 <a rel="nofollow" title="" href="/index.php/component/kunena/4-off-topic/karma/userid-80?do=decrease&amp;pid=13229&amp;0409ea1d6b1360d1a0a24ee6206c0bf4=1&amp;Itemid=0"><span title="Smite" border="0" alt="Karma-" class="kkarma-minus"> </span></a> <a rel="nofollow" title="" href="/index.php/component/kunena/4-off-topic/karma/userid-80?do=increase&amp;pid=13229&amp;0409ea1d6b1360d1a0a24ee6206c0bf4=1&amp;Itemid=0"><span title="Applaud" border="0" alt="Karma+" class="kkarma-plus"> </span></a> </span>
</li>
</ul> </td>
</tr>
<tr>
<td class="kmessage-top">

<div class="kmsgbody">
<div class="kmsgtext">
Yeah. And it would be pointless, seeing as how I won't. </div>
</div>
<div style="display: none" class="kreply-form" id="kreply13229_form">
<form enctype="multipart/form-data" name="postform" method="post" action="/index.php/component/kunena/post?Itemid=0">
<input type="hidden" value="13229" name="parentid">
<input type="hidden" value="4" name="catid">
<input type="hidden" value="post" name="action">
<input type="hidden" value="1" name="0409ea1d6b1360d1a0a24ee6206c0bf4"> <input type="hidden" value="Shigan" name="authorname">
<input type="text" value="Re: To all non-bronies." maxlength="50" class="inputbox" size="35" name="subject"><br>
<textarea cols="60" rows="6" name="message" class="inputbox"></textarea><br>
<input type="checkbox" value="1" name="subscribeMe">
<i>Check this box to be notified of replies to this topic.</i>
<br>
<input type="submit" title="Click here to submit your message" value="Submit" name="submit" class="kbutton kreply-submit">
<input type="reset" title="Click here to cancel your message" value="Cancel" name="cancel" class="kbutton kreply-cancel">
<small>Note: BBcode and smileys are still usable.</small>
</form>
</div>
</td>
</tr>
<tr>
<td class="kbuttonbar-top">
<div>
<div class="kmsgsignature">
With Order, come entropy,<br>
With Life, comes death,<br>
With Light, comes shadow.<br>
<br>
<div style="text-align: center">If one does not know Chaos, one does not realize the potential within themselves.</div> </div>
</div>
<div class="kmessage-editmarkup-cover">
<span class="kmessage-informmarkup"><a rel="nofollow" title="" href="/index.php/component/kunena/4-off-topic/13229-re-to-all-non-bronies/report?Itemid=0">Report to moderator</a></span>
</div>
<div class="kmessage-buttons-cover">
<div class="kmessage-buttons-row">
<a id="kreply13229" rel="nofollow" title="Quick Reply" href="/index.php/component/kunena/4-off-topic/13229-re-to-all-non-bronies/post?do=reply&amp;Itemid=0" class="kicon-button kbuttoncomm btn-left kqreply"><span class="reply"><span>Quick Reply</span></span></a> <a rel="nofollow" title="Reply" href="/index.php/component/kunena/4-off-topic/13229-re-to-all-non-bronies/post?do=reply&amp;Itemid=0" class="kicon-button kbuttoncomm btn-left"><span class="reply"><span>Reply</span></span></a> <a rel="nofollow" title="Quote" href="/index.php/component/kunena/4-off-topic/13229-re-to-all-non-bronies/post?do=quote&amp;Itemid=0" class="kicon-button kbuttoncomm btn-left"><span class="quote"><span>Quote</span></span></a> </div>
</div> <div class="kpost-thankyou">
<a rel="nofollow" title="I want to thank you for this message!" href="/index.php/component/kunena/4-off-topic/thankyou?pid=13229&amp;0409ea1d6b1360d1a0a24ee6206c0bf4=1&amp;Itemid=0" class="kicon-button kbuttonuser btn-left"><span class="thankyou"><span>Thank You</span></span></a></div>
</td>
</tr>
</tbody>
</table>

felgall
01-20-2012, 02:05 AM
Which obscure script is the forum using that it requires you write a script to do it? All the most common furum scripts have the functionality to be able to ignore specific users built into the forum software itself.

Derpy
01-20-2012, 02:20 AM
Which obscure script is the forum using that it requires you write a script to do it? All the most common furum scripts have the functionality to be able to ignore specific users built into the forum software itself.

Kunena