微博智能边栏展示脚本

对于我这种同时用两个微博服务的人,需要按照访客不同情况展示不同的挂件时,这段代码就派上用场了。

<body> 
<script> 
var accessibility=0;
/* GFW detecting script, written by chenxiaoqino. published under WTFPL. */
</script> 
<script src="http://api.cxqn.info/walldetect/falun.js"></script> 
<script> 
if(accessibility!=0)
document.write("<scr"+"ipt src=http://widgets.twimg.com/j/2/widget.js></scr"+"ipt>");
</script> 
<script> 
if(accessibility!=0){
new TWTR.Widget({
  version: 2,
  type: 'profile',
  rpp: 4,
  interval: 6000,
  width: 280,
  height: 300,
  theme: {
    shell: {
      background: '#000000',
      color: '#46c0ed'
    },
    tweets: {
      background: '#006285',
      color: '#000000',
      links: '#46c0ed'
    }
  },
  features: {
    scrollbar: false,
    loop: false,
    live: false,
    hashtags: true,
    timestamp: true,
    avatars: true,
    behavior: 'all'
  }
}).
render().
setUser('chenxiaoqino')./* Here's your twitter username */
start();
/* Here's your twitter gadget code. Get your own style code at  https://twitter.com/about/resources/widgets/widget_profile */
} 
else
document.write('<iframe width="280" height="335" class="share_self"  frameborder="0" scrolling="no" src="http://widget.weibo.com/weiboshow/index.php?width=280&height=335&fansRow=2&ptype=1&speed=0&skin=1&isTitle=0&noborder=0&isWeibo=1&isFans=0&uid=1147823881&verifier=34037487"></iframe>');
/* Here's your SinaWB iframe code. Get your own at http://weibo.com/plugins/WeiboShow.php */
</script> 
</body>

syntax highlighted by Code2HTML, v. 0.9.1

Javascript根据可否访问地址带DPI的JS文件判断用户是否来自中国大陆,并相应展示Twitter或新浪微博Widget。
示例地址
效果如图:


此页面可以从边栏iframe访问。使用时请注意用自己的用户信息将相应代码替换。


发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

Powered by WordPress. Design: Supermodne.