/* 平滑滚动插件 */
$(function() {
$('a,input[type="button"],input[type="submit"]').bind('focus',function(){
if(this.blur){
this.blur();
};
});
/* 去除链接点击后的虚线框 */
$(".posttext a").not("[href*=diggcafe.com]").not("[href^=#]").not("[href^=javascript]").not("[href^=mailto]").addClass('gooutsite');
$(".gooutsite").attr({ target: "_blank" });
/* 站外链接标识 */
$("#header_search_query").focus(function(){if (this.value == '搜索内容...') {this.value = '';}}).blur(function(){if (this.value == '') {this.value = '搜索内容...';}});
/* 搜索框文字 */
$('a[href*=#]').click(function(){
         if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname){
           var $target = $(this.hash);
           $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
           if ($target.length){
                 var targetOffset = $target.offset().top;
                 $('html,body').animate({scrollTop: targetOffset}, 1000);
                return false;
             }
         }
   });
/* 平滑滚动之回到顶部 */
$("#imgads").scrollable({circular: true, speed: 400}).navigator().autoscroll({autopause: true,interval:8000});
/* 幻灯片 */
$("#diggtree a,.quotebox a").tooltip({opacity: 0.85,predelay: 200,position:"center right", offset: [0, -10], effect: 'slide'}); 
/* 日程树浮动层 */
$("form :input[title]").tooltip({effect: 'slide'}).dynamic({ bottom: { direction: 'down', bounce: true } });
$(".expose").click(function() { $(this).expose({api: true}).load();});
/* 聚焦 */
if($('#post-musiclist')){
$.getJSON("http://api.douban.com/people/dimlau/favsongs?alt=xd&apikey=0f85e9acfb703eb32e91bd06f250bc19&callback=?",function(data){
var html = '<p>近期背景音乐列表：</p>';
$.each(data.entry,function(i,entry) {
if(i==10) return false;
html += '<a href="" class="imglinks"><img title="' + entry.artist.$t + ': 《' + entry.title.$t + '》" src="' + entry.cover.$t + '" alt="' + entry.album.$t + '专辑封面图片" width="70" height="70" style="margin: 5px 16px;" /></a>';
});
$('#post-musiclist').html(html);
$('#post-musiclist img[title]').tooltip({predelay: 400, opacity: 0.85, offset: [50, 0], effect: 'slide'});
});
}
/* 首页音乐显示 */
if($('#post-linklist')){
var linktext = '<span><strong>友情链接</strong></span>';
linktext += '<a target="_blank" href="http://kaix.in">开心网</a>';
linktext += '<a target="_blank" href="http://say.kaix.in/"><b class="red">开心社区</b></a>';
linktext += '<a target="_blank" href="http://t.qq.com/dimlau">腾讯微博</a>';
linktext += '<a target="_blank" href="http://www.douban.com/group/diggcafe/">豆瓣网</a>';
linktext += '<a target="_blank" href="http://twitter.com/diggcafe">Twitter</a>';
linktext += '<a target="_blank" href="http://www.apple.com">Apple</a>';
linktext += '<a target="_blank" href="http://kaix.in/go/burstnet">BurstNet</a>';
linktext += '<a href="mailto:service@diggcafe.com?subject=交换链接">[加入您的链接]</a>';
$('#post-linklist').html(linktext);
}
/* 首页友情链接 */
if($('#disqus_thread')){
$("<scri"+"pt>"+"</scr"+"ipt>").attr({src:'http://diggcafe.disqus.com/embed.js',type:'text/javascript',async:'true'}).appendTo($('body'));
}
});