Created
April 2, 2014 20:38
-
-
Save t-f-m/9942634 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
/* | |
* Please write the below line into .vimperatorrc. | |
* let g:twittperator_plugin_rtrt = 1 | |
* | |
*/ | |
/* | |
* idea by http://esuji5.hateblo.jp/entry/2014/04/01/233633 | |
*/ | |
(function () { | |
let explicitOnly = liberator.globalVariables.twittperator_explicit_reference || 0; | |
let afterRT = liberator.globalVariables.twittperator_reference_after || 3; | |
let beforeRT = liberator.globalVariables.twittperator_reference_before || 3; | |
const TW = liberator.plugins.twittperator; | |
function getRefTweets() { | |
tls = []; | |
TW.OAuth.jsonGet('statuses/retweets_of_me', {count: 1}, function (rt_of_me) { | |
rt_of_me.forEach(function (rted) { | |
TW.OAuth.jsonGet('statuses/retweets/' + rted.id_str, {count: 1}, function (rters) { | |
rters.forEach(function (rter, index, rters) { | |
rter_screen_name = rter.user.screen_name; | |
rt_id = rter.id_str; | |
TW.OAuth.jsonGet('statuses/user_timeline', { | |
screen_name: rter_screen_name, | |
since_id: rt_id, | |
//count: afterRT | |
}, function (tl_after) { | |
//liberator.echo(JSON.stringify(tl_after)); | |
TW.Twittperator.showTL(tl_after); | |
}); | |
//tl_before = TW.jsonGet('statuses/user_timeline', {id:rter_id, max_id:rt_id, count: beforeRT}, function(){}); | |
}); | |
// | |
}); | |
}); | |
}); | |
} | |
TW.SubCommands.add( | |
TW.SubCommand({ | |
command: ["rtrt"], | |
description: "reference to RT", | |
action: function (arg) { | |
getRefTweets(); | |
}, | |
timelineCompleter: false | |
//timelineCompleter: true, | |
//completer: Completers.text(function(s){ /RT @/.test(s.text) && s.retweeted_status}) | |
})); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment