$(function(){\r
-\r
- $("#submit_btn").click(function(e){\r
- updateStatus();\r
- e.preventDefault();\r
- });\r
-\r
- $(".retw_btn").live("click", function(e){\r
- e.preventDefault();\r
- onNwRT($(this));\r
- });\r
-\r
- $(".rt_btn").click(function(e){\r
- e.preventDefault();\r
- if ($("#textbox").length > 0) {\r
- onInfoRT($(this));\r
- } else {\r
- $("#info_head").after('<h2>What\'s happening?</h2>' + formHTML);\r
- formFunc();\r
- onInfoRT($(this));\r
- }\r
- });\r
-\r
- $(".replie_btn").click(function(e){\r
- e.preventDefault();\r
- var replie_id = $("#info_name").text();\r
- if ($("#textbox").length > 0) {\r
- onInfoReplie($(this));\r
- } else {\r
- $("#info_head").after('<h2>In reply to ' + replie_id + '</h2>' + formHTML);\r
- formFunc();\r
- onInfoReplie($(this));\r
+ $("#allTimeline").click(function(e) {\r
+ var $this = $(e.target);\r
+ var type = $this.attr('class');\r
+ switch(type) {\r
+ case 'rt_btn':\r
+ e.preventDefault();\r
+ if ($("#textbox").length > 0) {\r
+ onInfoRT($this);\r
+ } else {\r
+ $("#info_head").after('<h2>What\'s happening?</h2>' + formHTML);\r
+ formFunc();\r
+ onInfoRT($this);\r
+ }\r
+ break;\r
+ case 'retw_btn':\r
+ e.preventDefault();\r
+ onNwRT($this);\r
+ break;\r
+ case 'replie_btn':\r
+ e.preventDefault();\r
+ var replie_id = $this.parent().parent().find(".status_word").find(".user_name").text();\r
+ if ($("#textbox").length > 0) {\r
+ onInfoReplie($this,e);\r
+ } else {\r
+ $("#info_head").after('<h2>In reply to ' + replie_id + '</h2>' + formHTML);\r
+ formFunc();\r
+ onInfoReplie($this,e);\r
+ }\r
+ break;\r
+ case 'favor_btn':\r
+ e.preventDefault();\r
+ onFavor($this);\r
+ break;\r
+ case 'unfav_btn':\r
+ e.preventDefault();\r
+ UnFavor($this);\r
+ break;\r
+ case 'rt_undo':\r
+ e.preventDefault();\r
+ onUndoRt($this);\r
+ break;\r
}\r
});\r
\r
leaveWord();\r
}\r
});\r
-\r
if (getCookie("infoShow") == "hide") {\r
onHide();\r
}\r
-\r
-\r
- $("#info_hide_btn").live("click", function(){\r
+ $("#info_hide_btn").click(function(){\r
onHide();\r
});\r
\r
-\r
- $(".favor_btn").live("click", function(){\r
- e.preventDefault();\r
- onFavor($(this));\r
- });\r
-\r
- $("#info_follow_btn").live("click", function(e){\r
+ $("#info_follow_btn").click(function(e){\r
e.preventDefault();\r
var $this = $(this);\r
var id = $("#info_name").text();\r
data: "action=create&id=" + id,\r
success: function(msg) {\r
if (msg.indexOf("success") >= 0) {\r
- updateSentTip("You have followed " + id + "!");\r
+ updateSentTip("You have followed " + id + "!", 3000, "success");\r
$this.after('<a class="btn btn-red" id="info_block_btn" href="javascript:void(0)">Unfollow</a>');\r
$this.remove();\r
if($('#unblock') != null){\r
});\r
});\r
\r
- $("#info_block_btn").live("click", function(e){\r
+ $("#info_block_btn").click(function(e){\r
e.preventDefault();\r
var $this = $(this);\r
var id = $("#info_name").text();\r
}\r
});\r
\r
- $("#block_btn").live("click", function(e){\r
+ $("#block_btn").click(function(e){\r
e.preventDefault();\r
var $this = $(this);\r
var id = $("#info_name").text();\r
}\r
});\r
\r
- $("#unblock_btn").live("click", function(e){\r
+ $("#unblock_btn").click(function(e){\r
e.preventDefault();\r
var $this = $(this);\r
var id = $("#info_name").text();\r
});\r
}\r
});\r
+ \r
+ $("#report_btn").click(function(e){\r
+ e.preventDefault();\r
+ var $this = $(this);\r
+ var id = $("#info_name").text();\r
+ if (confirm("Are you sure to report " + id + " for spam?")) {\r
+ updateSentTip("Reporting " + id + " for spam...", 5000, "ing");\r
+ $.ajax({\r
+ url: "ajax/relation.php",\r
+ type: "POST",\r
+ data: "action=report&id=" + id,\r
+ success: function(msg) {\r
+ if (msg.indexOf("success") >= 0) {\r
+ updateSentTip("You have reported " + id + " for spam!", 3000, "success");\r
+ /*\r
+ $this.after('<a class="btn" id="unblock_btn" href="javascript:void(0)">Unblock</a>');\r
+ $this.remove();\r
+ \r
+ if($('#info_block_btn') != null){\r
+ $('#info_block_btn').after('<a class="btn btn-green" id="info_follow_btn" href="javascript:void(0)">Follow</a>');\r
+ $('#info_block_btn').remove();\r
+ }\r
+ */\r
+ } else {\r
+ updateSentTip("Failed to report " + id + " for spam, please try again.", 3000, "failure");\r
+ }\r
+ },\r
+ error: function(msg) {\r
+ updateSentTip("Failed to report " + id + " for spam, please try again.", 3000, "failure");\r
+ }\r
+ });\r
+ }\r
+ });\r
+ $("#tweeting_button").click(function (e) {\r
+ e.preventDefault();\r
+ if ($("#textbox").val().length >0 ) {\r
+ updateStatus();\r
+ } \r
+ });\r
+ \r
});\r
\r
function onInfoReplie($this) {\r
\r
function onInfoRT($this) {\r
var replie_id = $("#info_name").text();\r
- $("#textbox").val("RT @" + replie_id + ":" + $this.parent().parent().find(".status_word").text());\r
- $("#textbox").focus();\r
+ var status_word = $this.parent().parent().find(".status_word").clone();\r
+ status_word.find('.tweet a[rel=noreferrer]').each(function(){\r
+ $(this).text($(this).attr('href'));\r
+ });\r
+ $("#textbox").focus().val(" RT @" + replie_id + ":" + status_word.text().replace(replie_id, "")).caret(0);\r
leaveWord();\r
}\r
function getCookie(name){\r