Google introduces domain blocking on search. Plus Greasemonkey Script
2011-03-12 05:20:38
So, I read on Slashdot that Google has implemented domain blocking on search. Which is a pretty cool feature. There's a lot of sites that pop up in search results that usually aren't what you're looking for, but usually game the searching algorithm to get more hits on their site. Of course the first recommendation for a block was Experts-Exchange. But some people brought up a good point. Sometimes the almighty hyphen has some good answers, and it's not much work to scroll down to the bottom of the page to get them. So I thought, there must be a way to resolve this conflict. The answer? Greasemonkey. In case you aren't familiar with it, Greasemonkey is a plugin for Firefox that allows you to run javascript after the page has loaded. I wrote a script that removed all the unpleasant bits of the Experts-Exchange site. Anyway, the following is the code. Let me know if you have any suggestions, problems or improvements.
// ==UserScript==
// @name Fix The Hyphen Site
// @namespace Kibbee
// @description Fixes the evil hyphen site
// @include http://www.experts-exchange.com/*
// ==/UserScript==
function HideByXPath(XPathToHide)
{
var allDivs, thisDiv;
allDivs = document.evaluate(
XPathToHide,
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
for (var i = 0; i < allDivs.snapshotLength; i++) {
thisDiv = allDivs.snapshotItem(i);
thisDiv.style.display = 'none';
}
}
HideByXPath("//div[@class='acceptedBlurredSolution']");
HideByXPath("//div[contains(@class,'relatedSolutionsContainer')]");
HideByXPath("//div[contains(@class,'allZonesMain')]");
HideByXPath("//div[@class='theAdvert']");
HideByXPath("//div[@id='navAdBanner']");
HideByXPath("//div[@id='pageRight']");
HideByXPath("//div[@id='topBanner']");
document.getElementById('pageHeader').style.height = '125px';
|