今天凌晨将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>
注意:代码中没有换行。使用图片模式请自行更换图片以确保正常显示。
Bookmark, Html, JS, Share, Twitter, Wordpress
Permanent Link | Posted in: Application | 2,192 Views
[...] 发布之后,根据iFire的Twitter Bookmark和Heart5的意见修改成: [...]