百度Favicon
当前为
// ==UserScript==
// @name AC-百度Favicon
// @namespace BlockKafanTopicinGoogle
// @include http://www.baidu.com/*
// @include https://www.baidu.com/*
// @icon https://coding.net/u/zb227/p/zbImg/git/raw/master/img0/icon.jpg
// @author AC
// @version 0.2.9
// @description 百度Favicon
// @grant none
// ==/UserScript==
//===================================================普通规则变量定义=======================================================
//===================================================主入口=======================================================
mo = new MutationObserver(function(allmutations) {
//alert();
blockKafanBaidu();
});
var targets = document.body;
var fatherName = "result c-container ";
mo.observe(targets, {'childList': true,'characterData':true,'subtree': true});
//document.addEventListener('DOMNodeInserted',blockKafanBaidu,false);
function blockKafanBaidu() {
var isBaidu = (location.href.indexOf('.baidu.com') > -1);
var citeList;
if(isBaidu){
citeList = document.getElementsByClassName('c-showurl'); //之前取的是g,但这个标签在google中是最大的标签,导致谷歌页面卡住,所以先判断是baidu站点
deal(citeList)
}
}
// 传入nodelist,然后查找两个列,查看是否一致,一致则删除
function deal(citeList){
for (var index = 0; index < citeList.length; index++) {
var element = replaceAll(citeList[index].innerHTML);
if(citeList[index].getAttribute("deal") == null){
citeList[index].setAttribute("deal", "1");
deal_fatherNode(citeList[index], getFaviconUrl(element));
}
}
}
function deal_fatherNode(node, faviconUrl){
var curNode = node;
for(II = 0; II <= 5; II++){
curNode = curNode.parentNode;
if(curNode.className == fatherName){
break;
}
}
if(II <= 5){
var imgHTML = "<img src=\"http://"+faviconUrl+"\" height=20 width=20> ";
curNode.firstChild.innerHTML = imgHTML + curNode.firstChild.innerHTML
//alert(curNode.firstChild.innerHTML);
}
}
/*去掉网址中的<xxx>*/
function replaceAll(sbefore){
var send;
send = sbefore.replace(/<[^>]*>/g ,"");
return send;
}
function getFaviconUrl(citeUrl){
var url = citeUrl.replace(/\/.*/g,"");
return url+"/favicon.ico";
}
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址