** solution to the moderation issue ** - firefox required

Discuss music production with Ableton Live.
forge
Posts: 17422
Joined: Wed Apr 21, 2004 9:47 am
Location: Queensland, AU
Contact:

Post by forge » Tue Aug 07, 2007 1:55 am

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

djadonis206
Posts: 6490
Joined: Thu Jun 17, 2004 4:23 pm
Location: Seattle, WA.

Post by djadonis206 » Tue Aug 07, 2007 4:19 am

The Baconator!
Ableton | Elektron

Music

nebulae
Posts: 15716
Joined: Tue Sep 07, 2004 12:16 am
Location: New Orleans
Contact:

Post by nebulae » Tue Aug 07, 2007 4:23 am

Holy shit, X....ZAPP! The roach is gone! Angstrom, you are a genius! Must be that monkey on your head (see his Myspace pics)

longjohns
Posts: 9088
Joined: Mon Dec 22, 2003 3:42 pm
Location: seattle

Post by longjohns » Tue Aug 07, 2007 4:46 am

so what's the word on possibility with Opera?

forge
Posts: 17422
Joined: Wed Apr 21, 2004 9:47 am
Location: Queensland, AU
Contact:

Post by forge » Tue Aug 07, 2007 5:36 am

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

forge
Posts: 17422
Joined: Wed Apr 21, 2004 9:47 am
Location: Queensland, AU
Contact:

Post by forge » Tue Aug 07, 2007 5:47 am

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

forge
Posts: 17422
Joined: Wed Apr 21, 2004 9:47 am
Location: Queensland, AU
Contact:

Post by forge » Tue Aug 07, 2007 6:00 am


hambone1
Posts: 5346
Joined: Fri Feb 04, 2005 8:31 pm
Location: Abu Dhabi

Post by hambone1 » Tue Aug 07, 2007 12:13 pm

Excellent work, Forge & Angstrom!

One further request. Can we ignore users by specific criteria with Boolean logic, such as "miserable" AND "UK" AND "Northerners"?

beats me
Posts: 23319
Joined: Fri Mar 30, 2007 6:39 pm

Post by beats me » Tue Aug 07, 2007 3:02 pm

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.

nebulae
Posts: 15716
Joined: Tue Sep 07, 2004 12:16 am
Location: New Orleans
Contact:

Post by nebulae » Tue Aug 07, 2007 3:06 pm

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. :)

ChiDJ
Posts: 2241
Joined: Fri Jun 03, 2005 1:59 pm
Location: CHick-A-Go!
Contact:

Post by ChiDJ » Tue Aug 07, 2007 3:16 pm

NEB, glad you're back man!

Missed your witty gritty charm. 8)

Don't block me....My love is true blue. :oops:
"Let you're body feel the sound! Let it cover you up and down!"

Image

nebulae
Posts: 15716
Joined: Tue Sep 07, 2004 12:16 am
Location: New Orleans
Contact:

Post by nebulae » Tue Aug 07, 2007 3:19 pm

what up, m'man chi? thanks for the true blue welcome! :)

Angstrom
Posts: 14923
Joined: Mon Oct 04, 2004 2:22 pm
Contact:

Post by Angstrom » Tue Aug 07, 2007 3:34 pm

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
  1. get firefox
  2. install greasemonkey extension
  3. Once installed in Firefox and restarted, in the Tools menu, Choose Greasemonkey, then New User Script
  4. In the dialog box, Name your script (such as Troll Killer), leave all the other boxes blank
  5. 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
  6. In the window that opens up with your blank script, select all and delete.
  7. Then copy and paste with the following script (below)
  8. finally - in Tools -> Greasemonkey - > Manage User Scripts , include the following pages

    http://*viewtopic.php*
    http://*viewforum.php*
    http://*search.php*
  9. 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.
;)

hambone1
Posts: 5346
Joined: Fri Feb 04, 2005 8:31 pm
Location: Abu Dhabi

Post by hambone1 » Tue Aug 07, 2007 3:47 pm

Awesome!

The signal-to-noise ratio is MUCH higher now. Fewer OT threads, less BS, more music, more Ableton Live.

Thanks!

nebulae
Posts: 15716
Joined: Tue Sep 07, 2004 12:16 am
Location: New Orleans
Contact:

Post by nebulae » Tue Aug 07, 2007 4:01 pm

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*

Post Reply