aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranekos2010-10-01 09:26:01 +0000
committeranekos2010-10-01 09:26:01 +0000
commit9ebfbcd75ce13677e950e3a775fb7e9b410020ee (patch)
tree28ba9482535a14f839ff9465372c2d028288e38c
parent9c276479a5c8b6cb197bc0084a5d837e37004c51 (diff)
downloadvimperator-plugins-9ebfbcd75ce13677e950e3a775fb7e9b410020ee.tar.bz2
tw!thread サブコマンドを追加!in_reply_to をたどれるよ!
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@38537 d0d07461-0603-4401-acd4-de1884942a52
-rwxr-xr-xtwittperator.js26
1 files changed, 21 insertions, 5 deletions
diff --git a/twittperator.js b/twittperator.js
index 71a8630..ece2966 100755
--- a/twittperator.js
+++ b/twittperator.js
@@ -28,7 +28,7 @@ let PLUGIN_INFO =
<name>Twittperator</name>
<description>Twitter Client using ChirpStream</description>
<description lang="ja">OAuth対応Twitterクライアント</description>
- <version>1.8.1.1</version>
+ <version>1.9.0</version>
<minVersion>2.3</minVersion>
<maxVersion>2.4</maxVersion>
<author mail="teramako@gmail.com" homepage="http://d.hatena.ne.jp/teramako/">teramako</author>
@@ -1902,16 +1902,32 @@ let PLUGIN_INFO =
action: function(arg) liberator.open("http://twitter.com/" + arg, liberator.NEW_TAB),
timelineCompleter: true,
completer: Completers.screenName(rejectMine)
+ }),
SubCommand({
command: ["thread"],
description: "Show tweets thread.",
action: function(arg) {
- function getStatus
- let id = parseInt(arg);
+ function getStatus(id, next) {
+ let result;
+ if (history.some(function (it) (it.id == id && (result = it))))
+ return next(result);
+ tw.get("statuses/show/" + id + ".json", null, function(text) next(JSON.parse(text)))
+ }
+ function trace(st) {
+ thread.push(st);
+ if (st.in_reply_to_status_id) {
+ getStatus(st.in_reply_to_status_id, trace);
+ } else {
+ Twittperator.showTL(thread);
+ }
+ }
+
+ Twittperator.echo("Start thread tracing..");
+ let thread = [];
+ getStatus(parseInt(arg), trace);
},
timelineCompleter: true,
- completer: Completers.id()
- }),
+ completer: Completers.id(function (it) it.in_reply_to_status_id)
}),
]; // }}}