Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/* twicli plugin (http://twicli.neocat.jp/)
* multi-users.js
* 一度タイムラインを表示したことのあるユーザーのタイムラインを簡単に再表示することができます。
* 複数のユーザーのタイムラインを表示することも可能です。
* http://twitter.com/edvakf/status/20406609758
* http://twitter.com/edvakf/status/20406753129
*/
var viewed_users = [];
registerPlugin({
switchTo: function(tab) {
if (tab.id!=='user') return;
if (last_user.split(',').length > 1) return;
if (viewed_users.length === 0) viewed_users.push(myname);
for (var i = 0; i < viewed_users.length; i++) if (viewed_users[i] === last_user) {
viewed_users.splice(i,1);
break;
}
viewed_users.push(last_user);
if (viewed_users.length > 1 && !$('viewed_users')) {
var newTab = document.createElement('a');
newTab.href = 'javascript:void switchViewedUsers()';
newTab.id = 'viewed_users';
newTab.innerHTML = ''
$("user").parentNode.insertBefore(newTab, $("user").nextSibling);
}
}
})
function switchViewedUsers() {
switchTo("viewed_users");
$("tw2h").innerHTML =
'<p><button onclick="void switchUser(function(c,i,ret){ret=[];'+
'for(i=0;i<c.length;i++) if(c[i].type===\'checkbox\'&&c[i].checked) ret.push(c[i].name);'+
'return ret.length?ret.toString():last_user}(this.parentNode.parentNode.getElementsByTagName(\'input\')))">Show selected users</button></p>'+
viewed_users.reverse().map(function(user) {
return '<p><input type="checkbox" name="'+user+'" '+(user===last_user?'checked':'')+'/>'+
'<a href="'+twitterURL+user+'" onclick="switchUser(\''+user+'\'); return false;">@'+user+'</a></p>'}
).join('');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.