Skip to content

Instantly share code, notes, and snippets.

@azu
Created September 4, 2010 05:11
Show Gist options
  • Save azu/564921 to your computer and use it in GitHub Desktop.
Save azu/564921 to your computer and use it in GitHub Desktop.
検索結果のタブを一覧表示するタブを作るtwicli plugin
/* twicli plugin (http://twicli.neocat.jp/)
* switchViewedSearches.js
* 検索結果のタブを一覧表示するタブを作る - サイドバーなど狭い場所で使ってる人向け
* Pluginsに http://gist.github.com/564921.txt を読み込む
*/
registerPlugin({
switchTo: function(tab) {
if (tws_list.length > 1 && !$('viewed_searches')) {
var newTab = document.createElement('a');
newTab.href = 'javascript:void switchViewedSearches()';
newTab.id = 'viewed_searches';
newTab.innerHTML = '▶'
$("misc").parentNode.insertBefore(newTab, $("misc").nextSibling);
}
}
})
function switchViewedSearches() {
switchTo("viewed_searches");
$("tw2h").innerHTML = tws_list.reverse().map(function(word) {
return '<p style="margin-left:10px;"><a href="http://pcod.no-ip.org/yats/search?query=' + word.replace("#","") + '" onclick="twsSearch(\'' + word + '\'); return false;">' + word + '</a></p>';
}).join('');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment