aboutsummaryrefslogtreecommitdiffstats
path: root/twitterView.js
AgeCommit message (Expand)Author
2008-12-02Follow CVS Head.anekos
2008-05-09 * 空白を修整しました。drry
2008-05-09 * `liberator.plugins.statuses` わたし。drry
2008-05-09 * 若干怖いのでおそなえ。drry
2008-05-09 * 差分取得に変更しました。drry
2008-05-09* ,fでfavmattn
2008-04-23lang/javascript/vimperator-plugins/trunk/twitterView.js: textbox -> labeltrapezoid
2008-04-06lang/javascript/vimperator-plugins/trunk/browser_object.jsdrry
2008-03-26lang/javascript/vimperator-plugins/trunk/twitterView.js: add mapping(,r) for ...trapezoid
2008-03-24lang/javascript/vimperator-plugins/twitterView.js: コマンドラインバ...trapezoid
2008-03-24git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins...trapezoid
2008-03-24lang/javascript/vimperator-plugins/twitterView.js: topics like twitter viewertrapezoid
{ var copycompl = []; function getKanji (word) { var re = /[\u4e00-\u9fa0]+/g; // 一-龠 var ignore = /\u691c\u7d22|\u95a2\u9023/; // 検索|関連 var req = new XMLHttpRequest(); liberator.log(word); var word = encodeURIComponent(word); liberator.log(word); req.open('GET', 'http://www.google.co.jp/search?hl=ja&q=' + word + '&lr=lang_ja', true); var f = function () { var cnt = {}; for each (let it in req.responseText.match(re)) { if (ignore.test(it)) continue; if (cnt[it]) cnt[it] += 1; else cnt[it] = 1; } var cnta = []; for (let i in cnt) { if (cnt[i] < 3) continue; cnta.push([i, cnt[i]]); } cnta.sort(function (a, b) b[1] - a[1]); copycompl = cnta; liberator.commandline.open(":", "gkcopy ", liberator.modes.EX); }; req.onreadystatechange = function (aEvt) { if (req.readyState == 4 && req.status == 200) { f(); } }; req.send(null); } liberator.commands.addUserCommand( ['gkanji', 'googlekanji'], 'Google kanji', function (arg) getKanji(arg.string) ); function copyToClipboard (copytext) { const supstr = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString); const trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable); const clipid = Ci.nsIClipboard; const clip = Cc["@mozilla.org/widget/clipboard;1"].getService(clipid); supstr.data = copytext; trans.addDataFlavor("text/unicode"); trans.setTransferData("text/unicode", supstr, copytext.length * 2); clip.setData(trans, null, clipid.kGlobalClipboard); } liberator.commands.addUserCommand( ['gkcopy'], 'Google kanji', copyToClipboard, { completer: function (args) [0, copycompl] } ); } catch (e) { liberator.log(e) } })();