eBay Hacks - Show only negative feedback Mod

By thorbenhauer Last update Nov 19, 2008 — Installed 16,369 times. Daily Installs: 6, 7, 6, 16, 4, 9, 8, 6, 9, 11, 3, 8, 13, 15, 10, 4, 4, 13, 8, 6, 5, 8, 9, 5, 7, 10, 10, 12, 8, 12, 25, 9

There are 2 previous versions of this script.

// ==UserScript==
// @name          eBay Hacks - Show only negative feedback Mod
// @namespace     http://userscripts.org/users/9022
// @description   http://userscripts.org/scripts/show/5060
// @version       0.6
// @date          2008-11-19
// @copyright     2006-2008, thorbenhauer
// @license       GPL 2 or later
// @include       http://feedback*.ebay.tld/*ws/eBayISAPI.dll?*
//                for Opera (which doesn't understand tld):
// @include       http://feedback.ebay.com.au/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.at/*ws/eBayISAPI.dll?*
// @include       http://feedback.befr.ebay.be/*ws/eBayISAPI.dll?*
// @include       http://feedback.benl.ebay.be/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.ca/*ws/eBayISAPI.dll?*
// @include       http://feedback.cafr.ebay.ca/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.fr/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.de/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.com.hk/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.in/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.ie/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.it/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.com.my/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.nl/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.ph/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.pl/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.com.sg/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.es/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.ch/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.co.uk/*ws/eBayISAPI.dll?*
// @include       http://feedback.ebay.com/*ws/eBayISAPI.dll?*
// ==/UserScript==
//
// -----------------------------------------------------------------------------
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// -----------------------------------------------------------------------------
//
// Based on eBay Hacks - Show only negative feedback user script
// Script location: http://userscripts.org/scripts/show/696
//
// -----------------------------------------------------------------------------
//
// With Contributions by Lucas Malor (http://userscripts.org/users/27940)
// and Mithrandir (http://userscripts.org/users/5587)
// Thanks!
//
// -----------------------------------------------------------------------------

(function () { // function wrapper for Opera

/*
 Configure site
 
 Possible values:
 - "toolhaus"
   Show only the negative and neutral comments via toolhaus.org.
 - "ebay"
   Show only the negative comments for the last 365 days via internal eBay
   function.
*/
var site = "toolhaus";

/*
 Configure view (only relevant when site = "toolhaus")
 
 Possible values:
 - true
   Loads toolhaus.org in an iframe.
 - false
   Create regular links to toolhaus.org
*/
var iFramed = true;

var userid, anchor, rcvdURL, rcvdString, rcvdTitle, leftURL, leftString,
    leftTitle;
var tld = document.domain.split(".ebay.")[1];
var be = "";
if (tld == "be") {
    be = "." + document.domain.split(".ebay.")[0].split(".")[1];
}
switch (site) {
    case "ebay":
        rcvdURL = "http://feedback" + be + ".ebay." + tld +
            "/ws/eBayISAPI.dll?ViewFeedback2&ftab=AllFeedback&" +
            "items=200&interval=365&which=negative&userid=";
        break;
    case "toolhaus":
        rcvdURL = "http://toolhaus.org/cgi-bin/negs?Dirn=Received+by&User=";
        leftURL = "http://toolhaus.org/cgi-bin/negs?Dirn=Left+by&User=";
        break;
    default:
        rcvdURL = "http://toolhaus.org/cgi-bin/negs?Dirn=Received+by&User=";
        leftURL = "http://toolhaus.org/cgi-bin/negs?Dirn=Left+by&User=";
        break; 
}
switch (tld) {
    case "de":
    case "at":
    case "ch":
        if (site == "toolhaus") {
            rcvdURL =
                "http://toolhaus.org/cgi-bin/negs-de?Dirn=Erhaltene&User=";
            leftURL =
                "http://toolhaus.org/cgi-bin/negs-de?Dirn=Abgegebene&User=";
        }
        rcvdString = "Erh. Beschw.";
        rcvdTitle = "Erhaltene Beschwerden";
        leftString = "Abg. Beschw.";
        leftTitle = "Abgegebene Beschwerden";
        break;
    case "com":
    case "com.au":
    case "ca":
    case "in":
    case "ie":
    case "com.my":
    case "ph":
    case "com.sg":
    case "co.uk":
        rcvdString = "Comp. rec.";
        rcvdTitle = "Complaints received";
        leftString = "Comp. left";
        leftTitle = "Complaints left";
        break;
    case "it":
        rcvdString = "Neg. ricevuti";
        rcvdTitle = "Neg. ricevuti";
        leftString = "Neg. dati";
        leftTitle = "Neg. dati";
        break;
    default:
        rcvdString = "Comp. rec.";
        rcvdTitle = "Complaints received";
        leftString = "Comp. left";
        leftTitle = "Complaints left";
        break;
}
 
anchor = document.evaluate("//table[contains(@class, " +
    "'pageTab-pageLevels')]/tbody/tr", document, null,
    XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
var classDummy = 'pageTab-dummy';
var classActiveLeft = 'pageTab-activeLft';
var classActiveRight = 'pageTab-activeRgt';
var classInactiveLeft = 'pageTab-inactiveLft';
var classInactiveRight = 'pageTab-inactiveRgt';
var classLink = 'pageTab-padd';
if (anchor == null) {
    anchor = document.evaluate("//table[contains(@class, 'bstab-tabs')]" + 
        "/tbody/tr", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,
        null).singleNodeValue;
    classDummy = 'bstab-dummy';
    classActiveLeft = 'bstab-actLft';
    classActiveRight = 'bstab-actRgt';
    classInactiveLeft = 'bstab-iLft';
    classInactiveRight = 'bstab-iRgt';
    classLink = 'bstab-padd';        
}
userid = document.evaluate("//div[@id = 'MemberDetailsDiv']//" +
    "a[contains(@href, 'myworld.')]/@href", document, null,
    XPathResult.FIRST_ORDERED_NODE_TYPE,
    null).singleNodeValue.value.split("/");
userid = userid[userid.length - 1];
var td = document.createElement("td");
td.setAttribute("class", classDummy);
anchor.appendChild(td);
td.setAttribute("style", "padding-right: 3px");
td = document.createElement("td");
td.setAttribute("class", classInactiveLeft);
td.id = "FeedbackTabs_tab_lft_5";
anchor.appendChild(td);
td = document.createElement("td");
td.setAttribute("class", classInactiveRight);
td.id = "FeedbackTabs_tab_rgt_5";
td.innerHTML = '<a id="rcvd" class="' + classLink + '" title="' + rcvdTitle +
    '" href="' + rcvdURL + userid + '">' + rcvdString + '</a>';
anchor.appendChild(td);
if (site == "toolhaus" && iFramed) {
    td.addEventListener("click", framing, false);
    var div, rcvdIframe, leftIframe, bckp, parent, active;
    bckp = document.evaluate("//table[@class='FbOuterYukon']",
        document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,
        null).singleNodeValue;
    parent = bckp.parentNode;
    div = document.createElement("div");
    parent.replaceChild(div, bckp);
    div.appendChild(bckp);
    active = document.evaluate("//td[@class='" + classActiveRight + "']",
        document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,
        null).singleNodeValue;
    var a = active.getElementsByTagName("a")[0];
    a.setAttribute("id", "bckp");
    a.addEventListener("click", framing, false);
}
if (site != "ebay") {
    td = document.createElement("td");
    td.setAttribute("class", classDummy);
    anchor.appendChild(td);
    td.setAttribute("style", "padding-right: 3px");
    td = document.createElement("td");
    td.setAttribute("class", classInactiveLeft);
    td.id = "FeedbackTabs_tab_lft_6";
    anchor.appendChild(td);
    td = document.createElement("td");
    td.setAttribute("class", classInactiveRight);
    td.id = "FeedbackTabs_tab_rgt_6";
    td.innerHTML = '<a id="left" class="' + classLink + '" title="' +
        leftTitle + '" href="' + leftURL + userid + '">' + leftString + '</a>';
    if (site == "toolhaus" && iFramed) {
        td.getElementsByTagName("a")[0].addEventListener("click",
            framing, false);
    }
    anchor.appendChild(td);
}
anchor = document.getElementsByTagName("head")[0];
var style = document.createElement("style");
style.innerHTML = "td." + classInactiveRight + " * {font-size: x-small " +
    "!important;} td." + classActiveRight +
    " * {font-size: x-small !important;}";
anchor.appendChild(style);

function framing(event) {
    event.preventDefault();
    switch (event.target.id) {
        case "rcvd":
            bckp.style.display = "none";
            if (leftIframe != null) {
                leftIframe.style.display = "none";
            }
            if (rcvdIframe == null) {
                rcvdIframe = createIframe("rcvd", userid);
                div.appendChild(rcvdIframe);
            }
            rcvdIframe.style.display = "";
            break;
        case "left":
            bckp.style.display = "none";
            if (rcvdIframe != null) {
                rcvdIframe.style.display = "none";
            }
            if (leftIframe == null) {
                leftIframe = createIframe("left", userid);
                div.appendChild(leftIframe);
            }
            leftIframe.style.display = "";
            break;
        case "bckp":
            if (rcvdIframe != null) {
                rcvdIframe.style.display = "none";
            }
            if (leftIframe != null) {
                leftIframe.style.display = "none";
            }
            bckp.style.display = "";
            break;
    }
    var parent = event.target.parentNode; 
    if (parent.nodeName == "TD") {
        active.setAttribute("class", classInactiveRight);
        active.previousSibling.setAttribute("class", classInactiveLeft);
        parent.setAttribute("class", classActiveRight);
        parent.previousSibling.setAttribute("class", classActiveLeft);
        active = parent;
    } else {
        active.setAttribute("class", "");
        parent.setAttribute("class", "active");
        active = parent;
    }
}

function createIframe(mode, uid) {
    var iframe = document.createElement("iframe");
    switch (mode) {
        case "rcvd":
            iframe.setAttribute("src", rcvdURL + userid);
            break;
        case "left":
            iframe.setAttribute("src", leftURL + userid);
            break;
    }
    iframe.setAttribute("style", "background-color: white; " +
        "width: 99.6%; height: 860px; display: block;");
    return iframe;
}

})(); // function wrapper for Opera