Advertisement
Guest User

kiki6710

a guest
Aug 27th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function() {
  2.     'use strict';
  3.  
  4.    /*Script create by kiki67100 remove facebook ads */
  5.    function CheckFacebookAds(){
  6.      jQuery('a[href*="/ads/about"]').each(function(){
  7.        
  8.         var i=0,
  9.             last_parent,
  10.             last_parent_height,
  11.             tmp_el=$(this),
  12.             height;
  13.  
  14.         for(i=0;i<30;i++){
  15.  
  16.             tmp_el=$(tmp_el).parent();
  17.             height=$(tmp_el).height();
  18.  
  19.             if( (height-last_parent_height) > 500 ){
  20.                 console.log("Height > 500 out of ads remove the last_parent");
  21.                
  22.                 console.log(last_parent);
  23.                 $(last_parent).remove();
  24.                
  25.                 break;
  26.             }
  27.             last_parent=$(tmp_el);
  28.             last_parent_height=height;
  29.  
  30.             console.log("parent n [",i,"] = height() = ",height);
  31.         }
  32.  
  33.  
  34.     });
  35.    }
  36.  
  37.    setInterval(function(){
  38.  
  39.     CheckFacebookAds();
  40.  
  41.    },3000);
  42.  
  43.  
  44.  
  45. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement