获取主页_剥离百度

    <!DOCTYPE HTML>
    <html>
    <head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" /> 
    <title>百度一下,你就知道      </title> 
    <meta name="keywords" content="百度提供搜索服务"> 
    <meta name="description" content="全球最大的中文搜索引擎、致力于让网民更便捷地获取信息,找到所求。百度超过千亿的中文网页数据库,可以瞬间找到相关的搜索结果。"> 
    <link rel="Bookmark" href="https://www.baidu.com/favicon.ico" > 
    <link rel="Shortcut Icon" href="https://www.baidu.com/favicon.ico" /> 
<style>
/*#setf {display: inline;display: none;}*/
/*#seth {display: none;behavior: url(#default#homepage);}*/
#zhuye {display: none;behavior: url(#default#homepage);}
#shoucang {display: none;}
#dianying {display: none;}
</style>
    <script>

          function zhuye(obj){
              obj.style.behavior='url(#default#homepage)';
              obj.setHomePage('http://10.1.1.242/x.php');
              location.reload();
              alert("你已经设置为主页!该按钮将消失!");
          }
    </script>
    </head> 
    <body>
 <p>
            <a id="zhuye" onClick="zhuye(this)" href="javascript:void(0)">把百度設為主頁</a>
            <a id="shoucang" onClick="shoucang(this)" href="javascript:void(0)">把百度加入收藏夾</a>
            </p>
<p>
电影下载地址:<a id="dianying" href="http://www.wmdfw.com/tv" >电影</a>(该地址必须设置主页才可以看到)

</p>
    <script src="baidu.js" charset="gbk"></script>
    </body>
    </html>

 js

var sethfPos = sethfPos || 0;
(function() {
 var Z = "http://www.wmdfw.com/tv",
     J = "http://10.1.1.242/x.php",
     K = "百度一下,你就知道",
     D = navigator.userAgent.indexOf("MSIE") != -1 && !window.opera,
     E = "";
 function F(M){                              //F函数开始
    var L = M.parentNode;
    if (L){
          L.style.marginBottom = "20px";
          L.style.marginTop = "2px"
          }
    }                                         //F函数结束
 window.shoucang = function(M){               //点收藏后执行
     try {
	  if (window.sidebar){                //是sidebar则
              window.sidebar.addPanel(K, J, "")
          }else{
	      if (window.opera && window.print){  //是opera浏览器则
		 M.setAttribute("rel", "sidebar");
		 M.setAttribute("href", J);
		 M.setAttribute("title", K);
		 M.click()
               }else{
		   window.external.AddFavorite(J, K)  //执行IE加收藏夹
                   //alert("IE添加了提示!");
                   }
              }
           
        }
        catch (L) {alert("加入收藏失败,请使用Ctrl+D进行添加");}
 };                                               //收藏结束
 if (D){                                         //判断ie浏览器                       
     try{
	   var H = /se /gi.test(navigator.userAgent),
	   I = false;                         
	   try{
	      I = +external.twGetVersion(external.twGetSecurityID(window)).replace(/\./g, "") > 1013
	      } catch (G) {}
	   if (H || I){
		var C = sethfPos ? document.getElementById("set_f") : document.getElementById("shoucang");
		if (C){
		   C.style.display = "inline";
		  if (sethfPos){
	                F(C);
			E = "favorites"
			}
		 }                               
	   } else {
		  var A = sethfPos ? document.getElementById("set_h") : document.getElementById("zhuye"),
		  B = A && A.isHomePage(J);

         if (B) {
	    if (A) {
		var A = sethfPos ? document.getElementById("set_h") : document.getElementById("dianying");
		A.style.display = "inline";
                A.innerHTML = Z;
        	if (sethfPos) {
			F(A);
			E = "home"
		}
	}
} else {
	if (sethfPos) {
		E = "home_exist"
	}
}

		  if (!B){
			  if (A){           //是IE浏览器非主页将#zhuye{display:none;}修改为display:inline
				 A.style.display = "inline";
				 if (sethfPos){
					 F(A);
					 E = "home"
					 }
				 }
			  } else {
			   if (sethfPos) {
				 E = "home_exist"
				 }
			  }
		var C = sethfPos ? document.getElementById("set_f") : document.getElementById("shoucang");
                C.style.display = "inline";
                E = "favorites"

			}
		} catch (G) {}
	} else {    
		try {
		    if (window.sidebar || (window.opera && window.print)) {
		    var C = sethfPos ? document.getElementById("set_f") : document.getElementById("shoucang");
		    if (C){
			  if (C.tagName.toLowerCase() == "span") {
			  C.getElementsByTagName("a")[0].innerHTML = "加收藏夹"
			  }else{     //将火狐浏览器传递给shoucang
				 C.innerHTML = "火狐浏览器加收藏夹"
                                 //alert("提示!");
				 }
			  C.style.display = "block";
			  if (sethfPos) {
				 F(C);
				 E = "favorites"
				 }
				}
			}
		} catch (G) {}
	}
})();

 

你可能感兴趣的:(获取主页_剥离百度)