Spiga
Posts - 155, Articles - 13, Comments - 2332
Cnblogs
Dashboard
Login
Home
Contact
Gallery
RSS
Cat in dotNET
用于自动添加"Digg This!"按钮的JavaScript
2006-12-16 21:36 by Cat Chen, 254 visits,
网摘
,
收藏
,
编辑
var
main
=
document.getElementById(
"
main
"
);
var
singlepost
=
false
;
var
firstpost;
var
anchor;
for
(
var
i
=
0
;i
<
main.childNodes.length;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
<
post.childNodes.length;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
=
"
<a href=\
"
http://del.icio.us
/
post
?
v
=
4
&
url
=
"
+encodeURIComponent(location.href)+
"
&
title
=
"
+encodeURIComponent(document.title)+
"
\
"
><img src=\
http://del.icio.us
/
favicon.ico\
alt=\
"
Add to del.icio.us\
"
border=\
"
0
\
"
/><span>Add to del.icio.us</span></a>
"
;
postfoot.innerHTML
+=
"
<a href=\
"
http://digg.com
/
submit
?
phase
=
2
&
url
=
"
+encodeURIComponent(location.href)+
"
&
title
=
"
+encodeURIComponent(document.title)+
"
\
"
><img src=\
http://digg.com
/
favicon.ico\
alt=\
"
Digg This
!
\
"
border=\
"
0
\
"
/><span>Digg This!</span></a>
"
;
postfoot.innerHTML
+=
"
<a href=\
"
http://www.facebook.com
/
share.php
?
u
=
"
+encodeURIComponent(location.href)+
"
\
"
><img src=\
http://www.facebook.com
/
favicon.ico\
alt=\
"
Share on Facebook\
"
border=\
"
0
\
"
/><span>Share on Facebook</span></a>
"
;
postfoot.innerHTML
+=
"
<a href=\
"
http://www.google.com
/
bookmarks
/
mark
?
op
=
edit
&
bkmk
=
"
+encodeURIComponent(location.href)+
"
&
title
=
"
+encodeURIComponent(document.title)+
"
\
"
><img src=\
http://www.google.com
/
favicon.ico\
alt=\
"
Google Bookmark This\
"
border=\
"
0
\
"
/><span>Google Bookmark This</span></a>
"
;
}
1
0
0
(请您对文章做出评价)
«
上一篇:
英语阅读推荐:海明威写作技巧 & UpdatePanel为何失灵
»
下一篇:
十分钟内学会:让你的博客文章也有机会成上Digg头版
Categories:
JavaScript
注册用户登录后才能发表评论,请
登录
或
注册
。
IT新闻
:
·
移动版 Google Buzz 已经上线,Google 在各处强推
·
奇虎新注资两家知名软件公司 投资项目达10笔
·
网友对Google的9大期待
·
分析称Google Buzz有十大特点:将改变搜索
·
2010年度技术奖获得者评选揭晓
每天10分钟,轻松学英语
专题:
iPad
jQuery
Windows 7
网站导航:
博客园首页
IT新闻
个人主页
闪存
程序员招聘
社区
博问
网摘
China-pub 计算机图书网上专卖店!6.5万品种2-8折!
China-Pub 计算机绝版图书按需印刷服务
相关搜索:
JavaScript
在知识库中查看:
用于自动添加"Digg This!"按钮的JavaScript
About
我的链接
我的标识
我的简历与作品
Cat in Chinese
Cat in English
Cat on Web Tech
订阅
版权许可
This work is licensed under a
Creative Commons License
.
我的主页
个人资料
我的闪存
发短消息
随笔分类
Rss
*Book Recommendation*(1)
Rss
*Comprehensive Understanding*(9)
Rss
*Most Practical*(9)
Rss
*Netcasts*(2)
Rss
*Random Clippings*(10)
Rss
*Resources*(4)
Rss
.NET Framework(14)
Rss
AJAX(45)
Rss
ASP.NET(68)
Rss
ASP.NET AJAX(24)
Rss
ASP.NET Futures(8)
Rss
C#(7)
Rss
CSS(14)
Rss
iPhone(8)
Rss
JavaScript(44)
Rss
LINQ(1)
Rss
Linq to Sql(2)
Rss
Linq to Xml(1)
Rss
Mac(1)
Rss
Rails(4)
Rss
Ruby(4)
Rss
Silverlight(7)
Rss
SQL(4)
Rss
Web(108)
Rss
WF(1)
Rss
Windows(1)
Rss
WPF(1)
Rss
XNA(1)
随笔档案
2010年2月(3)
2010年1月(1)
2009年12月(4)
2009年11月(5)
2009年10月(3)
2009年9月(1)
2009年8月(2)
2009年7月(3)
2009年6月(4)
2009年5月(4)
2009年4月(1)
2009年3月(2)
更多...
2008年12月(3)
2008年11月(2)
2008年10月(2)
2008年9月(2)
2008年4月(2)
2008年3月(5)
2008年2月(1)
2008年1月(7)
2007年12月(6)
2007年11月(4)
2007年10月(4)
2007年9月(1)
2007年8月(2)
2007年7月(3)
2007年6月(4)
2007年5月(4)
2007年4月(1)
2007年3月(5)
2007年2月(7)
2007年1月(3)
2006年12月(13)
2006年11月(11)
2006年10月(30)
我管理的小组
iPhone / iPad 开发
团队博客
.NET 控件与组件开发(0/0)
北京.NET俱乐部(0/0)
应届毕业生之家(0/0)
广州.NET俱乐部(0/0)
Ajax&Atlas技术团队(0/0)
ASP.NET AJAX (Atlas)学习(0/0)
.NetFramework3.0 & 3.5(WCF,WPF,WF)团队(0/0)
MVP(微软最有价值专家)团队(0/0)
Silverlight学习与研究(0/0)
Windows Vista开发(0/0)
数据库团队(0/0)
.net企业应用开发(0/0)
MVP播客(0/0)
asp.net开发团队(0/0)
RIA技术联盟(0/0)
60天内阅读排行
程序员的品味(3634)
程序之外的事情 (Part 1 - Speech)(2978)
《程序员羊皮卷》书评(2744)
看对的书 (Part 0 - 何谓对错)(2238)
China MVP Open Day 2009(2104)
能承载移动 Web 应用的唯一浏览器: Mobile Safari(1830)
Apple 谈论产品 vs Microsoft 谈论技术(1527)
欢迎加入 iPhone / iPad 开发小组(1518)
阅读排行榜
根本不存在 DIV + CSS 布局这回事(29864)
欲练 CSS ,必先宫 IE(14420)
你有 <table /> 强迫症吗?(9647)
IIS7 会重用那些不该重用 HttpHandler(9041)
Code is Configuration(8966)
英语阅读推荐:基于AJAX的ASP.NET聊天室 & 如何建立共识(8586)
什么样的 Code 更像是 Configuration(8321)
英语阅读推荐:美化文件上传框 & 无刷新文件上传(8055)
英语阅读推荐:使用AJAX+WF+LINQ制作Google IG式首页(7599)
十分钟内学会:将HTML格式化为合法的XML(7591)
我的链接
Rss
Cat in Chinese
Rss
Cat in English
我的标识
我的简历与作品