2 $("#allTimeline").click(function(e) {
\r
3 var $this = $(e.target);
\r
4 var type = $this.attr('class');
\r
8 if ($("#textbox").length > 0) {
\r
11 $("#info_head").after('<h2>What\'s happening?</h2>' + formHTML);
\r
22 var replie_id = $this.parent().parent().find(".status_word").find(".user_name").text();
\r
23 if ($("#textbox").length > 0) {
\r
24 onInfoReplie($this,e);
\r
26 $("#info_head").after('<h2>In reply to ' + replie_id + '</h2>' + formHTML);
\r
28 onInfoReplie($this,e);
\r
46 $("#info_reply_btn").click(function(){
\r
47 var replie_id = $("#info_name").text();
\r
48 if ($("#textbox").length > 0) {
\r
49 $("#textbox").val($("#textbox").val() + "@" + replie_id + " ");
\r
50 $("#textbox").focus();
\r
53 $("#info_head").after('<h2>In reply to ' + replie_id + '</h2>' + formHTML);
\r
55 $("#textbox").val($("#textbox").val() + "@" + replie_id + " ");
\r
56 $("#textbox").focus();
\r
60 if (getCookie("infoShow") == "hide") {
\r
63 $("#info_hide_btn").click(function(){
\r
67 $("#info_follow_btn").click(function(e){
\r
69 var $this = $(this);
\r
70 var id = $("#info_name").text();
\r
71 updateSentTip("Following " + id + "...", 5000, "ing");
\r
73 url: "ajax/relation.php",
\r
75 data: "action=create&id=" + id,
\r
76 success: function(msg) {
\r
77 if (msg.indexOf("success") >= 0) {
\r
78 updateSentTip("You have followed " + id + "!", 3000, "success");
\r
79 $this.after('<a class="btn btn-red" id="info_block_btn" href="javascript:void(0)">Unfollow</a>');
\r
81 if($('#unblock') != null){
\r
82 $('#unblock').after('<a class="btn" id="block_btn" href="javascript:void(0)">Block</a>');
\r
83 $('#unblock').remove();
\r
86 updateSentTip("Failed to follow " + id + ", please try again.", 3000, "failure");
\r
89 error: function(msg) {
\r
90 updateSentTip("Failed to follow " + id + ", please try again.", 3000, "failure");
\r
95 $("#info_block_btn").click(function(e){
\r
97 var $this = $(this);
\r
98 var id = $("#info_name").text();
\r
99 if (confirm("Are you sure to unfollow " + id + " ?")) {
\r
100 updateSentTip("Unfollowing " + id + "...", 5000, "ing");
\r
102 url: "ajax/relation.php",
\r
104 data: "action=destory&id=" + id,
\r
105 success: function(msg) {
\r
106 if (msg.indexOf("success") >= 0) {
\r
107 updateSentTip("You have unfollowed " + id + "!", 3000, "success");
\r
108 $this.after('<a class="btn btn-green" id="info_follow_btn" href="javascript:void(0)">Follow</a>');
\r
111 updateSentTip("Failed to unfollow " + id + ", please try again.", 3000, "failure");
\r
114 error: function(msg) {
\r
115 updateSentTip("Failed to unfollow " + id + ", please try again.", 3000, "failure");
\r
121 $("#block_btn").click(function(e){
\r
122 e.preventDefault();
\r
123 var $this = $(this);
\r
124 var id = $("#info_name").text();
\r
125 if (confirm("Are you sure to block " + id + " ?")) {
\r
126 updateSentTip("Blocking " + id + "...", 5000, "ing");
\r
128 url: "ajax/relation.php",
\r
130 data: "action=block&id=" + id,
\r
131 success: function(msg) {
\r
132 if (msg.indexOf("success") >= 0) {
\r
133 updateSentTip("You have blocked " + id + "!", 3000, "success");
\r
134 $this.after('<a class="btn" id="unblock_btn" href="javascript:void(0)">Unblock</a>');
\r
136 if($('#info_block_btn') != null){
\r
137 $('#info_block_btn').after('<a class="btn btn-green" id="info_follow_btn" href="javascript:void(0)">Follow</a>');
\r
138 $('#info_block_btn').remove();
\r
141 updateSentTip("Failed to block " + id + ", please try again.", 3000, "failure");
\r
144 error: function(msg) {
\r
145 updateSentTip("Failed to block " + id + ", please try again.", 3000, "failure");
\r
151 $("#unblock_btn").click(function(e){
\r
152 e.preventDefault();
\r
153 var $this = $(this);
\r
154 var id = $("#info_name").text();
\r
155 if (confirm("Are you sure to unblock " + id + " ?")) {
\r
156 updateSentTip("Unblocking...", 5000, "ing");
\r
158 url: "ajax/relation.php",
\r
160 data: "action=unblock&id=" + id,
\r
161 success: function(msg) {
\r
162 if (msg.indexOf("success") >= 0) {
\r
163 updateSentTip("Unblocked.", 3000, "success");
\r
164 $this.after('<a class="btn" id="block_btn" href="javascript:void(0)">Block</a>');
\r
167 updateSentTip("Failed to unblock, please try again.", 3000, "failure");
\r
170 error: function(msg) {
\r
171 updateSentTip("Failed to unblock, please try again.", 3000, "failure");
\r
177 $("#report_btn").click(function(e){
\r
178 e.preventDefault();
\r
179 var $this = $(this);
\r
180 var id = $("#info_name").text();
\r
181 if (confirm("Are you sure to report " + id + " for spam?")) {
\r
182 updateSentTip("Reporting " + id + " for spam...", 5000, "ing");
\r
184 url: "ajax/relation.php",
\r
186 data: "action=report&id=" + id,
\r
187 success: function(msg) {
\r
188 if (msg.indexOf("success") >= 0) {
\r
189 updateSentTip("You have reported " + id + " for spam!", 3000, "success");
\r
191 $this.after('<a class="btn" id="unblock_btn" href="javascript:void(0)">Unblock</a>');
\r
194 if($('#info_block_btn') != null){
\r
195 $('#info_block_btn').after('<a class="btn btn-green" id="info_follow_btn" href="javascript:void(0)">Follow</a>');
\r
196 $('#info_block_btn').remove();
\r
200 updateSentTip("Failed to report " + id + " for spam, please try again.", 3000, "failure");
\r
203 error: function(msg) {
\r
204 updateSentTip("Failed to report " + id + " for spam, please try again.", 3000, "failure");
\r
209 $("#tweeting_button").click(function (e) {
\r
210 e.preventDefault();
\r
211 if ($("#textbox").val().length >0 ) {
\r
218 function onInfoReplie($this) {
\r
219 var replie_id = $("#info_name").text();
\r
220 $("#textbox").val("@" + replie_id + " ");
\r
221 $("#textbox").focus();
\r
222 $("#in_reply_to").val($this.parent().parent().find(".status_id").text());
\r
226 function onInfoRT($this) {
\r
227 var replie_id = $("#info_name").text();
\r
228 var status_word = $this.parent().parent().find(".status_word").clone();
\r
229 status_word.find('.tweet a[rel=noreferrer]').each(function(){
\r
230 $(this).text($(this).attr('href'));
\r
232 $("#textbox").focus().val(" RT @" + replie_id + ":" + status_word.text().replace(replie_id, "")).caret(0);
\r
235 function getCookie(name){
\r
236 var strCookie=document.cookie;
\r
237 var arrCookie=strCookie.split("; ");
\r
238 for(var i=0;i<arrCookie.length;i++){
\r
239 var arr=arrCookie[i].split("=");
\r
240 if(arr[0]==name)return unescape(arr[1]);
\r
244 function setCookie(name,value,expireHours){
\r
245 var cookieString=name+"="+escape(value);
\r
247 var date=new Date();
\r
248 date.setTime(date.getTime+expireHours*3600*1000);
\r
249 cookieString=cookieString+"; expire="+date.toGMTString();
\r
251 document.cookie=cookieString;
\r
254 $this = $("#info_hide_btn");
\r
255 $this.after('<a class="btn" id="info_show_btn" href="javascript:void(0)">Show @</a>');
\r
258 $("#info_show_btn").click(function(){
\r
259 $(".timeline li").each(function(i,o) {
\r
262 $(this).after('<a class="btn" id="info_hide_btn" href="javascript:void(0)">Hide @</a>');
\r
264 $("#info_hide_btn").live("click", function(){
\r
267 setCookie("infoShow","show");
\r
270 $(".timeline li").each(function(i,o) {
\r
271 if ($(this).find(".status_word").text().indexOf("@") > -1) {
\r
275 setCookie("infoShow","hide");
\r