iHomeAboutProfileiLifePodcastCodePushAPI.Li

iPost

Wordpress are you?

Twitter Bookmark

iFire @ 2008-04-09 09:07 53

今天凌晨将Twitio.us提供的分享到Twitter的功能添加到Sharepack的同时,HXW先生也正巧在他博客上发布了直接利用Twitter自身的发布模式实现分享的方法,不过该方法只针对Wordpress有效,不过他很快就在Gtalk上发给我一段语句,是根据做啥的分享语句修改的,能支持在非Wordpress驱动下的任何网页实现分享。

第一种方式:HXW发布的Wordpress版本:

<a href="http://twitter.com/home?status=<?php the_permalink() ?>%20<?php the_title(); ?>" target=_blank rel=nofollow title=”Twitter This”>Twitter This</a>

第二种方式:HXW根据做啥分享语句改写的适用于任何网页的版本:

文字模式:

<a href="javascript:u=location.href;t=document.title;t=t.substr(0,76);
c=%22%22+(window.getSelection?window.getSelection():
document.getSelection?document.getSelection():
document.selection.createRange().text);c=c.substr(0,180);
location=%22http://twitter.com/home?status=+Reading:%20+
%22+encodeURIComponent(t)+%22%20%22+encodeURIComponent(u);void%200">
Twitter This</a>

Demo: Twitter this

图片模式:

<a href="javascript:u=location.href;t=document.title;t=t.substr(0,76);
c=%22%22+(window.getSelection?window.getSelection():
document.getSelection?document.getSelection():
document.selection.createRange().text);c=c.substr(0,180);
location=%22http://twitter.com/home?status=+Reading:%20+
%22+encodeURIComponent(t)+%22%20%22+encodeURIComponent(u);void%200">
<img src="http://tinyurl.com/6e4mc6" alt="Twitter This" /></a>

Demo: Twitter This

注意:代码中没有换行。使用图片模式请自行更换图片以确保正常显示。

, , , , ,

Addthis

Permanent Link | Posted in: Application | 2,192 Views

One WP Response

  1. [...] 发布之后,根据iFire的Twitter Bookmark和Heart5的意见修改成: [...]

Leave a Reply or Use Zuosa Comment

此评论栏由做啥提供动力,评论前请注册做啥或确认您已登录。

发表您的评论,最多输入140个字符,程序会自动添加@ifire命令。

收起本输入框


XHTML You can use these tags:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 应用成趣 Allrights reserved. | Theme: iPost 2.7.1.2 | Artwork by apple.com | Designed By iFire. | Powered by WordPress. | Entries (RSS) | Comments (RSS).