1 var INTERVAL_COOKIE = 'updatesInterval';
4 $("ol.timeline").click(function(e) {
5 var $this = $(e.target);
6 var type = $this.attr('class');
36 case 'msg_replie_btn':
40 case 'msg_delete_btn':
46 markReply($("#allTimeline > li"));
47 $("#submit_btn").click(function (e) {
51 document.onclick = function () {
52 document.title = document.title.replace(/(\([0-9]+\))/g, "");
53 $(".allHighLight").text($(".allHighLight").text().replace(/(\([0-9]+\))/g, ""));
54 $("#statuses .new").each(function () {
55 $("#statuses .new").remove();
58 $("#allReplies").hide();
59 $("#allMessage").hide();
60 $("#allTimelineBtn").click(function () {
61 $("#allTimeline").show();
62 $("#allTimeline img").lazyload({threshold : 100, effect : "fadeIn", placeholder:'img/blank.gif'});
63 $("#allReplies").hide();
64 $("#allMessage").hide();
65 $("#allTimelineBtn").addClass("allHighLight");
66 if ($("#allRepliesBtn").hasClass("allHighLight")) $("#allRepliesBtn").removeClass("allHighLight");
67 else $("#allMessageBtn").removeClass("allHighLight");
68 $("#allTimelineBtn").text($("#allTimelineBtn").text().replace(/(\([0-9]+\))/g, ""));
70 $("#allRepliesBtn").click(function () {
71 $("#allTimeline").hide();
72 $("#allReplies").show();
73 $("#allReplies img").lazyload({threshold : 100, effect : "fadeIn",placeholder:'img/blank.gif'});
74 $("#allMessage").hide();
75 $("#allRepliesBtn").addClass("allHighLight");
76 if ($("#allTimelineBtn").hasClass("allHighLight")) $("#allTimelineBtn").removeClass("allHighLight");
77 else $("#allMessageBtn").removeClass("allHighLight");
78 $("#allRepliesBtn").text($("#allRepliesBtn").text().replace(/(\([0-9]+\))/g, ""));
80 $("#allMessageBtn").click(function () {
81 $("#allTimeline").hide();
82 $("#allReplies").hide();
83 $("#allMessage").show();
84 $("#allMessage img").lazyload({threshold : 100, effect : "fadeIn",placeholder:'img/blank.gif'});
85 $("#allMessageBtn").addClass("allHighLight");
86 if ($("#allRepliesBtn").hasClass("allHighLight")) $("#allRepliesBtn").removeClass("allHighLight");
87 else $("#allTimelineBtn").removeClass("allHighLight");
88 $("#allMessageBtn").text($("#allMessageBtn").text().replace(/(\([0-9]+\))/g, ""));
89 $("#allMessage span.date").timeago();
95 var setUpdateInterval = function () {
96 if (!location.href.split("?")[1] || location.href.split("?")[1] == "p=1") {
97 var interval = parseFloat($.cookie(INTERVAL_COOKIE));
98 if (interval === 0.0) {
101 interval = interval > 0 ? interval : 3;
102 UPDATE_INTERVAL = setInterval(function () {
104 }, interval * 1000 * 60);
109 if (PAUSE_UPDATE === true) {
110 window.setTimeout(update, 5000);
111 } else if (PAUSE_TIMELINE === true) {
114 if($.cookie("intervalChanged") === "true"){
115 clearInterval(UPDATE_INTERVAL);
116 $.cookie("intervalChanged", "")
119 updateSentTip('Retrieving new tweets...', 5000, 'ing');
120 updateFunc("timeline");
121 updateFunc("replies");
122 updateFunc("message");
126 function updateFunc(type, name, pw) {
127 PAUSE_TIMELINE = true;
128 var div, url, btnDiv, param;
131 div = "#allTimeline";
132 btnDiv = "#allTimelineBtn";
133 url = "ajax/updateTimeline.php";
134 $(div + " li.mine").removeClass("mine").addClass("myTweet");
138 btnDiv = "#allRepliesBtn";
139 url = "ajax/updateReplies.php";
143 btnDiv = "#allMessageBtn";
144 url = "ajax/updateMessage.php";
148 if (div === "#allTimeline") {
149 since_id = $(div + " li:not(.myTweet):not(#ajax_statuses li):first").find("span.status_id").text();
151 since_id = $(div + " li:first-child").find("span.status_id").text();
157 data: "since_id=" + since_id,
158 success: function (msg) {
159 if ($.trim(msg).indexOf("</li>") > 0) {
160 var source = $(msg).prependTo(div);
161 if (div === "#allTimeline") {
162 $(div + " li.myTweet:not(:first)").removeClass("myTweet");
163 markReply($('#allTimeline > li'));
167 if (document.title.match(/\d+/) != null) {
168 num = parseInt(document.title.match(/\d+/));
170 var len = $(msg).length - 1;
171 document.title = "(" + (num + len) + ") " + document.title.replace(/(\([0-9]+\))/g, "");
172 if ($(btnDiv).text().match(/\d+/) != null) {
173 navNum = parseInt($(btnDiv).text().match(/\d+/));
175 $(btnDiv).text($(btnDiv).text().replace(/(\([0-9]+\))/g, "") + "(" + (navNum + len) + ")");
178 if($("div.new").length == 1) {
179 $("div.new").show().slideDown("fast");
181 $("div.new").filter(":first").remove();
182 $("span.tweetcount").filter(":last").text(navNum + len);
184 $("span.big-retweet-icon").tipsy({
187 previewMedia(source);
189 PAUSE_TIMELINE = false;
191 error: function (msg) {
192 PAUSE_TIMELINE = false;