home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 February / CMCD0205.ISO / Software / Freeware / Comunicatii / slimbrow / sbsetup.exe / ScriptFilter.js < prev    next >
Text File  |  2003-12-16  |  2KB  |  84 lines

  1. //AllFrames
  2. function ScriptFilter(bFlash,bMovingObj,bBanner,bHideOnly)
  3. {
  4.     mdoc=document;
  5.     var badobjs=new Array(3);
  6.     if (bFlash)
  7.     {
  8.         for(var i=0;i<mdoc.embeds.length;i++)
  9.         { 
  10.             var obj=mdoc.embeds[i];
  11.             if (obj.attributes["type"].nodeValue.toLowerCase()=="application/x-shockwave-flash")
  12.             {
  13.                 badobjs.push(obj);
  14.             }
  15.         }
  16.     }
  17.     var objs=document.all;
  18.     var l=objs.length;
  19.     for (i=0;i<l;i++)
  20.     {
  21.         var obj=objs[i];
  22.         try
  23.         {
  24.           if (bFlash && obj.tagName=="OBJECT" && obj.classid=="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000")
  25.           {
  26.               badobjs.push(obj);
  27.           }
  28.         } 
  29.         catch(e)
  30.         {
  31.         }
  32.         
  33.         try
  34.         {
  35.           if (bBanner && (obj.tagName=="IMG" || obj.tagName=="IFRAME"))
  36.           {
  37.                 if (obj.width==468 && obj.height==60 || 
  38.                         obj.width==728 && obj.height==90 ||
  39.                         obj.width==234 && obj.height==60 ||
  40.                         obj.width==88 && obj.height==31 ||
  41.                         obj.width==120 && obj.height==90 ||
  42.                         obj.width==120 && obj.height==60 ||
  43.                         obj.width==125 && obj.height==125 ||
  44.                         obj.width==120 && obj.height==240 ||
  45.                         obj.width==180 && obj.height==150 ||
  46.                         obj.width==300 && obj.height==250 ||
  47.                         obj.width==336 && obj.height==280 ||
  48.                         obj.width==240 && obj.height==400 ||
  49.                         obj.width==250 && obj.height==250 ||
  50.                         obj.width==120 && obj.height==600 ||
  51.                         obj.width==160 && obj.height==600)
  52.                 {
  53.                     badobjs.push(obj);
  54.                 }
  55.             }
  56.       }
  57.       catch(e)
  58.       {
  59.       }
  60.  
  61.         try
  62.         {
  63.           if (bMovingObj && obj.style.position=="absolute" && obj.clientHeight<250 && obj.clientWidth<250)
  64.           {
  65.               badobjs.push(obj);
  66.           }
  67.         }
  68.         catch(e)
  69.         {
  70.         }
  71.     }
  72.     
  73.     for (i=0;i<badobjs.length;i++)
  74.     {
  75.         try
  76.         {
  77.             if (bHideOnly) badobjs[i].style.visibility="hidden";
  78.           else badobjs[i].outerHTML="";
  79.       }
  80.         catch(e)
  81.         {
  82.         }
  83.     }
  84. }