sxc.hu (stock.xchng) Cleaner

By Caio Guimarães Last update Apr 26, 2008 — Installed 377 times.

Updated and improved

in
Subscribe to Updated and improved 2 posts, 2 voices



ficod User
FirefoxMacintosh

Could someone check it? Maybe the author will include it in next relase of the script??

// ==UserScript==
// @author         Caio Guimarães
// @version        1.0
// @email          guirica@uol.com.br
// @name           sxc.hu (stock.xchng) Cleaner
// @description    This script cleans the site www.sxc.hu by removing the follow advertising items: 1) Banners (left small banner and top big banner); 2) Premium Row (caption and thumbs); 3) Text links.
// @include        http://www.sxc.hu/*
// ==/UserScript==

function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\\\s)"+searchClass+"(\\\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function getNextSibling(startBrother){
  endBrother=startBrother.nextSibling;
  while(endBrother.nodeType!=1){
    endBrother = endBrother.nextSibling;
  }
  return endBrother;
}

trail_image = document.getElementById("trailimageid");
trail_image.style.display = "none";

header_site = document.getElementById("header");
header_site.style.padding = "0";

premium_head = document.getElementById("sxpt2_1");
premium_head.style.display = "none";

premium_content = document.getElementById("sxptt_1");
premium_content.style.display = "none";

premium_pagination = document.getElementById("sxpt2_2");
premium_pagination.style.display = "none";

bigBanner = document.getElementById("ads1");
bigBanner.style.display = "none";

smallBanner = getElementsByClass("bann", document, "div");
smallBanner[0].style.display = "none";

textLinks = document.getElementById('textlinks');
textLinks.style.display = "none";

premiumCaption = getElementsByClass("wb", document, "div");
premiumCaption[0].style.display = "none";

premium_spacer = getNextSibling(premiumCaption[0]);

if (premium_spacer.getAttribute("class") == "wbs"){
	premium_spacer.style.display = "none";
}

thumbRows = getElementsByClass("thumb_row", document, "div");
premiumRow = thumbRows[(thumbRows.length - 1)];
premiumRow.style.display = "none";

 
musichemyst User
FirefoxWindows

Works great! Thanks!

On a related note, for users who want to use this script but would like to keep the functionality of the popup previews when hovering on thumbnails in search results, remove the following two lines from the code ficod posted above:

trail_image = document.getElementById("trailimageid");
trail_image.style.display = "none";

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel