From dee279031601bdcccf63e7f85e97c84ee30f7b3a Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Mon, 23 Jan 2012 23:21:59 +0900 Subject: [PATCH] add ext list-tab-history --- _keysnail.js | 60 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/_keysnail.js b/_keysnail.js index 8a0941e..13c7b9f 100644 --- a/_keysnail.js +++ b/_keysnail.js @@ -142,7 +142,7 @@ local["http://(www|tw|es|de|)\.nicovideo\.jp\/(watch|playlist)/*"] = [ local["^http://www.tumblr.com/dashboard"] = [ // ["C-", function (ev, arg) {gBrowser.mTabContainer.advanceSelectedTab(-1, true); }], // ["C-", function (ev, arg) {gBrowser.mTabContainer.advanceSelectedTab(1, true); }], - ["", function (ev, arg) {window.content.location.href = "http://www.tumblr.com/dashboard"; }], + ["", function (ev, arg) { window.content.location.href = "http://www.tumblr.com/dashboard"; }], // ["", null], ["J", function (ev, arg) { if (window.loadURI) { @@ -151,17 +151,6 @@ local["^http://www.tumblr.com/dashboard"] = [ }], ]; -/////////////////////////////////// -//tanythhing用 -plugins.options["tanything_opt.keymap"] = { - "\\" : "prompt-cancel", - "j" : "prompt-next-completion", - "k" : "prompt-previous-completion", - "o" : "localOpen", - ":" : "localClose", - "L" : "localMovetoend" -}; - ////////////////////////////////////////// // yatc style.register("#keysnail-twitter-client-container{ display:none !important; }"); @@ -399,12 +388,6 @@ ext.add("keysnail-setting-menu",function(){ }); },"open keysnail setting menu"); -// ////////////////////////// -// //プラグイン一括アップデート -// ext.add("check-for-plugins-update", function () { -// [p for (p in plugins.context)].forEach(function (p) { try { userscript.updatePlugin(p); } catch(e) {} }); -// }, "Check for all plugin's update"); - //////////////////////// //マルチプルタブハンドラ ext.add("multiple-tab-handler-close-selected-and-current-tabs", function () { @@ -517,6 +500,40 @@ ext.add("echo-closed-tabs", function () { }, "List closed tabs"); +/////////////////////////////// +ext.add("list-tab-history", function () { + const fav = "chrome://mozapps/skin/places/defaultFavicon.png"; + var tabHistory = []; + var sessionHistory = gBrowser.webNavigation.sessionHistory; + if (sessionHistory.count < 1) + return void display.echoStatusBar("Tab history not exist", 2000); + var curIdx = sessionHistory.index; + for (var i = 0; i < sessionHistory.count; i++) { + var entry = sessionHistory.getEntryAtIndex(i, false); + if (!entry) + continue; + try { + var iconURL = Cc["@mozilla.org/browser/favicon-service;1"] + .getService(Ci.nsIFaviconService) + .getFaviconForPage(entry.URI).spec; + } catch (ex) {} + tabHistory.push([iconURL || fav, entry.title, entry.URI.spec, i]); + } + for (var thIdx = 0; thIdx < tabHistory.length; thIdx++) { + if (tabHistory[thIdx][3] == curIdx) break; + } + + prompt.selector( + { + message : "select history in tab", + collection : tabHistory, + flags : [ICON | IGNORE, 0, 0, IGNORE | HIDDEN], + header : ["Title", "URL"], + initialIndex : thIdx, + callback : function(i) { if (i >= 0) gBrowser.webNavigation.gotoIndex(tabHistory[i][3]); } + }); +}, 'List tab history'); + //}}%PRESERVE% // ========================================================================= // @@ -742,8 +759,7 @@ key.setViewKey([[''], ['']], function (ev, arg) { }, 'ignore'); key.setViewKey(':', function (ev, arg) { - return !document.getElementById("keysnail-prompt").hidden && - document.getElementById("keysnail-prompt-textbox").focus(); + return !document.getElementById("keysnail-prompt").hidden && document.getElementById("keysnail-prompt-textbox").focus(); }, 'KeySnail のプロンプトへフォーカス', true); key.setViewKey('H', function (ev, arg) { @@ -765,3 +781,7 @@ key.setViewKey('C', function (ev, arg) { key.setEditKey('C-', function (ev) { command.walkInputElement(command.elementsRetrieverTextarea, true, true); }, '次のテキストエリアへフォーカス'); + +key.setViewKey('C-', function (ev, arg) { + ext.exec('list-tab-history', arg, ev); +}, 'List tab history', true);