Friday, October 21, 2011

CPAlead & Leadbolt Remover


// ==UserScript==
// @name           CPAlead & Leadbolt Remover
// @namespace      http://cpa.vienalga.net
// @description    Bypasses CPAlead.com and Leadbolt.net popups
// @include        http://*.*
// @version        3.3.4
// @author         Cukurgalva
// ==/UserScript==
//
//
/* Change Log

Oct 19, 2011
  Added other cpalead domain "widgetlead.net"
Oct 10, 2011
  Fixed AdWorkMedia support
Sep 14, 2011
  Fixed "valuecontent.net" domain detection (thanks to qweqwe)
  Fixed WYSIWYG bug (on Opera)
Sep 8, 2011
  Added AdWorkMedia support
  Added other cpalead domain "trackpromotion.net"
  Added other cpalead domain "valuecontent.net"
Aug 9, 2011
  Added other cpalead domain "trackadvertising.net"
Jul 31, 2011
  Added Leadbolt support
Oct 20, 2010
  Refixed WYSIWYG (iframe) bug
  Improved CPAlead script detection (less trash on clean sites)
  Removed CPAlead prompt on close
Oct 11, 2010
  Fixed script for new CPAlead update
Sep 14, 2010
  Fixed WYSIWYG (iframe) bug (on FireFox & Chrome)
Jan 17, 2011
  Added other cpalead domain "advertisingvalue.info"
  Minor fixes
*/


// isolation for Opera
(function(){

var js = document.location.href.toLowerCase();
if ((js.indexOf('cpalead.com/mygateway/') != -1) || 
 (js.indexOf('advertisingvalue.info/mygateway/') != -1)){
 var toDOM = document.createElement('script');
 toDOM.innerHTML='if (window.ajax_returned == 0){window.ajax_returned = 1;document.location.href=\'about:blank\'}';
 document.body.appendChild(toDOM);
}

// seeking for "<script src="http://cpalead ..."
var detect_cpa = 0;
scripts = document.getElementsByTagName('script');
for(var i = 0; i < scripts.length; i++){
 try{
  var js = scripts[i].src.toLowerCase();
  if ((js.indexOf('cpalead.com/mygateway.php') != -1) || /* CPALead */
   (js.indexOf('advertisingvalue.info/cpalock.php') != -1) || /* CPALead */
   (js.indexOf('trackingoffer.net/show_cu.js') != -1) || /* CPALead */
   (js.indexOf('trackpromotion.net/show_cu.js') != -1) || /* CPALead */
   (js.indexOf('http://valuecontent.net/') != -1) || /* CPALead */
   (js.indexOf('http://widgetlead.net/') != -1) || /* CPALead */
   (js.indexOf('ad.leadbolt.net/show_cu.js') != -1) || /* LeadBolt */
   (js.indexOf('www.adworkmedia.com/gloader.php') != -1)) /* AdWorkMedia */ {
   
   detect_cpa = 1;
  }
 }
 catch(err){}
}
// seeking script cleanup
delete scripts;


// cpalead found
if (detect_cpa) {
 // create isolated Script on DOM level
 var toDOM = document.createElement('script');
 toDOM.innerHTML =  '(' + (function(){
  // insert NoCPA code
  var d=0;
  
  // for cpalead
  function NoCPA(){
   // Seeks for "Thank you" function
   for(var i in window){
    if(typeof(window[i]) == 'function'){
     if(window[i].toString().toLowerCase().indexOf('about:blank') != -1){
      // seeking for gatehash variable name (FireFox)
      var r = new RegExp('if \\(([a-zA-Z0-9]*) != ([a-zA-Z0-9]*)\\) \\{');
      var hash = r.exec(window[i].toString());
     
      // seeking for gatehash variable name (Opera)
      if (!hash){
       r = new RegExp('if\\(([a-zA-Z0-9]*)!=([a-zA-Z0-9]*)\\)\\{');
       hash = r.exec(window[i].toString());
      }
 
      // executes "Thank you" function with Gateid and Gatehash args
      if (hash){
       try{
        window[i]('NDMxMg%3D%3D',window[hash[2]]);
       }
       catch(err){}
      }
     }
    }
   }

   // Repeates 20 times
   d++;
   if (d<20){
    setTimeout(NoCPA, 500);
   }
  };
  

  //begin !!!
  // cpalead
  if (typeof(window.startGateway) == 'function') {
   // Removes CPAlead startup and displaying functions
   window.startGateway=function(gateid){return false;}
 
   // Destroys CPAlead from inside
   NoCPA();
  }
  
  window.addEventListener('load', function(event) {
   // leadbolt
   if (typeof(window.ap_cu) == 'object') {
    window.ap_cu.bypass_exit = true;
    clearInterval(window.ap_cu.timer);
    window.ap_cu_object_restore();
    window.document.body.removeChild(window.document.getElementById('ap_cu_overlay'));
    window.document.body.removeChild(window.document.getElementById('ap_cu_wrapper'));
    window.document.body.scroll = 'yes';
    window.document.body.style.overflow = 'auto';
   }

   // AdWorkMedia
   if (window.awm){
    try{
     var i = /([0-9a-f]{32,64})\(\)/i.exec(checkStatus.toString());
     window[i[1]]();
    }catch(err2){};
    //removegateway();
    checkStatus = scrollToTop = document.onmousedown = document.onmouseup = document.oncontextmenu = document.oncontextmenu = function(){return true;};
   }

  }, false);
 
  
 // end inner NoCPA code
 }).toString() + ')();'; 
 document.body.appendChild(toDOM);
// end CPAlead detection
}

// DOM cleanup
delete toDOM;
scripts = document.getElementsByTagName('script');
for(var i = 0; i < scripts.length; i++){
 try {
  if (scripts[i].innerHTML.indexOf('NDMxMg%3D%3D') != -1){
   scripts[i].parentNode.removeChild(scripts[i]);
  }
 }
 catch(err2){}
// end DOM cleanup
}


// end Opera isolation
})();

0 comments:

Post a Comment