2 $("#allTimeline").click(function(e) {
3 var $this = $(e.target);
4 var type = $this.attr('class');
8 if ($("#textbox").length > 0) {
11 $("#info_head").after('<h2>What\'s happening?</h2>' + formHTML);
22 var replie_id = $this.parent().parent().find(".status_word").find(".user_name").attr("id");
23 if ($("#textbox").length > 0) {
26 $("#info_head").after('<h2>In reply to ' + replie_id + '</h2>' + formHTML);
46 $("#info_reply_btn").click(function(){
47 var replie_id = $("#info_name").text();
48 if ($("#textbox").length > 0) {
49 $("#textbox").val($("#textbox").val() + "@" + replie_id + " ");
50 $("#textbox").focus();
53 $("#info_head").after('<h2>In reply to ' + replie_id + '</h2>' + formHTML);
55 $("#textbox").val($("#textbox").val() + "@" + replie_id + " ");
56 $("#textbox").focus();
60 if (getCookie("infoShow") == "hide") {
63 $("#info_hide_btn").click(function(){
67 $("#info_follow_btn").click(function(e){
70 var id = $("#info_name").text();
71 updateSentTip("Following " + id + "...", 5000, "ing");
73 url: "ajax/relation.php",
75 data: "action=create&id=" + id,
76 success: function(msg) {
77 if (msg.indexOf("success") >= 0) {
78 updateSentTip("You have followed " + id + "!", 3000, "success");
79 $this.after('<a class="btn btn-red" id="info_block_btn" href="javascript:void(0)">Unfollow</a>');
81 if($('#unblock') != null){
82 $('#unblock').after('<a class="btn" id="block_btn" href="javascript:void(0)">Block</a>');
83 $('#unblock').remove();
86 updateSentTip("Failed to follow " + id + ", please try again.", 3000, "failure");
89 error: function(msg) {
90 updateSentTip("Failed to follow " + id + ", please try again.", 3000, "failure");
95 $("#info_block_btn").click(function(e){
98 var id = $("#info_name").text();
99 if (confirm("Are you sure to unfollow " + id + " ?")) {
100 updateSentTip("Unfollowing " + id + "...", 5000, "ing");
102 url: "ajax/relation.php",
104 data: "action=destory&id=" + id,
105 success: function(msg) {
106 if (msg.indexOf("success") >= 0) {
107 updateSentTip("You have unfollowed " + id + "!", 3000, "success");
108 $this.after('<a class="btn btn-green" id="info_follow_btn" href="javascript:void(0)">Follow</a>');
111 updateSentTip("Failed to unfollow " + id + ", please try again.", 3000, "failure");
114 error: function(msg) {
115 updateSentTip("Failed to unfollow " + id + ", please try again.", 3000, "failure");
121 $("#block_btn").click(function(e){
124 var id = $("#info_name").text();
125 if (confirm("Are you sure to block " + id + " ?")) {
126 updateSentTip("Blocking " + id + "...", 5000, "ing");
128 url: "ajax/relation.php",
130 data: "action=block&id=" + id,
131 success: function(msg) {
132 if (msg.indexOf("success") >= 0) {
133 updateSentTip("You have blocked " + id + "!", 3000, "success");
134 $this.after('<a class="btn" id="unblock_btn" href="javascript:void(0)">Unblock</a>');
136 if($('#info_block_btn') != null){
137 $('#info_block_btn').after('<a class="btn btn-green" id="info_follow_btn" href="javascript:void(0)">Follow</a>');
138 $('#info_block_btn').remove();
141 updateSentTip("Failed to block " + id + ", please try again.", 3000, "failure");
144 error: function(msg) {
145 updateSentTip("Failed to block " + id + ", please try again.", 3000, "failure");
151 $("#unblock_btn").click(function(e){
154 var id = $("#info_name").text();
155 if (confirm("Are you sure to unblock " + id + " ?")) {
156 updateSentTip("Unblocking...", 5000, "ing");
158 url: "ajax/relation.php",
160 data: "action=unblock&id=" + id,
161 success: function(msg) {
162 if (msg.indexOf("success") >= 0) {
163 updateSentTip("Unblocked.", 3000, "success");
164 $this.after('<a class="btn" id="block_btn" href="javascript:void(0)">Block</a>');
167 updateSentTip("Failed to unblock, please try again.", 3000, "failure");
170 error: function(msg) {
171 updateSentTip("Failed to unblock, please try again.", 3000, "failure");
177 $("#report_btn").click(function(e){
180 var id = $("#info_name").text();
181 if (confirm("Are you sure to report " + id + " for spam?")) {
182 updateSentTip("Reporting " + id + " for spam...", 5000, "ing");
184 url: "ajax/relation.php",
186 data: "action=report&id=" + id,
187 success: function(msg) {
188 if (msg.indexOf("success") >= 0) {
189 updateSentTip("You have reported " + id + " for spam!", 3000, "success");
191 updateSentTip("Failed to report " + id + " for spam, please try again.", 3000, "failure");
194 error: function(msg) {
195 updateSentTip("Failed to report " + id + " for spam, please try again.", 3000, "failure");
202 function getCookie(name){
203 var strCookie=document.cookie;
204 var arrCookie=strCookie.split("; ");
205 for(var i=0;i<arrCookie.length;i++){
206 var arr=arrCookie[i].split("=");
207 if(arr[0]==name)return unescape(arr[1]);
211 function setCookie(name,value,expireHours){
212 var cookieString=name+"="+escape(value);
215 date.setTime(date.getTime+expireHours*3600*1000);
216 cookieString=cookieString+"; expire="+date.toGMTString();
218 document.cookie=cookieString;
221 $this = $("#info_hide_btn");
222 $this.after('<a class="btn" id="info_show_btn" href="javascript:void(0)">Show @</a>');
225 $("#info_show_btn").click(function(){
226 $(".timeline li").each(function(i,o) {
229 $(this).after('<a class="btn" id="info_hide_btn" href="javascript:void(0)">Hide @</a>');
231 $("#info_hide_btn").live("click", function(){
234 setCookie("infoShow","show");
237 $(".timeline li").each(function(i,o) {
238 if ($(this).find(".status_word").text().indexOf("@") > -1) {
242 setCookie("infoShow","hide");