I have been using codeguru.com for years and the inline commercials/ads are just taking up to much space. Not to talk about the forums with the “Click to remove” ad. Really annoying.
Most of you uses Firefox and you have probably heard about the Greasemonkey scripts and it is the bomb! If you don’t have it installed, get it here https://addons.mozilla.org/en-US/firefox/addon/748
Now for the script, download it from here: codeguru.user.js or from userscripts.org (great site)
If nothing works then add your own script with the site *.codeguru.com* as site to react to
// ==UserScript== // @name Codeguru Inline Ads Remover // @namespace http://lars.werner.no // @description Removes inline commercials at codeguru.com and the forum // @include *.codeguru.com* // ==/UserScript== var isForum = (location.href.indexOf('/forum') != -1); var isArticle = (location.href.indexOf('/article.php') != -1); var isMain = (location.href=='http://codeguru.com') || (location.href=='http://www.codeguru.com') || (location.href=='http://codeguru.com/') || (location.href=='http://www.codeguru.com/'); //Gets the elements by it class 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; } //Hides the class we're looking for function removeClass(searchClass, node, tag) { var cElements = getElementsByClass(searchClass,node,tag); if (cElements.length > 0) { for (i = 0; i < cElements.length; i++) { cElements[i].parentNode.style.display='none'; //Alternative to just remove that child // cElements[i].parentNode.removeChild(cElements[i]); } } } //Removes the inline commercial in an article function removeInLine() { if(document.body.innerHTML.match('') ) { //Get positions var first = document.body.innerHTML.search(//gi); var last = document.body.innerHTML.search(/') ) { //Get positions var first = document.body.innerHTML.search(//gi); var last = document.body.innerHTML.search(//gi); var length = document.body.innerHTML.length; //Only show what we want to ;) var text = document.body.innerHTML.substring(0, first); text = text + document.body.innerHTML.substring(last, length); document.body.innerHTML = text; } } //////////////////////////////////////////////////////// //Remove the silly adds who blocks 1/4 of your screen... if (isForum) { removeClass("clickhere", document, "span"); } else { if(!isMain) { //Remove the silly inline ads if(isArticle) { removeInLine(); } else { removeInLineList(); } } }
Notify bugs in comments please…
1 Response
[…] recorded first by jimmydushku on 2008-08-23→ Codeguru.com inline ads removal script […]