From 9ebfbcd75ce13677e950e3a775fb7e9b410020ee Mon Sep 17 00:00:00 2001 From: anekos Date: Fri, 1 Oct 2010 09:26:01 +0000 Subject: tw!thread サブコマンドを追加!in_reply_to をたどれるよ! git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@38537 d0d07461-0603-4401-acd4-de1884942a52 --- twittperator.js | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'twittperator.js') 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 = Twittperator Twitter Client using ChirpStream OAuth対応Twitterクライアント - 1.8.1.1 + 1.9.0 2.3 2.4 teramako @@ -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) }), ]; // }}} -- cgit v1.2.3