跳转到主内容
新派编程网 - 新潮编程理念,全新技术课堂!

用于自动添加Digg This!按钮的JavaScript_黑客性质

复制代码代码如下:var main=document.getElementById("main");var singlepost=false;var firstpost;var anchor;for(var i=0;i{if(main.childNodes[i].className&&main.childNodes[i].className=="post"){var post=main.childNodes[i];if(!firstpost){firstpost=post;}for(var j=0;j{if(post.childNodes[j].className&&post.childNodes[j].className=="posthead"){var posthead=post.childNodes[j];if(posthead.childNodes[1]&&posthead.childNodes[1].tagName&&posthead.childNodes[1].tagName=="H2"){if(posthead.childNodes[1].childNodes[1]&&posthead.childNodes[1].childNodes[1].tagName&&posthead.childNodes[1].childNodes[1].tagName=="A"){anchor=posthead.childNodes[1].childNodes[1];}else{anchor=posthead.childNodes[1].childNodes[0];}}else{anchor=posthead.childNodes[0].childNodes[0];}anchor.style.fontSize="14pt";if(anchor.className&&anchor.className=="singleposttitle"){singlepost=true;}}}}}if(singlepost){var postfoot=document.createElement("div");firstpost.appendChild(postfoot);postfoot.className="postfoot";postfoot.innerHTML="Add to del.icio.us";postfoot.innerHTML+="Digg This!";postfoot.innerHTML+="Share on Facebook";postfoot.innerHTML+="Google Bookmark This";}

相关文章