-
-
Save kan/a12249d170259945ec91e34852b1dd58 to your computer and use it in GitHub Desktop.
検索結果のタブを一覧表示するタブを作るtwicli plugin
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
/* twicli plugin (http://twicli.neocat.jp/) | |
* search_history.js | |
* 検索結果を保持して再利用可能に | |
* https://goo.gl/qPHfx6 | |
*/ | |
var tws_history = (readCookie('twicli_search_history') || "").split(/\r?\n/); | |
tws_history.uniq(); | |
registerPlugin({ | |
switchTo: function(tab) { | |
Array.prototype.push.apply(tws_history, tws_list); | |
tws_history.uniq(); | |
if (!$('search_history')) { | |
var newTab = document.createElement('a'); | |
newTab.href = 'javascript:void switchSearchHistory()'; | |
newTab.id = 'search_history'; | |
newTab.innerHTML = '🔍' | |
$("misc").parentNode.insertBefore(newTab, $("misc").nextSibling); | |
} | |
} | |
}) | |
function switchSearchHistory() { | |
switchTo("search_history"); | |
$("tw2h").innerHTML = '<p><form onSubmit="return twsSearch($(\'search_q\').value);"><a href="https://twitter.com/search" target="_blank">'+_('Twitter search')+'</a> : <input type="text" size="15" id="search_q"><button type="submit" class="go"></button></form></p><br />' + | |
tws_history.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(''); | |
writeCookie('twicli_search_history', tws_history.join("\n"), 3652); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment