Jump to content
xisto Community
Sign in to follow this  
BuffaloHelp

Firefox Greasemonkey - Invision Board Tool For Warning IPB warning shortcut

Recommended Posts

Greasemonkey is popular for Firefox users in making any webpage to give that a little personal touch.

I found Greasemonkey extension for IPB for moderating WARN feature. You can have lists of commonly used warning messages and have it as pull-down menu style when issuing a warning. Very cool! The simple thing about this extension is how easy to modify to fit your needs.

This extension, called IPB Moderator Reasonator ( http://forums.xisto.com/no_longer_exists/ ), shows only when you are at the warning page. Installation is very simple. After the installation open Manage User Scripts and edit the URL to your own IPB forum board (currently installed for Xisto on my Firefox).

It is simply amazing.

The source code is listed here just in case the site does not show

// ==UserScript==// @name		   IPB moderator reasonator// @namespace	  http://mywebsite.com/myscripts// @description	Provides a select box with common reasons to warn people on the IPB warning page// @include	   http://forums.xisto.com/no_longer_exists/ ==/UserScript==textarea = document.getElementsByName('reason')[0]parent = textarea.parentNodebr = document.createElement('br')//The drop down menuselect = document.createElement('select')select.setAttribute('onchange','warn_add_reason(this.value)')//Now lets create the "append rules link" buttonbutton = document.createElement('input')button.type = "button"button.value = "append rules link"button.setAttribute('onclick','warn_add_rules()')//Add the reasonsreasons = new Array()reasons[0] = new Array("Select a reason","Select a reason") //Do not changereasons[1] = new Array("Multiple consecutive posts","You have created several consecutive posts in one thread. This is usually regarded as spam.")reasons[2] = new Array("Linking to a site/program with relation to hacking it","You have linked to a site with relation to hacking it, this is against our rules. I have removed your thread.")reasons[3] = new Array("Spamming","You have have spammed, the offending post has been removed")reasons[4] = new Array("Necroposting","You have posted a non-constructive post in a long dead topic.")reasons[5] = new Array("Abuse","You have been abusing other members on the forum.")reasons[6] = new Array("Posting spoilers","You have posted blatant spoilers.")reasons[7] = new Array("Asking for warez","You have asked where you can get illegal programs/music/films.")reasons[8] = new Array("Giving link to warez","You have given links to illegal programs/music/films.")reasons[9] = new Array("Signature too large","Your signature is too large.")reasons[10] = new Array("Avatar too large","Your avatar is too large.")for (i=0; i<reasons.length; i++){	eval("child_"+i+" = document.createElement('option')")	reason = escape(reasons[i][1]) //so quotes can be used	eval("child_"+i+".value = '"+reason+"'")	eval("child_"+i+".innerHTML = '"+reasons[i][0]+"'")	eval("select.appendChild(child_"+i+")")}parent.insertBefore(select,textarea)parent.insertBefore(button,textarea)parent.insertBefore(br,textarea)// executed from within the pagefunction warn_add_reason(reason){	document.getElementsByName('reason')[0].value = unescape(reason)}function warn_add_rules(){	domain		= location.href.substr(0,location.href.substring(8,location.href.length).indexOf("/")+8) //get the domain name	document.getElementsByName('reason')[0].value += "\n[url=\""+domain+"/?act=boardrules\"]Read the rules[/url]"}unsafeWindow.eval(warn_add_reason.toString())unsafeWindow.eval(warn_add_rules.toString())

Share this post


Link to post
Share on other sites

As you find and install Greasemonkey, there are a couple of thinghs to edit in the script. The changes can be performed after the install by selecting the Greasemonkey extension in the Tools Menu.

To Change the url and text string for the "Rules Link",
Find :

document.getElementsByName('reason')[0].value += "\n[url=\""+domain+"/?act=boardrules\"]Read the rules[/url]"}
Change to :
document.getElementsByName('reason')[0].value += "\n[url=\""+domain+"/?act=Help&CODE=01&HID=18\"]Xisto Readme [/url]"}

To Change the Host and page which triggers the Dropdown menu,
Find :
// @include	   http://forums.xisto.com/no_longer_exists/;*
Change to :
// @include	   http://forums.xisto.com/index.php?act=warn&type=add;*
[hr=noshade]
Also, the Drop-down can be made tpo appear when you are reducing a warning by including the following Wildcard string in the list of pages:

http://forums.xisto.com/index.php?act=warn&type=minus;*

It might be suitable to add the reasons for reducing the warnings if you are going to do this.
Choose to edit the script in the Tools > Greasemonkey > Manage Script > Edit. (specify your Editor of choice)[/hr]

Share this post


Link to post
Share on other sites

That's great! It will certainly save a fair amount of time. I've changed the reasons so that they are more suited to Xisto but moderators of other IPB forums could easily use this as well:

 

reasons[0] = new Array("Select a reason","Select a reason for adding to the warning") //Do not changereasons[1] = new Array("===================================", "Select a reason for adding to the warning")reasons[2] = new Array("Abusing Members","Abuse of other members on the forum:")reasons[3] = new Array("Advertising", "Advertising:")reasons[4] = new Array("CODE tags for code missing","Posting code without CODE tags:")reasons[5] = new Array("Double Posting","Double posting:")reasons[6] = new Array("Illegible Text Style (Repeated Offence)", "Illegible Text Style:")reasons[7] = new Array("Lack of Contribution","Posting lacking contribution:")reasons[8] = new Array("Personal Information Posted","Posting private information:")reasons[9] = new Array("Plagiarising","Direct copy and pasting without use of QUOTE tags:")reasons[10] = new Array("Pornography", "Pornographical material:")reasons[11] = new Array("Posting a link to an illegal website","Posting a link to an illegal website:")reasons[12] = new Array("Referral links","Posting referral links:")reasons[13] = new Array("Signature Too Big (Repeated Offence)","Signature still too large.")reasons[14] = new Array("Triple Posting", "Triple posting:")reasons[15] = new Array("Warez Discussion","Engaging in the discussion of warez:")reasons[16] = new Array("===================================", "Select a reason for adding to the warning")reasons[17] = new Array("Other Offence", "")

If you wanted to use the script so it dealt with lowering the warning then you'd need to use this code:

 

Immediately after reasons = new Array(), add:

if (location.href.substr(53,3) == "add") {

This works for Xisto.com but not necessarily for other domains. For other domains, the number you would need to change is 53. How do you find what number to change it to? You take a normal link to warn a member:

 

http://forums.xisto.com/index.php?act=warn&type=add&mid=3709&t=1&st=0

 

Count how many characters there are up to the blue letter and that's your number! A painstakingly long process but I can't think of another way to do it (my JS knowledge is very limited). Anyway:

 

Then you insert all your reasons to raise the warn level of the member. Eg:

 

reasons[0] = new Array("Select a reason","Select a reason for adding to the warning") //Do not changereasons[1] = new Array("===================================", "Select a reason for adding to the warning")reasons[2] = new Array("Abusing Members","Abuse of other members on the forum:")reasons[3] = new Array("Advertising", "Advertising:")reasons[4] = new Array("CODE tags for code missing","Posting code without CODE tags:")reasons[5] = new Array("Double Posting","Double posting:")reasons[6] = new Array("Illegible Text Style (Repeated Offence)", "Illegible Text Style:")reasons[7] = new Array("Lack of Contribution","Posting lacking contribution:")reasons[8] = new Array("Personal Information Posted","Posting private information:")reasons[9] = new Array("Plagiarising","Direct copy and pasting without use of QUOTE tags:")reasons[10] = new Array("Pornography", "Pornographical material:")reasons[11] = new Array("Posting a link to an illegal website","Posting a link to an illegal website:")reasons[12] = new Array("Referral links","Posting referral links:")reasons[13] = new Array("Signature Too Big (Repeated Offence)","Signature still too large.")reasons[14] = new Array("Triple Posting", "Triple posting:")reasons[15] = new Array("Warez Discussion","Engaging in the discussion of warez:")reasons[16] = new Array("===================================", "Select a reason for adding to the warning")reasons[17] = new Array("Other Offence", "")

Put this code in:

} else {

Then, put all you reasons for lowering a member's warning. Eg:

 

reasons[0] = new Array("Select a reason","Select a reason for lowering the warning") //Do not changereasons[1] = new Array("===================================", "Select a reason for lowering the warning")reasons[2] = new Array("Good posts", "Good posts recently")reasons[3] = new Array("Helpful member", "Thanks for being a helpful member")reasons[4] = new Array("Reporting posts", "Thanks for reporting some posts recently")reasons[5] = new Array("Superb post", "Fantastic post:")reasons[6] = new Array("===================================", "Select a reason for lowering the warning")reasons[7] = new Array("Other Reason", "")

Put this code in:

}

Then it should act as two scripts that perform similar functions. It displays reasons to add to or lower warnings on their relevant pages. The next step, of course, would be to make it so that auto-writes the PM.

 

Thanks BuffaloHELP!

Share this post


Link to post
Share on other sites

The easiest way to mod this thing might be by using the edit capabilities within the Greasemonkey itself.
Just install the script as per the author's page, then select to edit the script from Tools > Greasemonkey > Manage Users Sripts > Edit.
Cut and paste the following re-structured page into the editor, overwriting the original, to make the script suitable for Xisto Mods.
 



// ==UserScript==// @name IPB moderator reasonator - Xisto version// @namespace [url="/topic/46026-firefox-greasemonkey-invision-board-tool-for-warning-ipb-warning-shortcut/"]http://forums.xisto.com/topic/46026-firefox-greasemonkey-invision-board-tool-for-warning-ipb-warning-shortcut/;// @description Provides a select box with common reasons to warn people on the IPB warning page// @include [url="/index.php?act=warn;*"]http://forums.xisto.com/index.php?act=warn;// ==/UserScript==textarea = document.getElementsByName('reason')[0]parent = textarea.parentNodebr = document.createElement('br')//The drop down menuselect = document.createElement('select')select.setAttribute('onchange','warn_add_reason(this.value)')//Now lets create the "append rules link" buttonbutton = document.createElement('input')button.type = "button"button.value = "append rules link"button.setAttribute('onclick','warn_add_rules()')//Add the reasonsreasons = new Array()if (location.href.substr(53,3) == "add") {reasons[0] = new Array("Select a reason","Select a reason for adding to the warning") //Do not changereasons[1] = new Array("===================================", "Select a reason for adding to the warning")reasons[2] = new Array("Abusing Members","Abuse of other members on the forum:")reasons[3] = new Array("Advertising", "Advertising:")reasons[4] = new Array("CODE tags for code missing","Posting code without CODE tags:")reasons[5] = new Array("Double Posting","Double posting:")reasons[6] = new Array("Illegible Text Style (Repeated Offence)", "Illegible Text Style:")reasons[7] = new Array("Lack of Contribution","Posting lacking contribution:")reasons[8] = new Array("Personal Information Posted","Posting private information:")reasons[9] = new Array("Plagiarising","Direct copy and pasting without use of QUOTE tags:")reasons[10] = new Array("Pornography", "Pornographical material:")reasons[11] = new Array("Posting a link to an illegal website","Posting a link to an illegal website:")reasons[12] = new Array("Referral links","Posting referral links:")reasons[13] = new Array("Signature Too Big (Repeated Offence)","Signature still too large.")reasons[14] = new Array("Triple Posting", "Triple posting:")reasons[15] = new Array("Warez Discussion","Engaging in the discussion of warez:")reasons[16] = new Array("===================================", "Select a reason for adding to the warning")reasons[17] = new Array("Other Offence", "")} else {reasons[0] = new Array("Select a reason","Select a reason for lowering the warning") //Do not changereasons[1] = new Array("===================================", "Select a reason for lowering the warning")reasons[2] = new Array("Good posts", "Good posts recently")reasons[3] = new Array("Helpful member", "Thanks for being a helpful member")reasons[4] = new Array("Reporting posts", "Thanks for reporting some posts recently")reasons[5] = new Array("Superb post", "Fantastic post:")reasons[6] = new Array("===================================", "Select a reason for lowering the warning")reasons[7] = new Array("Other Reason", "")}for (i=0; i<reasons.length; i++){ eval("child_"+i+" = document.createElement('option')") reason = escape(reasons[i][1]) //so quotes can be used eval("child_"+i+".value = '"+reason+"'") eval("child_"+i+".innerHTML = '"+reasons[i][0]+"'") eval("select.appendChild(child_"+i+")")}parent.insertBefore(select,textarea)parent.insertBefore(button,textarea)parent.insertBefore(br,textarea)// executed from within the pagefunction warn_add_reason(reason){ document.getElementsByName('reason')[0].value = unescape(reason)}function warn_add_rules(){ domain = location.href.substr(0,location.href.substring(8,location.href.length).indexOf("/")+8) //get the domain namedocument.getElementsByName('reason')[0].value += "\n[url="/"+domain+"/?act=Help&CODE=01&HID=18"]Xisto Readme [/url]"}unsafeWindow.eval(warn_add_reason.toString())unsafeWindow.eval(warn_add_rules.toString())

Share this post


Link to post
Share on other sites

The disadvantage of reverse engineering is that this code needs to be first understood before it can be customized. And I, not knowing any javascript, took a bit longer to figure out what makes this thing tick.

By editing following lines with my modification, you can have the same pull-down option to appear whenever you are FAST REPLY or REPLY mode.

Edit to:

1) First line

 

textarea = document.getElementsByName('Post')[0]

 

2) Find function warn_add_reason(reason)

 

document.getElementsByName('Post')[0].value = unescape(reason)

 

3) Find function warn_add_rules()

 

document.getElementsByName('Post')[0].value += "\n[url=\""+domain+"/?act=boardrules\"]Read the rules[/url]"

 

All I did was replace 'reason' textarea name to 'Post' name tag.

I initially used @include as a wild card to test it out without prejudice. But the better @include would be

 

 

@include	http://forums.xisto.com/

 

Since IP.Board sets <textarea name="Post"... having a wider include will work to an advantage.

I also believe that having different scripts with prescripted reasons are better than having one script with all possible reasons.

One behavior I noticed is that the pull-down menu will override anything in the <textarea>. "append rules link" will append but as soon as you select another pull-down option, it will be cleared and inserted with the new selection. This is something to be considered when trying to use this while edting a post (it will clear the original post and replace it with your message). The javascript "append rules link" method should be used in this case.

The next agenda would be to modify the script and insertion to automatically fill in PM subject and PM message with the same pull-down option during the warn issuing stage. **DONE**

Find function warn_add_reason(reason) and change to

 

 

function warn_add_reason(reason){	document.getElementsByName('reason')[0].value = unescape(reason)	// add to PM box according to reasons	document.getElementsByName('subject')[0].value = "Warning level adjusted"	document.getElementsByName('contact')[0].value = unescape(reason)}

 

Find function warn_add_rules() and change to

 

function warn_add_rules(){	domain		= location.href.substr(0,location.href.substring(8,location.href.length).indexOf("/")+8) //get the domain name	document.getElementsByName('reason')[0].value += "\n[url=\""+domain+"/?act=boardrules\"]Read the rules[/url]"	// add to PM box when clicked	document.getElementsByName('contact')%5B0%5D.value += "\n[url=\""+domain+"/?act=boardrules\"]Read the rules[/url]"}

 

These changes will allow warning reason, PM subject and PM message areas to be filled in simultaneously :P All done and have fun!

Next agenda is to see if it's possible if this plug can only be used by approved moderators (or any other Greasemonkey user scripts--since anyone with Firefox can use this mod, especially if we develop one for post edit message plug-ins)

 

 

 

Share this post


Link to post
Share on other sites

Wouldn't doing a little copying and pasting of the group permission set up fix that little technicality. most likely you will find that php string that sets up the file permissions for admin and mods in the admin files that list the group permissions in it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.