3 $("#submit_btn").click(function(e){
\r
8 $(".retw_btn").live("click", function(e){
\r
13 $(".rt_btn").click(function(e){
\r
15 if ($("#textbox").length > 0) {
\r
18 $("#info_head").after('<h2>What\'s happening?</h2>' + formHTML);
\r
24 $(".replie_btn").click(function(e){
\r
26 var replie_id = $("#info_name").text();
\r
27 if ($("#textbox").length > 0) {
\r
28 onInfoReplie($(this));
\r
30 $("#info_head").after('<h2>In reply to ' + replie_id + '</h2>' + formHTML);
\r
32 onInfoReplie($(this));
\r
36 $("#info_reply_btn").click(function(){
\r
37 var replie_id = $("#info_name").text();
\r
38 if ($("#textbox").length > 0) {
\r
39 $("#textbox").val($("#textbox").val() + "@" + replie_id + " ");
\r
40 $("#textbox").focus();
\r
43 $("#info_head").after('<h2>In reply to ' + replie_id + '</h2>' + formHTML);
\r
45 $("#textbox").val($("#textbox").val() + "@" + replie_id + " ");
\r
46 $("#textbox").focus();
\r
51 if (getCookie("infoShow") == "hide") {
\r
56 $("#info_hide_btn").live("click", function(){
\r
61 $(".favor_btn").live("click", function(){
\r
66 $("#info_follow_btn").live("click", function(e){
\r
68 var $this = $(this);
\r
69 var id = $("#info_name").text();
\r
70 updateSentTip("Following " + id + "...", 5000, "ing");
\r
72 url: "ajax/relation.php",
\r
74 data: "action=create&id=" + id,
\r
75 success: function(msg) {
\r
76 if (msg.indexOf("success") >= 0) {
\r
77 updateSentTip("You have followed " + id + "!");
\r
78 $this.after('<a class="btn btn-red" id="info_block_btn" href="javascript:void(0)">Unfollow</a>');
\r
80 if($('#unblock') != null){
\r
81 $('#unblock').after('<a class="btn" id="block_btn" href="javascript:void(0)">Block</a>');
\r
82 $('#unblock').remove();
\r
85 updateSentTip("Failed to follow " + id + ", please try again.", 3000, "failure");
\r
88 error: function(msg) {
\r
89 updateSentTip("Failed to follow " + id + ", please try again.", 3000, "failure");
\r
94 $("#info_block_btn").live("click", function(e){
\r
96 var $this = $(this);
\r
97 var id = $("#info_name").text();
\r
98 if (confirm("Are you sure to unfollow " + id + " ?")) {
\r
99 updateSentTip("Unfollowing " + id + "...", 5000, "ing");
\r
101 url: "ajax/relation.php",
\r
103 data: "action=destory&id=" + id,
\r
104 success: function(msg) {
\r
105 if (msg.indexOf("success") >= 0) {
\r
106 updateSentTip("You have unfollowed " + id + "!", 3000, "success");
\r
107 $this.after('<a class="btn btn-green" id="info_follow_btn" href="javascript:void(0)">Follow</a>');
\r
110 updateSentTip("Failed to unfollow " + id + ", please try again.", 3000, "failure");
\r
113 error: function(msg) {
\r
114 updateSentTip("Failed to unfollow " + id + ", please try again.", 3000, "failure");
\r
120 $("#block_btn").live("click", function(e){
\r
121 e.preventDefault();
\r
122 var $this = $(this);
\r
123 var id = $("#info_name").text();
\r
124 if (confirm("Are you sure to block " + id + " ?")) {
\r
125 updateSentTip("Blocking " + id + "...", 5000, "ing");
\r
127 url: "ajax/relation.php",
\r
129 data: "action=block&id=" + id,
\r
130 success: function(msg) {
\r
131 if (msg.indexOf("success") >= 0) {
\r
132 updateSentTip("You have blocked " + id + "!", 3000, "success");
\r
133 $this.after('<a class="btn" id="unblock_btn" href="javascript:void(0)">Unblock</a>');
\r
135 if($('#info_block_btn') != null){
\r
136 $('#info_block_btn').after('<a class="btn btn-green" id="info_follow_btn" href="javascript:void(0)">Follow</a>');
\r
137 $('#info_block_btn').remove();
\r
140 updateSentTip("Failed to block " + id + ", please try again.", 3000, "failure");
\r
143 error: function(msg) {
\r
144 updateSentTip("Failed to block " + id + ", please try again.", 3000, "failure");
\r
150 $("#unblock_btn").live("click", function(e){
\r
151 e.preventDefault();
\r
152 var $this = $(this);
\r
153 var id = $("#info_name").text();
\r
154 if (confirm("Are you sure to unblock " + id + " ?")) {
\r
155 updateSentTip("Unblocking...", 5000, "ing");
\r
157 url: "ajax/relation.php",
\r
159 data: "action=unblock&id=" + id,
\r
160 success: function(msg) {
\r
161 if (msg.indexOf("success") >= 0) {
\r
162 updateSentTip("Unblocked.", 3000, "success");
\r
163 $this.after('<a class="btn" id="block_btn" href="javascript:void(0)">Block</a>');
\r
166 updateSentTip("Failed to unblock, please try again.", 3000, "failure");
\r
169 error: function(msg) {
\r
170 updateSentTip("Failed to unblock, please try again.", 3000, "failure");
\r
177 function onInfoReplie($this) {
\r
178 var replie_id = $("#info_name").text();
\r
179 $("#textbox").val("@" + replie_id + " ");
\r
180 $("#textbox").focus();
\r
181 $("#in_reply_to").val($this.parent().parent().find(".status_id").text());
\r
185 function onInfoRT($this) {
\r
186 var replie_id = $("#info_name").text();
\r
187 $("#textbox").val("RT @" + replie_id + ":" + $this.parent().parent().find(".status_word").text());
\r
188 $("#textbox").focus();
\r
191 function getCookie(name){
\r
192 var strCookie=document.cookie;
\r
193 var arrCookie=strCookie.split("; ");
\r
194 for(var i=0;i<arrCookie.length;i++){
\r
195 var arr=arrCookie[i].split("=");
\r
196 if(arr[0]==name)return unescape(arr[1]);
\r
200 function setCookie(name,value,expireHours){
\r
201 var cookieString=name+"="+escape(value);
\r
203 var date=new Date();
\r
204 date.setTime(date.getTime+expireHours*3600*1000);
\r
205 cookieString=cookieString+"; expire="+date.toGMTString();
\r
207 document.cookie=cookieString;
\r
210 $this = $("#info_hide_btn");
\r
211 $this.after('<a class="btn" id="info_show_btn" href="javascript:void(0)">Show @</a>');
\r
214 $("#info_show_btn").click(function(){
\r
215 $(".timeline li").each(function(i,o) {
\r
218 $(this).after('<a class="btn" id="info_hide_btn" href="javascript:void(0)">Hide @</a>');
\r
220 $("#info_hide_btn").live("click", function(){
\r
223 setCookie("infoShow","show");
\r
226 $(".timeline li").each(function(i,o) {
\r
227 if ($(this).find(".status_word").text().indexOf("@") > -1) {
\r
231 setCookie("infoShow","hide");
\r