当前位置:首页 > 网站运营 > 经验心得 > > 在zblog中添加流行网摘的js代码

在zblog中添加流行网摘的js代码

点击次数:21 次 发布日期:2008-11-16 10:38:48 作者:源代码网
源代码网推荐
想要在自己blog的文章页面加几个[加入网摘]的代码,
本来在zblog官方BBS上是有的,可惜代码无法下载了(URL见此:http://bbs.rainbowsoft.org/viewthread.php?tid=1140&extra=page%3D1,那个几乎收录了国内的所有网摘),只能自己重新找。找了好久,没有找到合适的,自己需要的(365key,delicious,google,百度搜藏),没有办法,把找到的内容加工了下,结合成下面这段:

1.将下面这段代码保存为wangzhai.js,上传到blog根目录下。

document.write(" [ <a href="javascript:StorePage();"><font color=#fc0000>365Key</font></a> ]");
document.write(" [ <a href="javascript:StorePage2();"><font color=#fc0000>del.icio.us</font></a> ]");
document.write(" [ <a href="javascript:StorePage3();"><font color=#fc0000>Google</font></a> ]");
function StorePage(){d=document;t=d.selection?(d.selection.type!="None"?d.selection.createRange().text:""):(d.getSelection?d.getSelection():"");void(keyit=window.open("http://www.365key.com/storeit.aspx?t="+escape(d.title)+"&u="+escape(d.location.href)+"&c="+escape(t),"keyit","scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes"));keyit.focus();}
function StorePage2(){window.open("http://del.icio.us/post?v=4&noui&jump=close&url="+encodeURIComponent(location.href)+"&title="+encodeURIComponent(document.title), "delicious","toolbar=no,width=700,height=400");}
function StorePage3(){window.open("http://www.google.com/bookmarks/mark?op=add&bkmk="+encodeURIComponent(location.href)+"&title="+encodeURIComponent(document.title), "google","toolbar=yes,width=800,height=600");}
//以上是365,delicious,google的,以下是百度搜藏的。
document.write(" [ <a href="javascript:u=location.href;t=document.title;c=%22%22+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);c=c.substr(0,480);var url=%22http://cang.baidu.com/do/add?it=%22+encodeURIComponent(t)+%22&iu=%22+encodeURIComponent(u)+%22&dc=%22+encodeURIComponent(c)+%22&fr=js#nw=1%22;window.open(url,"_blank","scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes");void 0"><font color=#fc0000>Baidu</a></font> ]");


2.修改template/b_article-single.html

<h6 class="post-footer">
<#ZC_MSG011#>:<#article/author/name#> | <#ZC_MSG012#>:<#article/category/name#> | <#ZC_MSG013#>:<#article/commnums#> | <#ZC_MSG014#>:<#article/trackbacknums#> | <#ZC_MSG130#>:<span id="spn<#article/id#>"></span>
<script language="JavaScript" type="text/javascript">strBatchCount+="spn<#article/id#>=<#article/id#>,"</script>
</h6>

下添加:

<div style="padding-left:15px; padding-top:5px;">收藏此页到:<script type="text/javascript" language="javascript" src="http://www.admin5.com/article/20070315/<#ZC_BLOG_HOST#>wangzhai.js"></script></div>


3.进后台-"文件重建"。OK,效果请看下面。
源代码网供稿.
网友评论 (0)
会员中心
网站运营
本站推荐
网站运营之精华