;
var headprefix = "http://avatar.l99.com/50x50/";var DoveBox = {};DoveBox.id = "dove_box";DoveBox.projectPath = "http://api.l99.com/";DoveBox.l99Path = "http://www.l99.com/";DoveBox.jsonUrl = "statuses/feature_timeline.json";DoveBox.page = 1;DoveBox.maxPage = 9;DoveBox.flag = true;DoveBox.style = "pigeon_comm";DoveBox.mapSize = "262x272";DoveBox.init = function (type, mSize) {DoveBox.mapSize = mSize;$("#" + DoveBox.id).html("<span class=\"loadData\" id=\"load_t\">&nbsp;</span>");switch (type) {case "mood":DoveBox.style = "pigeon_say";DoveBox.jsonUrl = "statuses/mood_timeline.json?jsoncallback=?&jsonp=?";break;case "reply":DoveBox.style = "pigeon_reply";DoveBox.jsonUrl = "statuses/reply_timeline.json?jsoncallback=?&jsonp=?";break;case "comment":DoveBox.style = "pigeon_comm";DoveBox.jsonUrl = "statuses/comment_timeline.json?jsoncallback=?&jsonp=?";break;default:DoveBox.maxPage = 1;DoveBox.jsonUrl = "statuses/feature_timeline.json?jsoncallback=?&jsonp=?&count=50";break;}DoveBox.getDove(1);};DoveBox.getDove = function (page) {$("#" + DoveBox.id).html("<span class=\"loadData\" id=\"load_t\">&nbsp;</span>");var url = DoveBox.projectPath + DoveBox.jsonUrl;$.getJSON(url, {page:page}, function (data) {if (DoveBox.flag) {$("#" + DoveBox.id).scrollTop(0);} else {$("#" + DoveBox.id).scrollTop(scrollMax(DoveBox.id));}DoveBox.showDove(data.statuses);});};DoveBox.showDove = function (datas) {var l = datas.length;if (l < 1) {return;}var doveHTML = [];for (var i = 0; i < l; i += 1) {var date = datas[i];var tHtml = DoveBox.transHtml(date);doveHTML.push(tHtml);}$("#" + DoveBox.id).empty().append(doveHTML.join(""));dragBox();};DoveBox.transHtml = function (data) {var user = data.status.user;var linkStr = "";var imgStr = "";DoveBox.style = "pigeon_say";if (data.status.link) {linkStr = "<a class=\"a_blue titleLink\" href=\"" + DoveBox.l99Path + data.status.link + "\" target=\"_blank\">" + data.status.link_title + "</a>";DoveBox.style = "pigeon_comm";}if (data.status.in_reply_to_longNO) {DoveBox.style = "pigeon_reply";linkStr = "<a class=\"a_blue titleLink\" href=\"http://www.l99.com/pigeonIndex.action?u=" + data.status.in_reply_to_longNO + "&p=" + data.status.in_reply_to_status_id + "\" target=\"_blank\">" + data.status.in_reply_to_screen_name + "\u7684\u98DE\u9E3D</a>";}if (data.status.img) {imgStr = "<span class=\"doveImage left\" onclick=\"DoveBox.showImage(this)\"><img src=\"http://photo.l99.com/dove/50x50/" + data.status.img + "\" /></span>";}var tHtml = [];tHtml.push("<div class=\"doveBox_list\">");tHtml.push("<a class=\"userHead mr5 left\" href=\"http://www.l99.com/" + user.longNO + "\" target=\"_blank\"><img src=\"" + headprefix + user.profile_image_url + "\" /></a>");tHtml.push("<ul class=\"userCon right\">");tHtml.push("<li><span class=\"left\"><a class=\"a_orange\" href=\"http://www.l99.com/" + user.longNO + "\" target=\"_blank\">" + user.name + "</a></span><span class=\"pigeon_img " + DoveBox.style + " mr5\"> </span>" + linkStr + "<div class=\"clear\"></div></li>");tHtml.push("<li class=\"doveCon\">" + imgStr + "<a class=\"a_orange\" href=\"http://www.l99.com/pigeonIndex.action?u=" + user.longNO + "&p=" + data.status.id + "\" target=\"_blank\">" + data.status.text + "</a></li>");tHtml.push("<li><a class=\"doveStation right\" href=\"javascript:void(0);\" onclick=\"DoveBox.showMap(this,'" + data.status.longitude + "','" + data.status.latitude + "')\"> </a><span class=\"doveTime text_gray right\">" + data.status.created_at + "</span><div class=\"clear\"></div></li>");tHtml.push("</ul></div>");return tHtml.join("");};DoveBox.showMap = function (e, lng, lat) {var pop = $(e).parents(".doveBox_list");var item = "<div class=\"doveBox_list\">" + pop.html() + "</div>";$("#dove_box_pop").empty().append(item + "<div class=\"doveMap\" onclick=\"document.getElementById('dove_box_pop').style.display='none'\"><img src=\"http://maps.google.com/staticmap?center=" + lat + "," + lng + "&zoom=9&size=" + DoveBox.mapSize + "&markers=" + lat + "," + lng + "&maptype=hybrid&key=ABQIAAAAT-9fd3svBdx7KjYXYY7CpxRxrxp6baCkgzTCBYtJ6Ru3ZT4VnhQxpZdh3iatn754JqjMkE_kpZ1G2g\" style=\"\" /></div>").toggle();};DoveBox.showImage = function (e) {var imgStr = $(e).html().replace("50x50", "200x200");$("#dove_box_image").empty().append(imgStr).toggle();};function dragBox() {var $this = $("#" + DoveBox.id);var start_hand = "url(start_hand.cur),pointer";var end_hand = "url(end_hand.cur),pointer";var y = 0;$this.css({cursor:start_hand, overflow:"hidden"}).mousedown(startDrag).mouseup(endDrag).mouseleave(endDrag);function startDrag(e) {$this.css("cursor", end_hand).stop(true, false).mousemove(moveDrag);y = e.pageY;return false;}function moveDrag(e) {var pos_y = e.pageY - y;y = e.pageY;$this.animate({scrollTop:"-=" + pos_y}, 20);if (0 == parseInt($("#" + DoveBox.id).scrollTop()) && pos_y > 0) {if (DoveBox.page == 1) {return;}DoveBox.flag = false;$("#" + DoveBox.id).unbind();DoveBox.page = DoveBox.page - 1;DoveBox.getDove(DoveBox.page);return;}if (parseInt(scrollMax(DoveBox.id)) == parseInt($("#" + DoveBox.id).scrollTop()) && pos_y < 0) {if (DoveBox.page == DoveBox.maxPage) {return;}DoveBox.flag = true;$("#" + DoveBox.id).unbind();DoveBox.page = DoveBox.page + 1;DoveBox.getDove(DoveBox.page);return;}return true;}function endDrag(e) {$this.css("cursor", start_hand).unbind("mousemove", moveDrag);return true;}}var scrollMax = function (id, axis) {var Dim = axis == "x" ? "Width" : "Height", scroll = "scroll" + Dim;return document.getElementById(id)[scroll] - $("#" + id)[Dim.toLowerCase()]();};$(".timeList first-child").hide();
