Last active
August 29, 2015 14:21
-
-
Save troyp/b63a215305678cd2c124 to your computer and use it in GitHub Desktop.
Undo-close-tab-in-background function for Vimperator
This file contains 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
" Undo-close-tab-in-background function for Vimperator | |
command! undob -description "Undo closed tab in background" :js undob(); | |
:js <<EOF | |
undob = function() { | |
var currT = gBrowser.selectedTab; | |
var altT = liberator.modules.tabs.alternate; | |
var ssService = Components.interfaces.nsISessionStore; | |
var ssClass = Components.classes['@mozilla.org/browser/sessionstore;1'] | |
var ss = ssClass.getService(ssService); | |
var closedTabs = JSON.parse(ss.getClosedTabData(window)); | |
var ct0 = closedTabs[0]; | |
ss.undoCloseTab(window, ct0); | |
gBrowser.selectedTab = altT; | |
gBrowser.selectedTab = currT; | |
} | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment