Created
August 29, 2011 13:38
-
-
Save watagashi/1178409 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function press(e) { | |
| if (e != 1) key_press_detected = true; | |
| if (e != 1 && (e.keyCode != 13 && e.keyCode != 10 || | |
| !decr_enter && (e.ctrlKey || e.shiftKey) || decr_enter && !(e.ctrlKey || e.shiftKey)) ) | |
| return true; | |
| var st = document.frm.status; | |
| if (!key_press_detected) st.value = st.value.replace(/\n/g, ""); | |
| if (st.value == '') { | |
| update(); | |
| return false; | |
| } | |
| if (parseInt($("counter").innerHTML,10) < 0) { | |
| alert(_("This tweet is too long.")); | |
| return false; | |
| } | |
| var retry = false; | |
| if (st.value == "r" && last_post) { | |
| retry = true; | |
| st.value = last_post; | |
| in_reply_to_user = last_in_reply_to_user; | |
| setReplyId(last_in_reply_to_status_id); | |
| } | |
| last_post = st.value; | |
| last_in_reply_to_user = in_reply_to_user; | |
| last_in_reply_to_status_id = in_reply_to_status_id; | |
| if (st.value.substr(0,1) == "." || st.value.indexOf("@"+in_reply_to_user) < 0) | |
| setReplyId(false); // "."で始まるか"@ユーザ名"が含まれていない時はin_reply_to指定無し | |
| callPlugins("post", st.value); | |
| st.value += footer; | |
| st.select(); | |
| var text = st.value; | |
| enqueuePost(twitterAPI + 'statuses/update.xml?status=' + encodeURIComponent(st.value) + | |
| (geo && geo.coords ? "&display_coordinates=true&lat=" + geo.coords.latitude + | |
| "&long=" + geo.coords.longitude : "") + | |
| (in_reply_to_status_id ? "&in_reply_to_status_id=" + in_reply_to_status_id : ""), | |
| function(){ resetFrm(); if (auto_update) update() }, | |
| function(){ if (auto_update) { update_post_check = [retry,text]; update() }}, retry); | |
| in_reply_to_user = in_reply_to_status_id = null; | |
| return false; | |
| } | |
| function updateCount() { | |
| setFstHeight(); | |
| if (!no_counter) $("counter-div").style.display = "block"; | |
| // for calculate length with shorten URL. | |
| var s = $("fst").value.replace( | |
| /https?:\/\/[^\/\s]*[\w!#$%&'()*+,.\/:;=?@~-]+(?=&\w+;)|https?:\/\/[^\/\s]*[\w!#$%&'()*+,.\/:;=?@~-]+/g, | |
| function(t) {return "http://t.co/*******".slice(0, t.length);}); | |
| $("counter").innerHTML = 140 - footer.length - s.length; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment