Page 10 of 12
Posted: Tue Aug 07, 2007 1:55 am
by forge
magic
BTW - you can leave both scripts in the same file and the old way still works, we can just add the new way to it
you are a clever bunny Herr Angstrom
Posted: Tue Aug 07, 2007 4:19 am
by djadonis206
The Baconator!
Posted: Tue Aug 07, 2007 4:23 am
by nebulae
Holy shit, X....ZAPP! The roach is gone! Angstrom, you are a genius! Must be that monkey on your head (see his Myspace pics)
Posted: Tue Aug 07, 2007 4:46 am
by longjohns
so what's the word on possibility with Opera?
Posted: Tue Aug 07, 2007 5:36 am
by forge
longjohns wrote:so what's the word on possibility with Opera?
I've been trying to figure that out - sweetjesus reckons you can but I dont know where you put it
Posted: Tue Aug 07, 2007 5:47 am
by forge
forge wrote:longjohns wrote:so what's the word on possibility with Opera?
I've been trying to figure that out - sweetjesus reckons you can but I dont know where you put it
hmmm...as far as I can tell it should be as simple as setting the folder the .js file is in in the preferences>content in opera and it should work - the opera documentation even says if it sees the file has the extension user.js then it will see it as a greasemonkey file
but for some reason it's not working
Posted: Tue Aug 07, 2007 6:00 am
by forge
Posted: Tue Aug 07, 2007 12:13 pm
by hambone1
Excellent work, Forge & Angstrom!
One further request. Can we ignore users by specific criteria with Boolean logic, such as "miserable" AND "UK" AND "Northerners"?
Posted: Tue Aug 07, 2007 3:02 pm
by beats me
I haven't used the script and don't know if I will but ever since this thread was started I haven't seen a lot of trolls posting. Good job guys. I guess if they can't get under certain people's skin then they see no point in posting anything. But I predict a lot of "noobs" will appear any minute now.
Posted: Tue Aug 07, 2007 3:06 pm
by nebulae
that's ok...it's the mental victory that counts...since I came back, armed with this script, I've felt completely immune to any nasty thing I've read, whether the script is on or not. That alone is enough. Of course, having that nice X to have the troll bugger off is that much better.
Posted: Tue Aug 07, 2007 3:16 pm
by ChiDJ
NEB, glad you're back man!
Missed your witty gritty charm.
Don't block me....My love is true blue.
Posted: Tue Aug 07, 2007 3:19 pm
by nebulae
what up, m'man chi? thanks for the true blue welcome!
Posted: Tue Aug 07, 2007 3:34 pm
by Angstrom
Ok, here's the new version of the script.
I should say I am standing on the shoulders of giants here, having never used XPATH before I lifted chunks from all over the place.
This version is a lot more user friendly and robust than the previous versions.
How to use it (after installing)
You don't need to edit anything anymore, this version is point and click to banish a troll.
After installing, when you read a post in a thread such as this you will see the posters name now has a faint grey [X] next to it. So I would appear as
[X] Angstrom
if you click the [X] the user is then hidden, all that remains is a blank row with an [X] in . If you want to see who the [X] person is ... hover over that [X] you will see the name of the offending party, it will say "click to show Mr Bad']3@$$man " (or something similar).
Obviously, clicking will
restore all the posts by Mr Bad']3@$$man.
In the main listings such as 'general' or 'search results'
All posts started by your defined trolls Bad']3@$$man, and his friends are hidden from the main listings
How to install it
same as before
- get firefox
- install greasemonkey extension
- Once installed in Firefox and restarted, in the Tools menu, Choose Greasemonkey, then New User Script
- In the dialog box, Name your script (such as Troll Killer), leave all the other boxes blank
- You might get a dialog box to associate your script with a program...browse to any text editor to associate your scripts to the text editor. An example is C:\WINDOWS\NOTEPAD.EXE
- In the window that opens up with your blank script, select all and delete.
- Then copy and paste with the following script (below)
- finally - in Tools -> Greasemonkey - > Manage User Scripts , include the following pages
http://*viewtopic.php*
http://*viewforum.php*
http://*search.php*
- refresh this page and you shoudl see the little [X] appear next to usernames. Happy troll killing
here's the code which you paste into your greasemonkey script
Code: Select all
// ==UserScript==
// @name phpBB User Hide
// @include *viewtopic.php* *search.php* *viewforum.php*
// @description Hides/unhides a user's posts
// @exclude
// ==/UserScript==
(function() {
// Get stored hidden users from cookie
var users = [];
var cookieName = "phpUserHide";
for (var i = 0; i < document.cookie.split('; ').length; i++) {
var oneCookie = document.cookie.split('; ')[i].split('=');
if (oneCookie[0] == cookieName) {
users = oneCookie[1].split(', ');
break;
}
}
// Cursor functions
var curPointer = function(event) { event.target.style.cursor = 'pointer'; event.preventDefault(); };
var curDefault = function(event) { event.target.style.cursor = 'default'; event.preventDefault(); };
// Add or remove a user from the cookie
var addRemoveUser = function(event) {
// Parse current cookie
for(j = 0; j < document.cookie.split('; ').length; j++ ) {
var oneCookie = document.cookie.split('; ')[j].split('=');
if (oneCookie[0] == cookieName) {
users = oneCookie[1].split(', ');
break;
}
}
var user = escape(event.target.nextSibling.nextSibling.innerHTML)
isFound = true;
for (var j = 0; j < users.length; j++) {
if (users[j] == user) { users.splice(j, 1); isFound = false;}
}
if (isFound){users.push(user);}
if (users.length > 0) {
var date = new Date();
var days = 365;
date.setTime(date.getTime() + (days*24*60*60*1000));
var expires = '; expires=' + date.toGMTString();
var value = users.join(', ');
document.cookie = cookieName + '=' + value + expires + '; path=/';
} else {
document.cookie = cookieName + '=;expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/';
}
window.alert(unescape(user) + ' has been ' + (isFound ? 'added to' : 'removed from')
+ ' your hide list\n');
//event.preventDefault();
window.location.reload();
};
// Toggle display of user's post
var togglePost = function(event) {
var displayState = event.target.getAttribute('displaystate');
if (displayState == 'none'){ displayState = '';}else{displayState = 'none';}
event.target.setAttribute('displaystate', displayState);
containingRow = event.target.parentNode.parentNode;
var innerTags = containingRow.getElementsByTagName('*');
for (var i = 0; i < innerTags.length; i++) {
var tagClass = innerTags[i].getAttribute('class');
if (tagClass == 'postbody' || tagClass == 'postsig' || tagClass == 'postdetails' || innerTags[i].tagName == 'TABLE')
innerTags[i].style.display = displayState;
}
event.preventDefault();
};
// Toggle display of user's quote
var toggleQuote = function(event) {
var displayState = event.target.getAttribute('displaystate');
if (displayState == 'none'){ displayState = 'table-row';} else{ displayState = 'none';}
event.target.setAttribute('displaystate', displayState);
// Jump to parent row
var containingRow = event.target.parentNode.parentNode.parentNode.parentNode.nextSibling;
// Find containing row
while (containingRow.nodeType != 1)
containingRow = containingRow.nextSibling;
containingRow.style.display = displayState;
event.preventDefault();
};
// Find all the usernames in the postings and listing pages
var results = document.evaluate("//span[@class='name']/a", document, null, XPathResult.ANY_TYPE, null);
var resultNodes = [];
var aResult;
while (aResult = results.iterateNext())
resultNodes.push(aResult);
// Loop through every user post on the page
for (var i in resultNodes) {
var containingRow = resultNodes[i].parentNode.parentNode.parentNode;
// Format whitespace
if (resultNodes[i].nextSibling){
// its a post page
var ispostpage=true;
var user= escape(resultNodes[i].nextSibling.innerHTML);
}else{var user = escape(resultNodes[i].innerHTML);var ispostpage=false;}
// Flag whether the user is in our hide list
var isFound = true;
for (var j = 0; j < users.length; j++) {
if (users[j] == user) {
isFound = false;
}
}
// Add relevant event handlers to user's name and a toggler node
if (ispostpage){
var toggler = document.createElement('span');
toggler.setAttribute('title', "click to add or remove "+ unescape(user) +"");
toggler.appendChild(document.createTextNode('[X] '));
toggler.style.fontSize = "7pt";
toggler.style.color="#B3AAA3";
toggler.addEventListener('mouseover', curPointer, true);
toggler.addEventListener('mouseout', curDefault, true);
toggler.addEventListener('click', addRemoveUser, true);
resultNodes[i].parentNode.insertBefore(toggler, resultNodes[i]);
}
// If this user isn't in our hide list, skip to the next user
if (isFound) continue;
// Find the first element node (td) in the containing row
var elem = containingRow.firstChild;
while (elem.nodeType != 1){ elem = elem.nextSibling;}
if ( resultNodes[i].nextSibling){resultNodes[i].nextSibling.style.display = 'none';}else{
// hide an entire row of troll in listings
resultNodes[i].parentNode.parentNode.parentNode.style.display = 'none';
}
// this hides contents
var innerTags = containingRow.getElementsByTagName('*');
for (var i = 0; i < innerTags.length; i++) {
var tagClass = innerTags[i].getAttribute('class');
if (tagClass == 'postbody' || tagClass == 'postsig' || tagClass == 'postdetails' || innerTags[i].tagName == 'TABLE')
innerTags[i].style.display = 'none';
}
}
})();
It could be and will be sped up and refined over time, but not just now, this works ... which is good enough.
right, can I go back to making music now ?
thanks.
Posted: Tue Aug 07, 2007 3:47 pm
by hambone1
Awesome!
The signal-to-noise ratio is MUCH higher now. Fewer OT threads, less BS, more music, more Ableton Live.
Thanks!
Posted: Tue Aug 07, 2007 4:01 pm
by nebulae
Ang, you're a demigod, a giant among insects, etc etc etc.
I would only add that when you guys create a new script or modify any existing ones, make sure the include pages have the following three lines in the script management window:
*viewtopic.php*
*search.php*
*viewforum.php*