IPB greasemonkey script for opera to operate on users warn

I’ve spent a few hours making my first greasemonkey script, used in opera (and very probable supporting firefox).
The problem is that IPB (Invision Power Board) allows you to view/modify any non-protected users warn level but only gives you the buttons on the forums you moderate. The workaround till now was to copy-paste the needed url for the wanted operation, plus the userID. Ugly and boring and annoying and etc.
So I’ve made a script to fix that and now I have those buttons on all pages. Groovy b)

Here’s the code:

[code:1:c3ebdc7b62]
// ==UserScript==
// @name SoftPedia Warn Hack
// @author Ciuly
// @namespace http://www.ciuly.com
// @description places necessary warn related shortcuts where they are not present
// @include http://forum.softpedia.com/index.php?showtopic=*
// @exclude *
// ==/UserScript==

var table, tables, span, uid, text, debug;

// debug = true; // un-comment this line for debugging

if (debug)
alert("started");

tables = document.body.all.tags("table");

if (debug)
alert(tables.length);

for (var i = 0; i<tables.length; i++){
table = tables.item(i);
if (table.className == "ipbtable" & table.getAttribute("cellspacing") == "1"){
text = table.all.tags("a").item(1).getAttribute("href");
if (debug)
alert("User url = " + text);
var j = text.indexOf("showuser=");
if (j>-1){
uid = text.substr(j+9, text.length);
if (debug)
alert("User ID = " + uid);

span = table.all.tags("tr").item(1).all.tags("span").item(0);
text = span.innerHTML;
j = text.indexOf("Warn:");
if (debug)
alert("Warn position = " + j);
if (j == -1)
span.insertAdjacentHTML("beforeEnd", "Warn: (<a href=\"javascript:PopUp(’http://forum.softpedia.com/index.php?act=warn&amp;mid=" + uid + "&amp;CODE=view’,’Pager’,’500′,’450′,’0′,’1′,’1′,’1’)\">??</a>%) <a href=’http://forum.softpedia.com/index.php?act=warn&amp;type=minus&amp;mid=" + uid + "8&amp;t=&amp;st=0′ title=’Decrease warn level’><img src=’style_images/1/warn_minus.gif’ border=’0′ alt=’-‘ /></a><img src=’style_images/1/warn0.gif’ border=’0′ alt=’—–‘ /><a href=’http://forum.softpedia.com/index.php?act=warn&amp;type=add&amp;mid=" + uid + "8&amp;t=&amp;st=0′ title=’Increase warn level’><img src=’style_images/1/warn_add.gif’ border=’0′ alt=’+’ /></a>");
}
}
}

if (debug)
alert("finished");

[/code:1:c3ebdc7b62]

Related posts

One Response to “IPB greasemonkey script for opera to operate on users warn”

  1. ciuly says:

    seems the above does not work in firefox after all.

    get the firefox script [url=http://www.ciuly.com/greasemonkey/sp_warn_ff.user.js]here[/url]
    get the opera script [url=http://www.ciuly.com/greasemonkey/sp_warn_o.user.js]here[/url]

Leave a Reply

This blog is kept spam free by WP-SpamFree.