<script language="javascript">
/* * * * * * * * *
函数名称:objAdCleaner
入口参数:不固定,见调用说明
返回值:无
功能:清除object(即flash)、link和script形式的广告代码。
调用说明:
有2种调用方式:无参数、参数列表
1)无参数:此方式下清除所有非本站的广告;
2)参数列表:此种方式需传入多个广告站点判别字符串(如:域名),以逗号分隔。
* * * * * * * * */
function objAdCleaner(){
var iClearType=0;
var aAdHost;
var sMyHost=document.location.hostname;
if(arguments.length==0){
if(this.sMyHost=="" || this.sMyHost==undefined){
this.iClearType=0;
}else{
this.iClearType=1;
}
}else{
this.aAdHost=new Array();
for(var i=0;i<arguments.length;i++){
this.aAdHost.push(arguments[i].toString().toUpperCase() );
}
this.iClearType=2;
}
this.removeAllADs=function(){
for(i = document.all.length-1; i >=0; i--){
var ele=document.all(i);
var elt=ele.tagName.toUpperCase();
elt=="OBJECT"&& this.testAndDelete(ele,"data");
elt=="SCRIPT"&& this.testAndDelete(ele,"src");
elt=="A"&& this.testAndDelete(ele,"href");
}
}
this.isAdTest=function(url){
var rst=false;
if(this.iClearType==1){
rst=( url.toUpperCase().indexOf( this.sMyHost.toUpperCase() )<0);
}
if(this.iClearType==2){
for(var i=0;i<this.aAdHost.length;i++){
if( url.toUpperCase().indexOf( this.aAdHost[i] )>=0){
rst=true;
break;
}
}
}
return rst;
}
this.testAndDelete=function(oNode,sAttribute){
if(this.isAdTest(oNode[sAttribute])){
try{
oNode.removeNode(true);
}catch(e){}
}
return false;
}
this.removeAllADs();
}
</script>
<BODY οnlοad="objAdCleaner('ad.yieldmanager.com','optimizedby.rmxads.com','content.yieldmanager.edgesuite.net');">