/*
    Hide heise.de IT-/Online Markt
    (c) Volker Gropp
    http://www.gropp.org

    done with alot help by http://diveintogreasemonkey.org
    	2005-05-08: added leaderboard block, no ads on top of news anymore
	            and added sales block, ads on the left
	2006-04-29: cleanup by Jan Große 

    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, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/

// ==UserScript==
// @name            Hide heise.de IT-/Online Markt & all ads
// @namespace       http://www.gropp.org
// @description     (2006-04-29) Hides heise.de IT-/Online Markt and all Ad
// @include         http://www.heise.de/*
// ==/UserScript==

(function() {

var allDivs, thisDiv,textAd,currentAd, thisSpan, allSpan;
var meldungWrappers;
divsToBlock = new Array("leaderboard","skyscraper", "contentbanner", "heiseadvert", "adbottom_itmarkt","sales");

meldungWrappers = document.evaluate("//div[@class='meldung_wrapper']",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var n = 0; n < meldungWrappers.snapshotLength; n++) {
    allDivs = document.evaluate("//table[@cellpadding='3']",meldungWrappers.snapshotItem(n),null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    for (var i = 0; i < allDivs.snapshotLength; i++) {
        thisDiv = allDivs.snapshotItem(i);
        allSpan = document.evaluate("//img[@height='1']",thisDiv,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
        if (allSpan.snapshotLength) {
            thisDiv.parentNode.removeChild(thisDiv);
        }
    }
}

for(var n = 0; n < divsToBlock.length; n++){
	allDivs = document.evaluate("//div[@class='"+divsToBlock[n]+"']",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
	for (var i = 0; i < allDivs.snapshotLength; i++) {
	    thisDiv = allDivs.snapshotItem(i);
	    thisDiv.parentNode.removeChild(thisDiv);
	}
}

var allH4,thisH4;
allH4 = document.evaluate("//h4[@class='kasten_markt_titel']",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
thisH4 = allH4.snapshotItem(0);
if (thisH4) {
	thisH4.parentNode.removeChild(thisH4);
}

var allTable,thisTable;
allTable = document.evaluate("//table[@class='kasten_markt']",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);
thisTable = allTable.snapshotItem(0);
if (thisTable) {
	thisTable.parentNode.removeChild(thisTable);
}
})();

