Foe Feature

For troubles with forum features or general questions regarding site moderation/administration.
Post Reply
User avatar
AWSchmit
PAT. # 2.972.923
PAT. # 2.972.923
Posts: 4704
Joined: Wed Feb 04, 2009 11:03 am
Location: WV - US of A
Contact:

Foe Feature

Post by AWSchmit » Fri Feb 13, 2015 1:07 pm

Is that a way to make it so that you don't even know the people on your foe list even exists? I'll read through a thread and see, so and so has a message that we're hiding from you, but I'd rather not even know there's a post there I can't see.... I know this is kind of stupid, but just thought I'd check if that was possible. Thanks.
I finally finish building a guitar, go to play it, and then remember, "oh yeah, that's right. I suck at playing... Why did I build another guitar again?"

User avatar
luau
Admin
Admin
Posts: 10036
Joined: Tue Dec 12, 2006 7:07 am
Location: Ft. Lauderdale, FL, USA

Re: Foe Feature

Post by luau » Wed Feb 18, 2015 1:20 pm

There's no easy configuration option I see that users or admins can twiddle to provide this behavior.

That doesn't mean the behavior you're after can't be achieved via other means though. 'Augmented browsing' is what you're after and, given the skills, it's not difficult to get what you want. It took me about 45 minutes total to whip up a decent solution for Firefox. I'm not sure it's something we really want to encourage, but I'll consult the other admins and see what they say.

User avatar
luau
Admin
Admin
Posts: 10036
Joined: Tue Dec 12, 2006 7:07 am
Location: Ft. Lauderdale, FL, USA

Re: Foe Feature

Post by luau » Thu Feb 19, 2015 7:18 am

Okay, nobody cares so here's a nice foe scrubbing script.

You'll need to be using Firefox and you'll need to install the Greasemonkey extension. Or you could use Chrome or Safari but you'll have to read up on the details of running Greasemonkey scripts in them.

The script affects three pages:
index.php: If a listed foe has made the last post in any forum, their name and a link to their profile are tastefully edited so as to minimize the distress caused by their presence.
viewforum.php: The last post link in any topic will be edited as in index.php. Additionally, any topics begun by a foe will be completely hidden.
viewtopic.php: Any post made by a foe will completely hidden. Additionally, all quotes by foes will be completely hidden.

You'll need to edit the script to specify your foes. I've specified the two of us as foes as an example. It's pretty self-explanatory, but I know what I'm doing so don't hesitate to ask for assistance.

You'll need to install the script into Greasemonkey. Just copy it, save it as offsetguitars.user.js on your hard drive, and then install it by clicking the browser's File | Open File menu option and selecting it.

Code: Select all

// ==UserScript==
// @name        offsetguitars.com
// @namespace   offsetguitars.com
// @description offsetguitars.com
// @version     1
// @grant       none
// @include     /^http://www\.offsetguitars\.com/forums/index.*$/
// @include     /^http://www\.offsetguitars\.com/forums/viewforum.*$/
// @include     /^http://www\.offsetguitars\.com/forums/viewtopic.*$/
// ==/UserScript==

try {
    var bad_users = [{name: 'luau', number: '305'},
                     {name: 'AWSchmit', number: '2329'}]; 

    var bu;
    var elems;
    var e;

    for (bu = 0; bu < bad_users.length; ++bu) {
        if (window.location.href.indexOf('viewtopic') > 0) {
            // remove posts
            elems = document.querySelectorAll('p.author > strong > a[href$="' + bad_users[bu].number + '"]');
            for (e = 0; e < elems.length; ++e) {
                elems[e].parentNode.parentNode.parentNode.parentNode.parentNode.style.display = 'none';
            }
    
            // remove quotes
            elems = document.querySelectorAll('blockquote > div > cite');
            for (e = 0; e < elems.length; ++e) {
                if (elems[e].innerHTML.indexOf(bad_users[bu].name) === 0) {
                    elems[e].parentNode.parentNode.style.display = 'none';
                }
            }
        }
        else if (window.location.href.indexOf('viewforum') > 0) {
            // remove topics
            elems = document.querySelectorAll('li.row > dl.icon > dt > a[href$="' + bad_users[bu].number + '"]');
            for (e = 0; e < elems.length; ++e) {
                elems[e].parentNode.parentNode.parentNode.style.display = 'none';
            }
            
            // edit last post by link
            elems = document.querySelectorAll('dd.lastpost > span > a[href$="' + bad_users[bu].number + '"]');
            for (e = 0; e < elems.length; ++e) {
                elems[e].innerHTML = 'DIRTY FOE';
                elems[e].href = 'http://www.apa.org/topics/anger/control.aspx';
            }
        }
        else if (window.location.href.indexOf('index') > 0) {
            // edit last post by link
            elems = document.querySelectorAll('dd.lastpost > span > a[href$="' + bad_users[bu].number + '"]');
            for (e = 0; e < elems.length; ++e) {
                elems[e].innerHTML = 'DIRTY FOE';
                elems[e].href = 'http://www.apa.org/topics/anger/control.aspx';
            }
        }
    }    
}
catch (exception) {
    alert(exception);
}

User avatar
mackerelmint
PAT. # 2.972.923
PAT. # 2.972.923
Posts: 13674
Joined: Sun May 05, 2013 9:51 pm
Location: トイレ国、ウンチ市

Re: Foe Feature

Post by mackerelmint » Thu Feb 19, 2015 8:34 am

Nice!
This is an excellent rectangle

User avatar
mackerelmint
PAT. # 2.972.923
PAT. # 2.972.923
Posts: 13674
Joined: Sun May 05, 2013 9:51 pm
Location: トイレ国、ウンチ市

Re: Foe Feature

Post by mackerelmint » Thu Feb 19, 2015 10:08 am

I just have a question about the "number" attached to the name:
try {
var bad_users = [{name: 'luau', number: '305'},
{name: 'AWSchmit', number: '2329'}];
Everything else is totally self-explanatory, but if every user has a unique number that the site uses to reference them, how are we supposed to find that? I'm assuming that this directs the browser to reference them with their unique number with respect to the site. If I'm way off, then what's that number and how does one determine the correct value for a foe?
This is an excellent rectangle

User avatar
mjet
Expat
Expat
Posts: 4207
Joined: Tue Sep 12, 2006 2:03 pm
Location: Prague, Czech Republic

Re: Foe Feature

Post by mjet » Thu Feb 19, 2015 10:47 am

mackerelmint wrote:
Everything else is totally self-explanatory, but if every user has a unique number that the site uses to reference them, how are we supposed to find that?
Right-click on a username under their avatar and a open the user's profile page. The number is there in the URL.

For instance: mackerelmint = 14037

http://www.offsetguitars.com/forums/mem ... le&u=14037

User avatar
mackerelmint
PAT. # 2.972.923
PAT. # 2.972.923
Posts: 13674
Joined: Sun May 05, 2013 9:51 pm
Location: トイレ国、ウンチ市

Re: Foe Feature

Post by mackerelmint » Thu Feb 19, 2015 11:23 am

mjet wrote:
mackerelmint wrote:
Everything else is totally self-explanatory, but if every user has a unique number that the site uses to reference them, how are we supposed to find that?
Right-click on a username under their avatar and a open the user's profile page. The number is there in the URL.

For instance: mackerelmint = 14037

http://www.offsetguitars.com/forums/mem ... le&u=14037
Aha, thanks!
This is an excellent rectangle

User avatar
luau
Admin
Admin
Posts: 10036
Joined: Tue Dec 12, 2006 7:07 am
Location: Ft. Lauderdale, FL, USA

Re: Foe Feature

Post by luau » Fri Feb 20, 2015 5:24 am

mackerelmint wrote:Nice!
Thanks.

I neglected to mention a couple things besides the user numbers. Once the script is installed into Greasemonkey it'll be saved in your Firefox profile in the gm_scripts/offsetguitars.com directory. The file can be directly edited there in any text editor with no need for any reinstallation steps. I expect other browsers are similar. Also, disable the board software's foe settings and let this script handle everything. Adding someone as a foe in the board software and in the script will probably cause problems.

User avatar
mackerelmint
PAT. # 2.972.923
PAT. # 2.972.923
Posts: 13674
Joined: Sun May 05, 2013 9:51 pm
Location: トイレ国、ウンチ市

Re: Foe Feature

Post by mackerelmint » Fri Feb 20, 2015 10:03 am

Ah, OK. I'll disable my fecal roster and see if that gets it to work. Thanks.
This is an excellent rectangle

User avatar
luau
Admin
Admin
Posts: 10036
Joined: Tue Dec 12, 2006 7:07 am
Location: Ft. Lauderdale, FL, USA

Re: Foe Feature

Post by luau » Fri Feb 20, 2015 10:34 am

The script still strips Foe's quotes from posts when Foe is on the board's foe list, but doesn't strip posts by Foe. Sorry about that.

Post Reply